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 { AgeCard } from "./age-card"; 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; age?: string }> }) { const me = await getMe(); if (!me) redirect("/signin?next=/account"); const [account, age] = await Promise.all([api.account.get().then(unwrap), api.age.get().then(unwrap)]); const { person, links, challenges, computers } = account; const params = await searchParams; const welcome = params.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. Adult IMVU accounts can see adult community products: those IMVU has age verified (or with Access Pass), or all of them once you verify your age below.

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 )}
); }