import type { FormEvent, ReactNode } from 'react'; import { CreditCard, KeyRound, ListChecks, UserRound } from 'lucide-react'; import type { ConsoleData } from '../app-state'; import { EntityTable } from '../components/EntityTable'; import { PageHeader } from '../components/PageHeader'; import { Badge, Button, Card, CardContent, CardHeader, CardTitle, Input, Label, Tabs } from '../components/ui'; import type { ApiKeyForm, LoadState, WorkspaceSection } from '../types'; const tabs = [ { value: 'overview', label: '个人总览', icon: }, { value: 'billing', label: '余额充值', icon: }, { value: 'apiKeys', label: 'API Key', icon: }, { value: 'tasks', label: '任务记录', icon: }, ] satisfies Array<{ value: WorkspaceSection; label: string; icon: ReactNode }>; export function WorkspacePage(props: { apiKeyForm: ApiKeyForm; apiKeySecret: string; data: ConsoleData; section: WorkspaceSection; state: LoadState; onApiKeyFormChange: (value: ApiKeyForm) => void; onSectionChange: (value: WorkspaceSection) => void; onSubmitApiKey: (event: FormEvent) => void; }) { return ( {props.section === 'overview' && } {props.section === 'billing' && } {props.section === 'apiKeys' && } {props.section === 'tasks' && } ); } function WorkspaceOverview(props: { data: ConsoleData }) { const owner = props.data.users[0]; return ( 个人中心总览 用户组策略 [item.groupKey, item.priority, item.status, item.source])} /> ); } function BillingPanel() { return ( 余额 resource 0.00 local 充值 金额 创建充值订单 ); } function ApiKeyPanel(props: { apiKeyForm: ApiKeyForm; apiKeySecret: string; data: ConsoleData; state: LoadState; onApiKeyFormChange: (value: ApiKeyForm) => void; onSubmitApiKey: (event: FormEvent) => void; }) { return ( 创建 API Key 名称 props.onApiKeyFormChange({ name: event.target.value })} /> 创建 {props.apiKeySecret && {props.apiKeySecret}} API Key 列表 [item.name, item.keyPrefix, item.status, new Date(item.createdAt).toLocaleString()])} /> ); } function TaskPanel(props: { data: ConsoleData }) { const task = props.data.taskResult; return ( 任务记录 {task ? ( {task.status} {task.kind} {task.model} {JSON.stringify(task.result ?? {}, null, 2)} ) : ( 暂无任务 )} ); } function InfoItem(props: { label: string; value: string }) { return ( {props.label} {props.value} ); }
{props.apiKeySecret}
{JSON.stringify(task.result ?? {}, null, 2)}