全站UI重构 - #11
Merged
Merged
Conversation
Updated the color scheme of some pages, migrating from gray/indigo to zinc/violet (not fully complete) feat: Added a script to maintain login state in the development environment
# Conflicts: # components/Header.js
* Full support for both light and dark color schemes, with the primary color switched from indigo to violet. Background and font colors have all been switched from gray to zinc. Custom design tokens in Tailwind are used, with CSS semantics replacing hardcoded values. Border radii are reduced and margins are tightened for a cleaner visual style. * UI/UX refactor for /page, /pages, /authors, and /tools * Added page structure skeletons during loading * fix: Fixed a bug on the /authors page where avatars failed to load
removed the padding-top from Layout, and adjusted the Header layout
Completely rebuilt index.js and added new font dependencies
- 残留 gray-* 全量迁移到语义 token / zinc:11 个文件 84 处替换, pages/ components/ utils/ styles/ 下 gray / indigo 计数归零 (成对 dark: 变体折叠为 token;带 alpha 的改用内置 zinc, 因 Tailwind v3 无法对 hex CSS 变量应用 /alpha) - showcase 图转 WebP(1600px / q80):1.99 MB -> 293 KB(-85.6%), pages/index.js 引用同步,原 PNG 删除 - scripts/dev-seed.js:NODE_ENV=production 拒绝执行; DATABASE_URL 非本地库拒绝(DEV_SEED_ALLOW_REMOTE=1 可放行); 口令改读 DEV_SEED_PASSWORD - pages/api/dev/login.js:改为 NODE_ENV 非生产 && ENABLE_DEV_LOGIN=1 双闸,任一不满足即 404,避免自托管 / preview 环境漏设 NODE_ENV 时 暴露可签发任意角色 JWT 的接口 - .env.example 补充 ENABLE_DEV_LOGIN / DEV_SEED_PASSWORD 说明 验证:next lint 0 warning、tsc --noEmit 0 error、27/27 单测、 test:ftml OK、next build 通过(静态页 30/30)
kakushi-w
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
全面重构UI,配色方案从gray/indigo迁移至zinc/violet,并定义Design Token方便复用。缩窄边距、缩小圆角、减少div嵌套等AI Slop特征。重构了一些关键页面的交互,以及完全重写了首页。
主要改动
1. Design Token 体系(核心)
styles/globals.css引入两层 token:--w-primary-*violet 色阶(oklch),组件不直接使用。canvas / panel / raised / sunken(表面层级)、line / line-strong(描边)、fg / fg-2 / fg-3(文字三级)、accent-*(品牌色),随html.dark自动翻转。tailwind.config.js把这些 token 映射为bg-panel、text-fg、border-line、text-accent等语义 class,组件里不再需要写dark:变体。同时把 Tailwind 的圆角刻度整体收紧为 2 / 4 / 6 三档。2. 明暗双主题
_document.js注入内联脚本,在首屏绘制前根据localStorage.theme→prefers-color-scheme→ 默认暗色 的顺序决定html.dark,消除 FOUC。明暗主题选择储存在localStorage中。Header.js新增主题切换按钮(桌面 / 移动端各一处,带aria-label)。wikit-logo-black.svg/wikit-logo-white.svg),靠dark:变体切换。3. 顶栏重写
NAV_ITEMS数组统一渲染,支持子路由高亮(/tools/gacha也会点亮/tools)并输出aria-current="page"。4. 首页重构
components/HeroAsciiCanvas.js:粒子 → 低分辨率离屏画布 → ASCII 字符密度映射的双层渲染管线。已做 DPR 上限 1.5、~32fps 节流、预渲染字符图集、固定粒子池、IntersectionObserver 与visibilitychange停帧、prefers-reduced-motion尊重。Home.fullWidth = true,Layout新增fullWidth开关)。@fontsource自托管。5. 页面重构与 Bug 修复
/page、/pages、/authors、/tools/*、/admin、/staff-panel、/contest、/dashboard、/forums等统一换用语义 token,新增加载骨架屏。/pages的搜索栏吸附在顶部,并顺带显示网站详细信息。/authors也有一个吸附栏。作者信息页面的布局现在更简约。/tools将工具分为实用性和趣味性两类。pages/api/authors.js):avatar.php?account=已失效一律 404,改为从user:info/<name>抓真实userid;同时把http://改回https://(http 会 302 到 CloudFront 的 http 地址,被混合内容策略拦截)。utils/markdownLite.js:渲染产物里的硬编码颜色全部换成语义 token。next.config.js:CSP 在开发环境放行'unsafe-eval'(NODE_ENV !== 'production'判断),否则 dev 模式 HMR runtime 因 CSP 崩溃白屏;生产构建保持严格 CSP。6. 开发环境配套
pages/api/dev/login.js:?as=user|staff|admin|logout一键切换身份。返回一个落地页而非 302,顺带把 username 写进 localStorage,避免「cookie 已登录但顶栏还显示未登录」的割裂状态。两道独立闸门,任一不满足即 404:
NODE_ENV !== 'production',且显式设置ENABLE_DEV_LOGIN=1。单靠 NODE_ENV 一道闸不够——自托管 docker、preview 环境经常漏设 NODE_ENV,那等于把能签发任意角色 JWT 的接口暴露出去。scripts/dev-seed.js:造dev_user/dev_staff/dev_admin三个账号 + 覆盖全部状态的示例代发单,供职员面板 UI 调试,幂等。两道闸:NODE_ENV=production直接拒绝执行;DATABASE_URL非本地库时拒绝(可用DEV_SEED_ALLOW_REMOTE=1显式放行)。口令优先取DEV_SEED_PASSWORD。两个开关都已写进.env.example。除去为了预览效果引入的第6项修改外,ui-redesign分支均为纯前端修改,已通过检查:
npx next lint --quietnpx tsc --noEmitnode --test tests/*.test.jsnpm run test:ftmlnpm run buildCompiled successfully in 15.0s,静态页 30/30