import { redirect } from "next/navigation"; import { getTopup } from "@/actions/payment"; import CancelTopupButton from "@/components/billing/cancel-topup-button"; import ExpiryCountDown from "@/components/billing/expiry-time-countdown"; import ClientErrorMessage from "@/components/client-error-message"; import TopupToPay from "@/components/topup-to-pay"; import { Button } from "@/components/ui/button"; import { TextShimmer } from "@/components/ui/text-shimmer"; import { cn } from "@/lib/utils"; import { tryCatch } from "@/utils/tryCatch"; export default async function TopupPage({ params, }: { params: Promise<{ topupId: string }>; }) { const topupId = (await params).topupId; const [error, topup] = await tryCatch(getTopup({ id: topupId })); if (error) { if (error.message === "Invalid token.") redirect("/auth/signin"); return ; } return (

Topup

{!topup.is_expired || (topup.status !== "PENDING" && ( ))} {topup.status === "PENDING" && !topup.is_expired && ( )} {!topup.paid && (topup.is_expired ? ( ) : topup.status === "PENDING" ? ( ) : topup.status === "CANCELLED" ? ( ) : ( "" ))}
{ (!topup.paid && topup.status === "PENDING" && !topup.is_expired) && ( ) }
); }