From 7b3ab5901e423156a741da1feecf142656d2c56f Mon Sep 17 00:00:00 2001 From: Benson Cho <100653148+choden-dev@users.noreply.github.com> Date: Sat, 25 Apr 2026 19:16:15 +1200 Subject: [PATCH 1/2] feat: distinguish 'change' vs 'select' timeslot in pickup UI When the user already has a timeslot and navigates to the pickup step, the UI now clearly indicates they are changing their timeslot: TimeslotSelector: - New optional currentTimeslot prop - Shows an orange 'CURRENT TIMESLOT' card at the top with the existing date/time when changing - Heading changes to 'Change Pickup Timeslot' vs 'Select a Pickup Timeslot' - Button text changes to 'Update Timeslot' / 'Updating...' vs 'Confirm Timeslot' / 'Confirming...' OrderSteps: - Passes orderDetails.pickupTimeslot to TimeslotSelector - Heading changes to 'Change Pickup Time' vs 'Select Pickup Time' - Description text adapts accordingly --- components/ordercontainer/OrderSteps.tsx | 20 +++++++++-- components/pickup/TimeslotSelector.tsx | 44 ++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 6 deletions(-) diff --git a/components/ordercontainer/OrderSteps.tsx b/components/ordercontainer/OrderSteps.tsx index afc15d1..32c76fd 100644 --- a/components/ordercontainer/OrderSteps.tsx +++ b/components/ordercontainer/OrderSteps.tsx @@ -440,20 +440,34 @@ export default function OrderSteps({ // ── Pickup step ──────────────────────────────────────────────── if (step === OrderStep.PICKUP) { + const hasExistingTimeslot = !!orderDetails?.pickupTimeslot; + return ( - 📍 Select Pickup Time + {hasExistingTimeslot + ? "📍 Change Pickup Time" + : "📍 Select Pickup Time"} - Order {orderNumber} has been paid. Choose when - you'd like to collect it. + {hasExistingTimeslot ? ( + <> + Order {orderNumber} already has a pickup time. + Select a new timeslot below. + + ) : ( + <> + Order {orderNumber} has been paid. Choose when + you'd like to collect it. + + )} onPickupConfirmed()} onCancel={() => router.push("/my-orders")} /> diff --git a/components/pickup/TimeslotSelector.tsx b/components/pickup/TimeslotSelector.tsx index 58da5e9..f25d568 100644 --- a/components/pickup/TimeslotSelector.tsx +++ b/components/pickup/TimeslotSelector.tsx @@ -44,8 +44,17 @@ interface TimeslotResponse { hasMore: boolean; } +interface CurrentTimeslot { + date: string; + startTime: string; + endTime: string; + label?: string; +} + interface TimeslotSelectorProps { orderId: string; + /** If provided, indicates the user is changing an existing timeslot. */ + currentTimeslot?: CurrentTimeslot | null; onTimeslotSelected: ( timeslotId: string, pickupInstructions?: unknown[], @@ -106,9 +115,11 @@ async function fetchTimeslots(page: number): Promise { */ export function TimeslotSelector({ orderId, + currentTimeslot, onTimeslotSelected, onCancel, }: TimeslotSelectorProps) { + const isChanging = !!currentTimeslot; const [selectedId, setSelectedId] = useState(null); const [submitting, setSubmitting] = useState(false); const [submitError, setSubmitError] = useState(null); @@ -204,9 +215,36 @@ export function TimeslotSelector({ transition="opacity 0.15s ease" > - Select a Pickup Timeslot + {isChanging ? "Change Pickup Timeslot" : "Select a Pickup Timeslot"} + {/* Show current timeslot when changing */} + {isChanging && currentTimeslot && ( + + + CURRENT TIMESLOT + + + {formatDateHeading( + currentTimeslot.date.includes("T") + ? currentTimeslot.date.split("T")[0] + : currentTimeslot.date, + )} + + + {currentTimeslot.startTime} – {currentTimeslot.endTime} + {currentTimeslot.label ? ` · ${currentTimeslot.label}` : ""} + + + )} + {submitError && ( @@ -328,9 +366,9 @@ export function TimeslotSelector({ onClick={handleSubmit} isDisabled={!selectedId || submitting} isLoading={submitting} - loadingText="Confirming..." + loadingText={isChanging ? "Updating..." : "Confirming..."} > - Confirm Timeslot + {isChanging ? "Update Timeslot" : "Confirm Timeslot"}