import type { Metadata } from "next"; import Link from "next/link"; import { redirect } from "next/navigation"; import { ActionForm, SubmitButton } from "@/components/forms"; import { PageHeader, Tag } from "@/components/status"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { api, getMe, isModerator, unwrap } from "@/lib/api"; import { linkAccount, signOutComputers } from "./actions"; import { ChallengeCard } from "./challenge-card"; import { LinkCard } from "./link-card"; export const metadata: Metadata = { title: "Account" }; export default async function Account({ searchParams }: { searchParams: Promise<{ welcome?: string }> }) { const me = await getMe(); if (!me) redirect("/signin?next=/account"); const account = unwrap(await api.account.get()); const { person, links, challenges, computers } = account; const welcome = (await searchParams).welcome !== undefined; return (
Signed in as {person.username} {isModerator(person) && {person.role}} {welcome && ( Welcome to T5DE, {person.username}. Link an IMVU account below to get started. )} IMVU accounts {links.length} of {person.linkCap} {links.length > 0 ? (
    {links.map((link) => ( ))}
) : (

No IMVU accounts linked yet.

)}
{challenges.map((c) => ( ))} Link an IMVU account {account.canLink ? (
Next
) : (

You've linked as many IMVU accounts as you can ({person.linkCap}). Ask a moderator if you need more.

)}

Other people can't see which IMVU accounts are yours. Age-verified IMVU accounts (or with Access Pass) can see adult community products; each account is checked on its own.

T5DE on your computers

{computers > 0 ? `Signed in on ${computers} computer${computers === 1 ? "" : "s"}.` : "Not signed in on any computer yet."}{" "} To sign T5DE in, it shows a code to enter at{" "} /device .

{computers > 0 && ( Sign out everywhere )}
); }