From 40cbf0c7889754624e0a9b4834ad13139f6dad20 Mon Sep 17 00:00:00 2001 From: Mike Solomon Date: Wed, 20 Nov 2024 10:45:35 -0500 Subject: [PATCH] add a request again btn --- app/checkout/page.tsx | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/checkout/page.tsx b/app/checkout/page.tsx index 82dd145..fdb8267 100644 --- a/app/checkout/page.tsx +++ b/app/checkout/page.tsx @@ -12,7 +12,7 @@ import QRCodeFooter from '@/app/component/qrCode'; import useRealtimeDb from '@/app/hooks/useRealtimeDb'; import Link from 'next/link'; -import { ArrowLeft02Icon, CheckmarkCircle02Icon, Loading02Icon, QrCodeIcon, SmartphoneWifiIcon } from 'hugeicons-react'; +import { ArrowLeft02Icon, ArrowReloadHorizontalIcon, CheckmarkCircle02Icon, Loading02Icon, QrCodeIcon, SmartphoneWifiIcon } from 'hugeicons-react'; import shortenAddress from '../helpers/shortenAddress'; import { generateContractCallPayload, generateEip712Payload } from '../utils'; import { PaymentMethod } from '../types/payments'; @@ -34,6 +34,7 @@ export default function Checkout({ searchParams }: { searchParams: any }) { const [awaitingTransaction, setAwaitingTransaction] = useState(false); const [transactionSubmitted, setTransactionSubmitted] = useState(false); const [transactionConfirmed, setTransactionConfirmed] = useState(false); + const [lastTxType, setLastTxType] = useState(); const hideButtons = useMemo(() => { return awaitingTransaction || transactionSubmitted || transactionConfirmed; @@ -156,6 +157,7 @@ export default function Checkout({ searchParams }: { searchParams: any }) { } setIsLoading(true); + setLastTxType(undefined); setTimeout(async function () { if (type === 'eip681') { const eip681Uri = GeneratePaymentLink(totalAmount, resolvedAddress); @@ -169,6 +171,7 @@ export default function Checkout({ searchParams }: { searchParams: any }) { } createPaymentLink(type); setIsLoading(false); + setLastTxType(type); }, 1000); }; @@ -205,10 +208,18 @@ export default function Checkout({ searchParams }: { searchParams: any }) {
- - - Back - +
+ + + Back + + {lastTxType && ( + + )} +
{totalAmount.toLocaleString([], { style: "currency", currency: "usd" })}