From 1259effa5b9986e0efd961e3caf9ac2a3fa103a5 Mon Sep 17 00:00:00 2001 From: shafi54 <108669266+shafi-aviz@users.noreply.github.com> Date: Wed, 14 Oct 2026 00:46:20 +0530 Subject: [PATCH] enh --- .../QuickDeliveryAddressSelector.tsx | 30 +++++++------ apps/user-ui/components/SlotSpecificView.tsx | 9 ++-- .../location/LocationFallbackFlow.tsx | 43 ++++++++++++++++++- change-log.txt | 25 +++++++++++ 4 files changed, 90 insertions(+), 17 deletions(-) diff --git a/apps/user-ui/components/QuickDeliveryAddressSelector.tsx b/apps/user-ui/components/QuickDeliveryAddressSelector.tsx index 8b3ec11..92419de 100644 --- a/apps/user-ui/components/QuickDeliveryAddressSelector.tsx +++ b/apps/user-ui/components/QuickDeliveryAddressSelector.tsx @@ -10,6 +10,7 @@ import { useAddressStore } from '@/src/store/addressStore'; import { useRegion } from '@/src/hooks/useRegion'; import { confirmRegionSwitch } from '@/src/lib/region-switch'; import { useSlots } from '@/src/hooks/prominent-api-hooks'; +import LocationBar from '@/src/components/LocationBar'; import dayjs from 'dayjs'; interface QuickDeliveryAddressSelectorProps { @@ -151,18 +152,23 @@ const QuickDeliveryAddressSelector: React.FC <> {isForFlashDelivery && ( - - router.back()} - style={tw`p-2 -ml-2`} - activeOpacity={0.7} - > - - - - Delivery in within 1 hour - - + <> + + router.back()} + style={tw`p-2 -ml-2`} + activeOpacity={0.7} + > + + + + Delivery in within 1 hour + + + + {/* Address selector: full-width, right under the header. */} + + )} {!isForFlashDelivery && ( diff --git a/apps/user-ui/components/SlotSpecificView.tsx b/apps/user-ui/components/SlotSpecificView.tsx index e061fc6..b05ad94 100644 --- a/apps/user-ui/components/SlotSpecificView.tsx +++ b/apps/user-ui/components/SlotSpecificView.tsx @@ -7,7 +7,6 @@ import { useRouter, usePathname } from 'expo-router'; import MaterialIcons from '@expo/vector-icons/MaterialIcons'; import { tw, theme, MyText, MyTouchableOpacity, MyFlatList, AppContainer, MiniQuantifier, SearchBar } from 'common-ui'; import { trpc } from '@/src/trpc-client'; -import LocationBar from '@/src/components/LocationBar'; import { useAllProducts, useStores, useSlots } from '@/src/hooks/prominent-api-hooks'; import { AllProductsApiType } from '@backend/trpc/router'; import { useQuickDeliveryStore } from '@/src/store/quickDeliveryStore'; @@ -183,7 +182,12 @@ export function SlotLayout({ slotId, storeId, baseUrl, isForFlashDelivery }: Slo return ( <> - + - = ({ onClose, notice, onOpenSettings }) => { const queryClient = useQueryClient() const utils = trpc.useUtils() + const router = useRouter() + const pathname = usePathname() const auth = useAuthOptional() const isAuthenticated = auth?.isAuthenticated ?? false + const isAuthLoading = auth?.isLoading ?? false const [mode, setMode] = useState<'choose' | 'add'>('choose') const [busy, setBusy] = useState(false) const [message, setMessage] = useState(null) const resolvedRef = useRef(null) + // Signed out: their saved addresses live behind the account. Remember where we + // are so login returns here (same contract LoginWall / useAuthenticatedRoute + // use), then the addresses load automatically. + const handleLogin = useCallback(async () => { + const redirectState: RedirectState = { + targetUrl: pathname, + queryParams: {}, + timestamp: Date.now(), + } + try { + await StorageServiceCasual.setItem(constants.AUTH_REDIRECT_KEY, JSON.stringify(redirectState)) + } catch { + // ignore storage failure — still navigate to login + } + router.push('/(auth)/login') + }, [pathname, router]) + const addressesQuery = trpc.user.address.getUserAddresses.useQuery(undefined, { enabled: isAuthenticated, }) @@ -216,7 +239,7 @@ const LocationFallbackFlow: React.FC = ({ onClose, no )} - + {isAuthenticated && addresses.map((address) => ( = ({ onClose, no + {!isAuthenticated && !isAuthLoading && ( + + + Login to get existing addresses. + + + Login + + + )} + {busy && ( diff --git a/change-log.txt b/change-log.txt index 021090d..02a507b 100644 --- a/change-log.txt +++ b/change-log.txt @@ -4129,3 +4129,28 @@ user-ui (possibly elevated) global store is no longer treated as global by the tag/combo guards. Reviews deliberately left as-is (regional admins still can't see global products' reviews). No dependency added. No migration. No tests run. + +2026-10-14 00:18:25 Flash delivery: move the address selector under the header. + apps/user-ui/components/QuickDeliveryAddressSelector.tsx: the flash branch now renders the + LocationBar (address selector) directly under the "Delivery in within 1 hour" row, full width. + apps/user-ui/components/SlotSpecificView.tsx: + + SlotLayout header wrapper is a column for flash (was flex-row + px-4) so the title and the + address bar stack; the title row carries its own px-4 to keep its inset. + + removed the LocationBar (and its import) from FlashDeliveryProducts' ListHeaderComponent — + the address now appears once, in the header; the search bar stays in the list header. + No dependency added. No migration. No tests run. + +2026-10-14 00:27:03 Location gate: offer login for existing addresses when signed out. + apps/user-ui/src/components/location/LocationFallbackFlow.tsx: the choose view now shows a + "Login to get existing addresses." banner with a Login button when the user is signed out + (and auth has settled). Tapping it stores the auth redirect target (same + constants.AUTH_REDIRECT_KEY contract LoginWall uses) and pushes /(auth)/login, so login + returns to the current screen and the saved addresses become selectable. + No dependency added. No migration. No tests run. + +2026-10-14 00:31:00 Location gate: pin the login prompt to the bottom. + apps/user-ui/src/components/location/LocationFallbackFlow.tsx: moved the "Login to get existing + addresses." message + Login button out of the top banner into a bottom-pinned block (full-width + button, top border); the address list ScrollView is now flex-1 so it scrolls between the header + and the bottom block. + No dependency added. No migration. No tests run.