Skip to content

Commit

Permalink
Revert "Added Reschedule missing or cancelled pickup (#238)"
Browse files Browse the repository at this point in the history
This reverts commit d26e370.
  • Loading branch information
WishingWell13 authored Apr 27, 2024
1 parent d26e370 commit 7b84cd7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
7 changes: 2 additions & 5 deletions src/components/store/OrderCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const OrderCard = ({ order, futurePickupEvents }: OrderCardProps) => {
const [pickupEvent, setPickupEvent] = useState<PublicOrderPickupEvent>(order.pickupEvent);
const [orderStatus, setOrderStatus] = useState<OrderStatus>(order.status);
const orderOpen = open && orderData !== null;
const [statusName, setStatusName] = useState<string>(orderStatusName[orderStatus]);

useEffect(() => {
if (open && orderData === null) {
Expand All @@ -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);
Expand All @@ -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 (
<div className={styles.card}>
Expand Down
6 changes: 1 addition & 5 deletions src/components/store/OrderSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/components/store/PickupEventDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const PickupEventDetail = ({ pickupEvent }: PickupEventDetailProps) => {
{title}
</Typography>
<Typography variant="h2/regular" className={styles.title} suppressHydrationWarning>
{formatEventDate(start, end, true)}
{formatEventDate(start, end)}
</Typography>
{hasLinkedEvent ? (
<Typography variant="h3/regular">{linkedEvent?.location}</Typography>
Expand Down
20 changes: 9 additions & 11 deletions src/components/store/PickupEventPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 => (
<EventCard
key={event.uuid}
event={event}
attended={false}
borderless
showYear={false}
/>
))}
{events.map(event => (
<EventCard
key={event.uuid}
event={event}
attended={false}
borderless
showYear={false}
/>
))}
</div>
) : (
<div className={styles.noEvents}>
Expand Down

0 comments on commit 7b84cd7

Please sign in to comment.