import Link from "next/link"; import { LoginForm } from "@/components/login-form"; import { getViewerSession } from "@/lib/popiart-api"; import { getLiveCopy } from "@/lib/live-copy"; import { type Locale } from "@/lib/site-content"; export default async function LoginPage({ params, }: { params: Promise<{ locale: string }>; }) { const { locale } = await params; const typedLocale = locale as Locale; const liveCopy = getLiveCopy(typedLocale); const session = await getViewerSession(); const isZh = typedLocale === "zh"; const title = isZh ? "使用 PopiNewAPI Key 登录" : "Sign in with your PopiNewAPI key"; const subtitle = isZh ? "页面登录后会换取产品层 session,控制台与 CLI 共用同一条认证链路。" : "The web app exchanges your key for a product-layer session shared by the console and CLI."; const cliTitle = isZh ? "CLI 登录指引" : "CLI sign-in guide"; const cliBody = isZh ? "如果你更习惯终端工作流,可以先安装 popiartcli,再用同一个 key 完成登录。" : "If you prefer terminal-first workflows, install popiartcli and sign in with the same key."; const installTitle = isZh ? "推荐命令" : "Recommended commands"; const continueCta = isZh ? "进入控制台" : "Open console"; const cliCommands = [ "brew tap wtgoku-create/popi", "brew install wtgoku-create/popi/popiart", "popiart auth login --key ", "popiart skills list", ].join("\n"); return (
{isZh ? "SIGN IN" : "SIGN IN"}

{title}

{subtitle}

{session ? (
{session.user.name || session.user.email || session.user.id} {liveCopy.login.alreadySignedIn}
{continueCta}
) : ( )}
{isZh ? "CLI" : "CLI"}

{cliTitle}

{cliBody}

{installTitle}

{liveCopy.login.helperBody}

{liveCopy.login.commandLabel}
              {cliCommands}
            
{isZh ? "查看文档" : "Read docs"}
); }