From d26e37019d0d8102770449e55a168682f6b07c6d Mon Sep 17 00:00:00 2001 From: Andrew Smithwick Date: Fri, 26 Apr 2024 23:48:31 -0700 Subject: [PATCH 1/2] Added Reschedule missing or cancelled pickup (#238) * Added Reschedule missing or cancelled pickup Sorted events by status Allow you to reschedule pickup events (and tag properly updates without refresh) Difference between Pickup Cancelled and Cancelled * Removed unused console.log statement --- 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, 22 insertions(+), 13 deletions(-) diff --git a/src/components/store/OrderCard/index.tsx b/src/components/store/OrderCard/index.tsx index 18d5013c..12807be6 100644 --- a/src/components/store/OrderCard/index.tsx +++ b/src/components/store/OrderCard/index.tsx @@ -46,6 +46,7 @@ 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) { @@ -57,8 +58,10 @@ const OrderCard = ({ order, futurePickupEvents }: OrderCardProps) => { reportError('Error loading order!', e); setOrderData(null); }); + } else if (open) { + setStatusName(orderStatusName[orderStatus]); } - }, [open, order.uuid, orderData]); + }, [open, order.uuid, orderData, pickupEvent, orderStatus]); const cancelOrder = async () => { await StoreManager.cancelMerchOrder(order.uuid); @@ -68,10 +71,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 d0db8e75..f8d9810c 100644 --- a/src/components/store/OrderSummary/index.tsx +++ b/src/components/store/OrderSummary/index.tsx @@ -30,7 +30,11 @@ const isOrderActionable = (status: OrderStatus, pickupEvent: PublicOrderPickupEv const now = new Date(); const eventStart = new Date(pickupEvent.start); eventStart.setDate(eventStart.getDate() - 2); - if (now > eventStart) { + if ( + now > eventStart && + status !== OrderStatus.PICKUP_MISSED && + status !== OrderStatus.PICKUP_CANCELLED + ) { return false; } return true; diff --git a/src/components/store/PickupEventDetail/index.tsx b/src/components/store/PickupEventDetail/index.tsx index 6881fc20..75202243 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)} + {formatEventDate(start, end, true)} {hasLinkedEvent ? ( {linkedEvent?.location} diff --git a/src/components/store/PickupEventPicker/index.tsx b/src/components/store/PickupEventPicker/index.tsx index 461d4a64..1fd8bc12 100644 --- a/src/components/store/PickupEventPicker/index.tsx +++ b/src/components/store/PickupEventPicker/index.tsx @@ -23,15 +23,17 @@ const PickupEventPicker = ({ events, eventIndex, setEventIndex, active }: EventP className={styles.slider} style={{ transform: `translateX(calc(-1 * var(--width) * ${eventIndex}))` }} > - {events.map(event => ( - - ))} + {events + .sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()) + .map(event => ( + + ))}
) : (
From 03e2a12509083358ef447b8665043b90b3e91d49 Mon Sep 17 00:00:00 2001 From: Alex Zhang Date: Fri, 26 Apr 2024 23:53:37 -0700 Subject: [PATCH 2/2] Live tag - Fix animation flash on Safari (#239) * Fix animation flash * remove unnecessary css --- .../events/EventBadges/style.module.scss | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/components/events/EventBadges/style.module.scss b/src/components/events/EventBadges/style.module.scss index 9908018a..168e7122 100644 --- a/src/components/events/EventBadges/style.module.scss +++ b/src/components/events/EventBadges/style.module.scss @@ -23,13 +23,18 @@ animation: pulse 1s ease-in-out infinite alternate; @keyframes pulse { - 0% { opacity: 0 } - 100% {opacity: 1 } + 0% { + opacity: 0; + } + + 100% { + opacity: 1; + } } } &::before { - animation: pulse2 2s ease-out forwards infinite; + animation: pulse2 2s ease-out reverse infinite; border: 2px solid vars.$danger-1; border-radius: 5px; content: ''; @@ -37,16 +42,16 @@ @keyframes pulse2 { 0% { - filter: blur(0); - inset: 0; - opacity: 1; - } - - 100% { filter: blur(2px); inset: -0.75rem; opacity: 0; } + + 100% { + filter: blur(0); + inset: 0; + opacity: 1; + } } } }