// CoursePlanDetail:课程计划详情(基本信息 + 章节列表) // 依据:02-architecture-design.md §15 组件设计 // 章节:标题/描述/排序/课时数/预计学时 "use client"; import type { CoursePlanDetail } from "@/types"; import { cn, formatDate } from "@/lib/utils"; interface CoursePlanDetailProps { coursePlan: CoursePlanDetail; } type CoursePlanStatus = CoursePlanDetail["status"]; const STATUS_LABELS: Record = { active: "进行中", completed: "已完成", archived: "已归档", }; const STATUS_STYLES: Record = { active: "text-success", completed: "text-ink-muted", archived: "text-ink-muted", }; export function CoursePlanDetail({ coursePlan, }: CoursePlanDetailProps): JSX.Element { const chapters = [...coursePlan.chapters].sort( (a, b) => a.sortOrder - b.sortOrder, ); return (
{/* 基本信息 */}
{coursePlan.subject}

{coursePlan.title}

{coursePlan.description}

{STATUS_LABELS[coursePlan.status]}
班级
{coursePlan.className}
教师
{coursePlan.teacherName}
起止日期
{formatDate(coursePlan.startDate)} ~{" "} {formatDate(coursePlan.endDate)}
章节数
{coursePlan.chapterCount}
{/* 章节列表 */}

章节安排

    {chapters.map((chapter) => (
  1. 第 {chapter.sortOrder} 章

    {chapter.title}

    {chapter.description}

    {chapter.lessonCount} 课时
    预计 {chapter.estimatedHours} 学时
  2. ))}
); } export default CoursePlanDetail;