// ChildSummaryCard:子女概览卡片 // 依据:02-architecture-design.md §15.4 ChildSummaryCard 设计 // - 平均分 / 班级排名 / 出勤率 / 待完成作业 // - 成绩趋势指示(图标 + 文案) // - 逾期作业高亮徽标 // - 即将到来的事件 // - 点击跳转子女详情 "use client"; import Link from "next/link"; import type { ChildSummary } from "@/types"; import { formatPercent, formatNumber, formatDate } from "@/lib/utils"; import { cn } from "@/lib/utils"; interface ChildSummaryCardProps { summary: ChildSummary; } const TREND_LABELS = { up: { text: "上升", color: "text-success", icon: "↑" }, down: { text: "下降", color: "text-danger", icon: "↓" }, stable: { text: "稳定", color: "text-ink-muted", icon: "→" }, } as const; const DEFAULT_TREND = { text: "稳定", color: "text-ink-muted", icon: "→" }; export function ChildSummaryCard({ summary }: ChildSummaryCardProps) { const trend = TREND_LABELS[summary.recentGradeTrend] ?? DEFAULT_TREND; const hasPending = summary.pendingHomeworkCount > 0; return (
{label}
{value}
{badge && ( {badge} )}