28 lines
793 B
TypeScript
28 lines
793 B
TypeScript
// /components/account/LinkStatus.tsx
|
||
"use client";
|
||
|
||
import { useSearchParams } from "next/navigation";
|
||
|
||
export default function LinkStatus() {
|
||
const sp = useSearchParams();
|
||
const linked = sp.get("linked");
|
||
if (linked !== "kofi") return null;
|
||
|
||
const isOk = sp.get("ok") === "1";
|
||
const isErr = sp.get("error") === "1";
|
||
|
||
if (!isOk && !isErr) return null;
|
||
|
||
return (
|
||
<div
|
||
className={[
|
||
"mb-3 rounded-md border p-3 text-sm",
|
||
isOk
|
||
? "border-emerald-300/50 bg-emerald-50 text-emerald-900"
|
||
: "border-red-300/50 bg-red-50 text-red-900",
|
||
].join(" ")}
|
||
>
|
||
{isOk ? "Ko-fi successfully linked to your account." : "Couldn’t verify that Ko-fi link. Please try again."}
|
||
</div>
|
||
);
|
||
}
|