Skip to content

Commit 5991742

Browse files
authored
Lego/chore/feedback (#52)
# Summary - Purchase: - Filter tickets with 0 quantity - Block the button when waiting for a redirect to the Payment Platform - Purchase Success: Update hero for better understanding - Event Details: Fix UI error on small screen QR Code
1 parent 1f438ff commit 5991742

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

Diff for: app/components/MyEvent/MyEvent.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const Ticket = ({
4848
<Card className="h-full bg-white p-6 text-black">
4949
<div className="relative mx-auto mt-4 w-full max-w-[90%] text-center">
5050
<div className={cn(showQR ? "" : "blur-lg")}>
51-
<QRCode className="mx-auto" value={ticket.id} />
51+
<QRCode className="mx-auto max-w-[90%]" value={ticket.id} />
5252
</div>
5353
<Button
5454
className="mt-8"

Diff for: app/components/PurchaseOrder/Callback.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ const PurchaseStatusAlert = ({
8383
classNames:
8484
"border-green-800/50 text-green-800 dark:border-green-400/50 dark:text-green-400 [&>svg]:text-green-800 dark:[&>svg]:text-green-400",
8585
title: "Compra completada",
86-
description: "Felicidades vas a asistir a la próxima",
86+
description:
87+
"YA ESTAS LIST@! 🎉. Cuéntale al mundo, Compártelo tus redes!",
8788
},
8889
[PurchaseOrderStatusEnum.Expired]: {
8990
icon: <CircleCheck className="size-4" />,

Diff for: app/components/TicketsSaleFlow/ConfirmationTab.tsx

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MouseEventHandler, useCallback } from "react";
1+
import { MouseEventHandler, useCallback, useState } from "react";
22
import { toast } from "sonner";
33

44
import { Card, CardContent } from "~/components/ui/card";
@@ -39,16 +39,16 @@ export const ConfirmationTab = ({
3939
) => string | null;
4040
currencyId: string;
4141
}) => {
42-
const [purchaseOrderMutation, purchaseOrderMutationResults] =
43-
useCreatePurchaseOrderMutation();
42+
const [isDisabled, setIsDisabled] = useState(false);
43+
const [purchaseOrderMutation] = useCreatePurchaseOrderMutation();
4444
const createPurchaseOrder = useCallback(async () => {
45-
// calls the mutation
46-
const purchaseOrder = Object.entries(selectedTickets).map(
47-
([ticketId, quantity]) => ({
45+
setIsDisabled(true);
46+
const purchaseOrder = Object.entries(selectedTickets)
47+
.filter(([, quantity]) => quantity > 0)
48+
.map(([ticketId, quantity]) => ({
4849
ticketId,
4950
quantity,
50-
}),
51-
);
51+
}));
5252

5353
await purchaseOrderMutation({
5454
variables: {
@@ -73,18 +73,20 @@ export const ConfirmationTab = ({
7373
}, 2000);
7474
}
7575
} else {
76+
setIsDisabled(false);
7677
toast.error(
7778
"Ocurrió un error al intentar comprar tus tickets. Por favor intenta de nuevo.",
7879
);
7980
}
8081
},
8182
onError() {
83+
setIsDisabled(false);
8284
toast.error(
8385
"Ocurrió un error al intentar comprar tus tickets. Por favor intenta de nuevo.",
8486
);
8587
},
8688
});
87-
}, [currencyId, purchaseOrderMutation, selectedTickets]);
89+
}, [currencyId, purchaseOrderMutation, selectedTickets, setIsDisabled]);
8890

8991
return (
9092
<div className="flex flex-col gap-4">
@@ -155,9 +157,7 @@ export const ConfirmationTab = ({
155157
console.error(error);
156158
});
157159
}}
158-
isDisabled={
159-
numberOfTickets === 0 || purchaseOrderMutationResults.loading
160-
}
160+
isDisabled={numberOfTickets === 0 || isDisabled}
161161
total={formattedTotal}
162162
/>
163163
</div>

0 commit comments

Comments
 (0)