From 7b84cd761b3c6839933b1a1c81dadf20a1439179 Mon Sep 17 00:00:00 2001 From: Andrew Smithwick Date: Fri, 26 Apr 2024 23:51:35 -0700 Subject: [PATCH] Revert "Added Reschedule missing or cancelled pickup (#238)" This reverts commit d26e37019d0d8102770449e55a168682f6b07c6d. --- src/components/store/OrderCard/index.tsx | 7 ++----- src/components/store/OrderSummary/index.tsx | 6 +----- .../store/PickupEventDetail/index.tsx | 2 +- .../store/PickupEventPicker/index.tsx | 20 +++++++++---------- 4 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/components/store/OrderCard/index.tsx b/src/components/store/OrderCard/index.tsx index 12807be6..18d5013c 100644 --- a/src/components/store/OrderCard/index.tsx +++ b/src/components/store/OrderCard/index.tsx @@ -46,7 +46,6 @@ const OrderCard = ({ order, futurePickupEvents }: OrderCardProps) => { const [pickupEvent, setPickupEvent] = useState(order.pickupEvent); const [orderStatus, setOrderStatus] = useState(order.status); const orderOpen = open && orderData !== null; - const [statusName, setStatusName] = useState(orderStatusName[orderStatus]); useEffect(() => { if (open && orderData === null) { @@ -58,10 +57,8 @@ const OrderCard = ({ order, futurePickupEvents }: OrderCardProps) => { reportError('Error loading order!', e); setOrderData(null); }); - } else if (open) { - setStatusName(orderStatusName[orderStatus]); } - }, [open, order.uuid, orderData, pickupEvent, orderStatus]); + }, [open, order.uuid, orderData]); const cancelOrder = async () => { await StoreManager.cancelMerchOrder(order.uuid); @@ -71,10 +68,10 @@ const OrderCard = ({ order, futurePickupEvents }: OrderCardProps) => { const rescheduleOrderPickup = async (pickup: PublicOrderPickupEvent) => { await StoreManager.rescheduleOrderPickup(order.uuid, pickup.uuid); setPickupEvent(pickup); - setOrderStatus(OrderStatus.PLACED); }; const statusColor = orderStatusColor[orderStatus]; + const statusName = orderStatusName[orderStatus]; return (
diff --git a/src/components/store/OrderSummary/index.tsx b/src/components/store/OrderSummary/index.tsx index f8d9810c..d0db8e75 100644 --- a/src/components/store/OrderSummary/index.tsx +++ b/src/components/store/OrderSummary/index.tsx @@ -30,11 +30,7 @@ const isOrderActionable = (status: OrderStatus, pickupEvent: PublicOrderPickupEv const now = new Date(); const eventStart = new Date(pickupEvent.start); eventStart.setDate(eventStart.getDate() - 2); - if ( - now > eventStart && - status !== OrderStatus.PICKUP_MISSED && - status !== OrderStatus.PICKUP_CANCELLED - ) { + if (now > eventStart) { return false; } return true; diff --git a/src/components/store/PickupEventDetail/index.tsx b/src/components/store/PickupEventDetail/index.tsx index 75202243..6881fc20 100644 --- a/src/components/store/PickupEventDetail/index.tsx +++ b/src/components/store/PickupEventDetail/index.tsx @@ -29,7 +29,7 @@ const PickupEventDetail = ({ pickupEvent }: PickupEventDetailProps) => { {title} - {formatEventDate(start, end, true)} + {formatEventDate(start, end)} {hasLinkedEvent ? ( {linkedEvent?.location} diff --git a/src/components/store/PickupEventPicker/index.tsx b/src/components/store/PickupEventPicker/index.tsx index 1fd8bc12..461d4a64 100644 --- a/src/components/store/PickupEventPicker/index.tsx +++ b/src/components/store/PickupEventPicker/index.tsx @@ -23,17 +23,15 @@ const PickupEventPicker = ({ events, eventIndex, setEventIndex, active }: EventP className={styles.slider} style={{ transform: `translateX(calc(-1 * var(--width) * ${eventIndex}))` }} > - {events - .sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()) - .map(event => ( - - ))} + {events.map(event => ( + + ))}
) : (