Files
2026-03-10 01:35:37 -05:00

61 lines
2.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { Suspense, useEffect } from "react";
import { useSearchParams } from "next/navigation";
import Link from "next/link";
import { Header } from "@/app/components";
import { PayButton } from "@/app/components/PayButton";
function PayContent() {
const searchParams = useSearchParams();
useEffect(() => {
if (typeof window !== "undefined" && searchParams.get("test") === "ok") {
localStorage.setItem("pay", "ok");
window.location.href = "/pay/paid";
}
}, [searchParams]);
if (searchParams.get("test") === "ok") {
return (
<div className="flex min-h-screen items-center justify-center">
<p className="text-[var(--muted-foreground)]">...</p>
</div>
);
}
return (
<div className="min-h-screen bg-[var(--background)] text-[var(--foreground)]">
<Header />
<main className="flex min-h-[80vh] flex-col items-center justify-center px-4">
<h1 className="mb-2 text-2xl font-bold"></h1>
<p className="mb-6 text-[var(--muted-foreground)]">
¥0.80 21
</p>
<div className="mb-8 flex flex-col gap-3 sm:flex-row sm:gap-4">
<PayButton size="lg" channel="alipay"></PayButton>
<PayButton size="lg" channel="wxpay"></PayButton>
</div>
<p className="mb-4 text-xs text-[var(--muted-foreground)]">
<Link href="/pay?test=ok" className="text-[var(--accent)] underline"></Link>
</p>
<Link href="/" className="text-sm text-[var(--muted-foreground)] hover:text-[var(--foreground)]">
</Link>
</main>
</div>
);
}
export default function PayPage() {
return (
<Suspense fallback={
<div className="flex min-h-screen items-center justify-center bg-[var(--background)]">
<p className="text-[var(--muted-foreground)]">...</p>
</div>
}>
<PayContent />
</Suspense>
);
}