Primitive + Semantic 双层令牌架构,HEX->HSL,明暗双份,@theme inline 暴露为 Tailwind 类。 - 新建 src/app/styles/tokens/ 6 个令牌文件(primitive/semantic-light/semantic-dark/lesson-preparation/tailwind-theme/index) - globals.css 改为 @import 引入,477->258 行 - 清理 91 处 #hex 硬编码颜色 -> hsl(var(--*)) - 清理 10 处硬编码字体 -> var(--font-family-*) - 清理 100 文件 Tailwind 任意值(Tier 1 映射/Tier 3 注释豁免) - 清理 M3 Surface 死代码,升级 --lp-* 令牌(HEX->HSL + 暗色补全) - 新建 ESLint 自定义规则 no-hardcoded-design-tokens(单词边界正则) - eslint.config.mjs 新增 no-restricted-syntax 禁止 #hex + 自定义规则加载(pathToFileURL) - 项目规则新增设计令牌规范强制章节 - 架构图 004/005 同步设计令牌体系节点 - known-issues.md 追加设计令牌问题分类(7 个规则表) 验证: tsc --noEmit 0 errors, npm run lint 0 errors/12 warnings(均为既有问题)
70 lines
2.7 KiB
TypeScript
70 lines
2.7 KiB
TypeScript
import type { JSX } from "react"
|
|
import { Suspense } from "react"
|
|
import Link from "next/link"
|
|
import { Plus } from "lucide-react"
|
|
import { getTranslations } from "next-intl/server"
|
|
import { Button } from "@/shared/components/ui/button"
|
|
import { Skeleton } from "@/shared/components/ui/skeleton"
|
|
import { requirePermission } from "@/shared/lib/auth-guard"
|
|
import { Permissions } from "@/shared/types/permissions"
|
|
import { getLessonPlans } from "@/modules/lesson-preparation/data-access"
|
|
import { getSubjectOptions } from "@/modules/school/data-access"
|
|
import { LessonPlanList } from "@/modules/lesson-preparation/components/lesson-plan-list"
|
|
import { LessonPlanProviderSetup } from "@/modules/lesson-preparation/providers/lesson-plan-provider-setup"
|
|
|
|
export const dynamic = "force-dynamic"
|
|
|
|
export default async function LessonPlansPage(): Promise<JSX.Element> {
|
|
const t = await getTranslations("lessonPreparation")
|
|
// V4 P0-2 修复:页面层补齐 requirePermission 权限校验
|
|
const ctx = await requirePermission(Permissions.LESSON_PLAN_READ)
|
|
|
|
const [items, subjects] = await Promise.all([
|
|
getLessonPlans({}, ctx.dataScope, ctx.userId),
|
|
getSubjectOptions(),
|
|
])
|
|
|
|
return (
|
|
<div className="p-6 space-y-4">
|
|
<div className="flex justify-between items-center">
|
|
<div>
|
|
<h1 className="text-2xl font-bold tracking-tight">{t("title.list")}</h1>
|
|
<p className="text-muted-foreground">
|
|
{t("description.list")}
|
|
</p>
|
|
</div>
|
|
<Button asChild>
|
|
<Link href="/teacher/lesson-plans/new">
|
|
<Plus className="h-4 w-4 mr-2" aria-hidden="true" />
|
|
{t("action.new")}
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
<LessonPlanProviderSetup>
|
|
<Suspense
|
|
fallback={
|
|
<div className="space-y-4">
|
|
<div className="flex gap-2 flex-wrap items-center">
|
|
{/* arbitrary-value: skeleton placeholder fixed size */}
|
|
<Skeleton className="h-9 w-[240px]" />
|
|
{/* arbitrary-value: skeleton placeholder fixed size */}
|
|
<Skeleton className="h-9 w-[160px]" />
|
|
{/* arbitrary-value: skeleton placeholder fixed size */}
|
|
<Skeleton className="h-9 w-[160px]" />
|
|
</div>
|
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
|
{Array.from({ length: 6 }).map((_, i) => (
|
|
// arbitrary-value: skeleton placeholder fixed size
|
|
<Skeleton key={i} className="h-[180px] w-full" />
|
|
))}
|
|
</div>
|
|
</div>
|
|
}
|
|
>
|
|
<LessonPlanList initialItems={items} subjects={subjects} />
|
|
</Suspense>
|
|
</LessonPlanProviderSetup>
|
|
</div>
|
|
)
|
|
}
|