diff --git a/frontend/src/app/(public)/pay/[id]/cancelled/page.tsx b/frontend/src/app/(public)/pay/[id]/cancelled/page.tsx new file mode 100644 index 0000000..36168d8 --- /dev/null +++ b/frontend/src/app/(public)/pay/[id]/cancelled/page.tsx @@ -0,0 +1,30 @@ +"use client"; + +import { useEffect, useState } from "react"; + +export default function CancelledPage() { + const [mounted, setMounted] = useState(false); + + useEffect(() => { + setMounted(true); + }, []); + + if (!mounted) return null; + + return ( +
+
+

Payment Cancelled

+

+ You have successfully cancelled this payment. You may now safely close this tab. +

+ +
+
+ ); +} diff --git a/frontend/src/app/(public)/pay/[id]/page.tsx b/frontend/src/app/(public)/pay/[id]/page.tsx index 95c8c4f..a41209d 100644 --- a/frontend/src/app/(public)/pay/[id]/page.tsx +++ b/frontend/src/app/(public)/pay/[id]/page.tsx @@ -1,7 +1,7 @@ "use client"; import { useEffect, useState, type CSSProperties } from "react"; -import { useParams } from "next/navigation"; +import { useParams, useRouter } from "next/navigation"; import { useLocale, useTranslations } from "next-intl"; import { useWallet } from "@/lib/wallet-context"; import { Spinner } from "@/components/ui/Spinner"; @@ -401,6 +401,7 @@ export default function PaymentPage() { const locale = localeToLanguageTag(useLocale()); const params = useParams(); const paymentId = params.id as string; + const router = useRouter(); const [payment, setPayment] = useState(null); const [loading, setLoading] = useState(true); @@ -411,6 +412,7 @@ export default function PaymentPage() { const [showConfetti, setShowConfetti] = useState(false); const [isDownloadingReceipt, setIsDownloadingReceipt] = useState(false); const [isPayModalOpen, setIsPayModalOpen] = useState(false); + const [isCancelModalOpen, setIsCancelModalOpen] = useState(false); const [networkFee, setNetworkFee] = useState(null); const [networkFeeLoading, setNetworkFeeLoading] = useState(false); @@ -1064,6 +1066,15 @@ export default function PaymentPage() { onConnected={() => {}} /> )} + + {/* Cancel Payment Link */} + )} @@ -1172,6 +1183,37 @@ export default function PaymentPage() { + + setIsCancelModalOpen(false)} + title="Cancel Payment" + > +
+

+ Are you sure you want to cancel this payment? +

+
+ + +
+
+
); }