"use client"; import Link from "next/link"; import { logout } from "@/app/login/actions"; import { BackgroundBlobs } from "@/components/background-blobs"; import { Button } from "@/components/ui/button"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { ChildManage } from "./child-manage"; import { DevicesTab } from "./devices-tab"; import { OverviewTab } from "./overview-tab"; import { TemplatesTab } from "./templates-tab"; export type DayCell = { done: number; total: number; grammar: number; weekly: number | null; tasks: { title: string; status: "pending" | "done"; subject: string }[]; }; export type OverviewData = { kids: { id: number; name: string; grammar: { done: number; total: number }; wrongOpen: number; weeklyLatest: { weekKey: string; score: number; passed: boolean } | null; days: Record; }[]; }; export type TemplatesData = { kids: { id: number; name: string; items: { id: number; dow: number; title: string; subject: string; requiresPhoto: boolean; mode: string; dateStart: string | null; dateEnd: string | null; }[]; }[]; }; export type DevicesData = { rows: { id: number; owner: string; deviceLabel: string | null; createdAt: string; expiresAt: string; isCurrent: boolean; }[]; }; export type WeeklyRow = { childName: string; weekKey: string; score: number; passed: boolean }; export type RecordingRow = { childName: string; word: string; url: string; at: string }; export type GrammarTestRow = { childName: string; title: string; score: number; passed: boolean; at: string }; export type WrongItemRow = { childName: string; stem: string; userAnswer: string; correctAnswer: string; sourceTitle: string; mastered: boolean; }; const tabCls = "data-[state=active]:bg-white data-[state=active]:text-indigo-600 data-[state=active]:shadow-soft"; function Section({ title, desc, children }: { title: string; desc?: string; children: React.ReactNode }) { return (

{title}

{desc &&

{desc}

}
{children}
); } export function ParentDashboard({ overview, templates, devices, weekly, recordings, grammarTests, wrongItems, }: { overview: OverviewData; templates: TemplatesData; devices: DevicesData; weekly: WeeklyRow[]; recordings: RecordingRow[]; grammarTests: GrammarTestRow[]; wrongItems: WrongItemRow[]; }) { return (

家长中心

学习概览 功能管理

✏️ 编辑英语语法课程

改标题/目标/课文,保存即生效

📝 每周检测成绩

{weekly.length === 0 &&

暂无检测记录

} {weekly.map((w, i) => (

{w.childName} · {w.weekKey} · {w.score} 分 {w.passed ? "✅" : "❌"}

))}

🎙️ 单词跟读录音

{recordings.length === 0 &&

暂无跟读录音

} {recordings.map((r, i) => (
{r.childName} {r.word}
))}

📘 英语语法检测

{grammarTests.length === 0 &&

暂无检测记录

} {grammarTests.map((g, i) => (

{g.childName} · {g.title} · {g.score} 分 {g.passed ? "✅" : "❌"}

))}

📒 孩子错题本

{wrongItems.length === 0 &&

暂无错题

} {wrongItems.map((w, i) => (

{w.childName} · {w.stem}

答:{w.userAnswer || "未作答"}

正:{w.correctAnswer}

))}
({ id: k.id, name: k.name }))} />
({ id: k.id, name: k.name }))} />
); }