import type { Invoice } from "@getalby/lightning-tools/bolt11"; import { ArrowLeftIcon, CopyIcon, ExternalLinkIcon, HandCoinsIcon, } from "lucide-react"; import { useEffect } from "react"; import { useLocation, useNavigate } from "react-router"; import ExternalLink from "src/components/ExternalLink"; import { FormattedBitcoinAmount } from "src/components/FormattedBitcoinAmount"; import FormattedFiatAmount from "src/components/FormattedFiatAmount"; import { Button } from "src/components/ui/button"; import { Card, CardContent, CardFooter, CardHeader, CardTitle, } from "src/components/ui/card"; import { copyToClipboard } from "src/lib/clipboard"; import AppHeader from "src/components/AppHeader"; import LottieSuccess from "src/components/LottieSuccess"; import { LinkButton } from "src/components/ui/custom/link-button"; export default function PaymentSuccess() { const { state } = useLocation(); const navigate = useNavigate(); useEffect(() => { if (!state?.preimage) { navigate("/wallet/send"); } }, [state, navigate]); if (!state?.preimage || !state?.invoice) { return null; } const to = state?.to as string; const pageTitle = state?.pageTitle as string; const invoice = state?.invoice as Invoice; const amountSat = state?.amountSat as number; const copy = () => { copyToClipboard(state.preimage as string); }; return (
to {to}
)} {invoice.description && ({invoice.description}
)}{action.message}
{action.description}
{action.url}