Files
NextEdu/src/app/layout.tsx
SpecialX 214ebec976 refactor(design-tokens): 全量体系化重建设计令牌
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(均为既有问题)
2026-07-05 01:03:19 +08:00

65 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Metadata, Viewport } from "next";
import { Inter } from "next/font/google";
import { getLocale, getMessages } from "next-intl/server";
import { Providers } from "./providers";
import { auth } from "@/auth";
import "./globals.css";
const inter = Inter({
subsets: ["latin"],
display: "swap",
variable: "--font-inter",
});
export const metadata: Metadata = {
title: "Next_Edu - K12 智慧教务系统",
description: "Enterprise Grade K12 Education Management System",
manifest: "/manifest.webmanifest",
appleWebApp: {
capable: true,
statusBarStyle: "default",
title: "Next_Edu",
},
};
export const viewport: Viewport = {
width: "device-width",
initialScale: 1,
maximumScale: 5,
userScalable: true,
themeColor: [
// eslint-disable-next-line no-restricted-syntax -- Next.js metadata requires literal hex
{ media: "(prefers-color-scheme: light)", color: "#ffffff" },
// eslint-disable-next-line no-restricted-syntax -- Next.js metadata requires literal hex
{ media: "(prefers-color-scheme: dark)", color: "#0a0a0a" },
],
};
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
// v3 i18n从 cookie 读取 localegetRequestConfig 已配置SSR 注入字典
const locale = await getLocale();
const messages = await getMessages();
// v3: SSR 期间获取 session传给 AuthSessionProvider
// 避免 next-auth useSession 在 SSR/CSR 之间返回不同 status 导致 hydration mismatch。
const session = await auth();
return (
<html lang={locale} suppressHydrationWarning>
<body
className={`${inter.variable} antialiased font-sans`}
suppressHydrationWarning
>
<Providers locale={locale} messages={messages} session={session}>
{children}
</Providers>
</body>
</html>
);
}