// 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 (
{/* 指标网格 */}
{/* 成绩趋势 */}

成绩趋势

{trend.text}
{/* 即将到来事件 */} {summary.upcomingEvents && summary.upcomingEvents.length > 0 && (

即将到来

)}
); } function Metric({ label, value, highlight, badge, }: { label: string; value: string; highlight?: boolean; badge?: string; }) { return (

{label}

{value}

{badge && ( {badge} )}
); } export default ChildSummaryCard;