Files
novalon-website/src/app/global-error.tsx
T
zhangxiang dd8ee80b97 feat(theme): 中性色转暖落地(含 -rgb 孪生通道),挂上孪生一致性闸
P1:globals.css 68 处中性色转暖,深通道按「保 L、色相→33°、S≤0.14」算;P4 弱文字分三档
(装饰线 #C3BDB1/非文本信息 #8A8377/正文级 #6E675D);P3 三个深底红收敛为 #E9455F(对暖墨
#141210 实测 4.88:1)。14 处彩性蓝按裁决故意不动。P2:public/fonts/ 放思源宋体可变子集 388.1KB
(cmap 回读 0 缺字)+两份 OFL 1.1 正文,--font-serif 队首插入 Novalon Serif SC,系统兜底全保留。

落库时查出并修一条真缺陷:43 条 -rgb 三元组有 22 条从未迁移(:root 11+深色块 11,色相仍 H210-217),
而 Tailwind 有 29 个颜色键经 rgb(var(--X-rgb)) 消费 ⇒ 渲染主通道还是冷的;当时 check:contrast 44/44
全绿(读 hex)、视觉套件 0 张重写 ⇒ 两道闸一起假绿。按「孪生等于同块 hex」对齐 22 条并新增常驻闸
npm run check:token-twins(0 条判红/不等判红/孤儿判红),复测 43/43 一致。
2026-10-16 19:23:25 +08:00

77 lines
2.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.
'use client';
// 根布局抛错时 Next.js 用内置文档顶替 root layout,而内置文档的 <html> 没有 lang、
// 也不读本站的 html[data-theme] 令牌,深色下会落到浏览器默认画布(实测 #141210 令牌失效、
// bgMatchesToken=false,axe 报 html-has-lang)。全站 axe 扫描扩到预渲染产物后暴露此缺口。
// 因此这里自带文档壳 + 与 globals.css 同值的 OS 主题样式,不依赖 root layout。
export default function GlobalError({
error,
retry,
}: {
error: Error & { digest?: string };
retry: () => void;
}) {
return (
<html lang="zh-CN">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>页面无法显示 | 四川睿新致远科技有限公司</title>
<style>{`
:root { color-scheme: light; }
body { margin: 0; background: #FFFFFF; color: #141210;
font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
@media (prefers-color-scheme: dark) {
:root { color-scheme: dark; }
body { background: #141210; color: #FBF9F5; }
}
`}</style>
</head>
<body>
<main style={{ maxWidth: 640, margin: '0 auto', padding: '96px 24px', textAlign: 'center' }}>
<h1 style={{ fontSize: 28, fontWeight: 700, margin: '0 0 16px' }}>应用暂时无法显示此页面</h1>
<p style={{ fontSize: 16, lineHeight: 1.7, margin: '0 0 8px' }}>
渲染过程中出现错误,我们已记录该问题。请重试,或返回首页继续浏览。
</p>
{error.digest ? (
<p style={{ fontSize: 13, margin: '0 0 24px' }}>错误编号:{error.digest}</p>
) : (
<p style={{ fontSize: 13, margin: '0 0 24px' }}>请稍后重试</p>
)}
<div style={{ display: 'flex', gap: 12, justifyContent: 'center' }}>
<button
type="button"
onClick={() => retry()}
style={{
fontSize: 15,
fontWeight: 600,
padding: '10px 20px',
border: '1px solid currentColor',
background: 'transparent',
color: 'inherit',
cursor: 'pointer',
}}
>
重试
</button>
<a
href="/"
style={{
fontSize: 15,
fontWeight: 600,
padding: '10px 20px',
border: '1px solid currentColor',
background: 'transparent',
color: 'inherit',
textDecoration: 'none',
}}
>
返回首页
</a>
</div>
</main>
</body>
</html>
);
}