Files
MineGeo/app/pair/page.tsx

41 lines
1.1 KiB
TypeScript

import { getI18n } from "@/lib/i18n";
import { Header, Footer } from "@/components/Shell";
import { Pairing } from "@/components/Pairing";
import { SignIn } from "@/components/SignIn";
import { user } from "@/lib/supabase";
export default async function Pair({
searchParams,
}: {
searchParams: Promise<{ code?: string }>;
}) {
const { t } = await getI18n();
const { code } = await searchParams;
const account = await user();
return (
<>
<Header />
<main className="section page-content">
{!account ? (
<>
<p className="muted">
{t("Sign in first, then reopen the pairing link from Minecraft.")}
</p>
<SignIn
next={
code && /^[A-F0-9]{8}$/.test(code)
? `/pair?code=${code}`
: "/dashboard"
}
/>
</>
) : code && /^[A-F0-9]{8}$/.test(code) ? (
<Pairing code={code} />
) : (
<p>{t("Open the pairing link shown by your Fabric mod.")}</p>
)}
</main>
<Footer />
</>
);
}