From 6aecddc6c00d00a5137c71bcd5d5465178d5cc3a Mon Sep 17 00:00:00 2001 From: mapxn <16299874+mapxn@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:43:42 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat(web):=20ONE-67=20=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=BA=A7=E8=A7=86=E8=A7=89=E9=87=8D=E6=9E=84=20=E2=80=94=2019?= =?UTF-8?q?=20=E4=B8=AA=E9=A1=B5=E9=9D=A2=E8=90=BD=E5=9C=B0=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E8=B4=A6=E6=9C=AC=E8=AE=BE=E8=AE=A1=E5=A5=91=E7=BA=A6?= =?UTF-8?q?=20(ONE-70)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 起手契约修订(Mike 授权):亮色 n-500 4.39:1 → 5.17:1 达标 AA, 同步 muted-foreground / due-far,design-system.md 附录 A 记录 - 新增共享件:DueRing/DueCount(倒计时环形进度 + display 级 tabular 数字,due-* 紧迫梯度)、Skeleton/EmptyState/ErrorState(三态)、 AuthShell/FormError(auth 居中卡 + 错误 200ms 滑入) - dashboard:最近到期主视觉(环形 + display-lg 倒计时)、统计卡 数字 display 化、账本式分录行、同形态骨架、空态/错误态 - items 列表:状态徽章与倒计时全部接 due-*/success/warning 语义 token,桌面行倒计时环形 + tabular 日期,移动卡主行大数字 + 操作收进溢出菜单(可见 ≤2),空态排版化 - items new/detail:表单分区(基本/周期到期/提醒渠道),详情页 头部实时到期预览环 + display 倒计时,支付/续期表 tabular - channels:渠道卡标题 text-title + 启用状态语义徽章 - history:成功/失败徽章语义化、骨架同形态、排版空态、详情弹层 shadow-4 - me:账本头(头像 + 邮箱 + 本月到期 display 数字) - settings/admin×5:骨架全部改同形态,success/warning/destructive token 替换硬编码绿黄红,表格表头 caption 化 - about:分录式定义列表;setup/auth×5:AuthShell 400px 卡 + shadow-2 + display logo 区 + 错误滑入 - i18n:新增 common.retry/more、dashboard/items/history/me/detail 等键(中英同步) --- docs/design-system.md | 16 +- web/src/components/AuthShell.tsx | 48 ++ web/src/components/DueRing.tsx | 123 ++++ web/src/components/layout/AppLayout.tsx | 10 +- web/src/components/states.tsx | 87 +++ web/src/components/ui/button.tsx | 3 +- web/src/components/ui/card.tsx | 11 +- web/src/index.css | 23 +- web/src/locales/en.json | 41 +- web/src/locales/zh.json | 41 +- web/src/pages/about/AboutPage.tsx | 64 +- web/src/pages/admin/AdminAppPage.tsx | 17 +- web/src/pages/admin/AdminEmailPage.tsx | 16 +- web/src/pages/admin/AdminPage.tsx | 12 +- web/src/pages/admin/AdminSecurityPage.tsx | 18 +- web/src/pages/admin/AdminUsersPage.tsx | 54 +- web/src/pages/auth/ForgotPasswordPage.tsx | 38 +- web/src/pages/auth/LoginPage.tsx | 40 +- web/src/pages/auth/RegisterPage.tsx | 48 +- web/src/pages/auth/TwoFactorPage.tsx | 32 +- web/src/pages/auth/VerifyEmailPage.tsx | 25 +- web/src/pages/channels/ChannelPage.tsx | 30 +- web/src/pages/dashboard/DashboardPage.tsx | 616 ++++++++++++-------- web/src/pages/history/HistoryPage.tsx | 52 +- web/src/pages/items/ItemDetailPage.tsx | 156 +++-- web/src/pages/items/ItemListPage.tsx | 277 +++++---- web/src/pages/items/ItemNewPage.tsx | 679 +++++++++++----------- web/src/pages/me/MePage.tsx | 40 +- web/src/pages/settings/SettingsPage.tsx | 58 +- web/src/pages/setup/SetupPage.tsx | 73 +-- 30 files changed, 1712 insertions(+), 1036 deletions(-) create mode 100644 web/src/components/AuthShell.tsx create mode 100644 web/src/components/DueRing.tsx create mode 100644 web/src/components/states.tsx diff --git a/docs/design-system.md b/docs/design-system.md index 2ce1eb3..d12d1b9 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -218,7 +218,7 @@ eNotify 的视觉语言从它的核心语义直接长出来:**每一笔周期 **中性色阶(8 级,亮色 zinc 系微调,暗色独立调色非反色):** -亮色:`--n-0:#ffffff(bg)` `--n-50:#fafafa` `--n-100:#f4f4f5(muted bg)` `--n-200:#e4e4e7(border)` `--n-300:#d4d4d8(input border)` `--n-500:#71717a(muted fg,on 白 4.83:1 ✅)` `--n-700:#3f3f46(次级 fg)` `--n-900:#18181b(主 fg,on 白 17.72:1 ✅)` +亮色:`--n-0:#ffffff(bg)` `--n-50:#fafafa` `--n-100:#f4f4f5(muted bg)` `--n-200:#e4e4e7(border)` `--n-300:#d4d4d8(input border)` `--n-500:#60606b(muted fg,on 白 5.69:1 ✅、on muted 5.17:1 ✅)` `--n-700:#3f3f46(次级 fg)` `--n-900:#18181b(主 fg,on 白 17.72:1 ✅)` 暗色:`--n-900:#0a0a0c(bg)` `--n-850:#111114(card bg)` `--n-800:#1a1a1f(muted bg)` `--n-700:#26262c(border)` `--n-600:#34343c(input border)` `--n-400:#a1a1aa(muted fg,on bg 7.76:1 ✅)` `--n-200:#d4d4d8(次级 fg)` `--n-50:#fafafa(主 fg,on bg 19.06:1 ✅)` @@ -231,7 +231,7 @@ eNotify 的视觉语言从它的核心语义直接长出来:**每一笔周期 | `--card` / `--popover` | `n-0 #ffffff` | `n-850 #111114` | | `--card-foreground` / `--popover-foreground` | `n-900 #18181b` | `n-50 #fafafa` | | `--muted` / `--accent` | `n-100 #f4f4f5` | `n-800 #1a1a1f` | -| `--muted-foreground` / `--accent-foreground` | `n-500 #71717a` / `n-900` | `n-400 #a1a1aa` / `n-50` | +| `--muted-foreground` / `--accent-foreground` | `n-500 #60606b` / `n-900` | `n-400 #a1a1aa` / `n-50` | | `--secondary` | `n-100 #f4f4f5` | `n-800 #1a1a1f` | | `--secondary-foreground` | `n-900 #18181b` | `n-50 #fafafa` | | `--border` | `n-200 #e4e4e7` | `n-700 #26262c` | @@ -255,7 +255,7 @@ eNotify 的视觉语言从它的核心语义直接长出来:**每一笔周期 | token | 阈值 | 亮色 | 暗色 | |---|---|---|---| -| `--color-due-far` | >30 天 | neutral `#71717a` / `#a1a1aa` | `#a1a1aa` | +| `--color-due-far` | >30 天 | neutral `#60606b` | `#a1a1aa` | | `--color-due-soon` | ≤30 天 | `#4f46e5` | `#818cf8` | | `--color-due-close` | ≤7 天 | `#b45309` | `#fbbf24` | | `--color-due-over` | 逾期 | `#b91c1c` | `#f87171` | @@ -297,6 +297,16 @@ eNotify 的视觉语言从它的核心语义直接长出来:**每一笔周期 --- +## 附录 A:契约修订记录 + +### A-1(ONE-70,2026-10-23,Mike 授权修订) + +- **问题**:冻结值 `muted-foreground on muted`(`n-500 #71717a` on `n-100 #f4f4f5`)实测对比度 4.39:1,低于父单 color 维度的 AA 正文指标(≥4.5:1),差 0.11。 +- **修订**:亮色 `n-500` 由 `240 3.8% 46.1%`(`#71717a`)调整为 `240 4.9% 42%`(`#60606b`)。同步引用该值的 token:`--muted-foreground`(亮色)与 `--due-far`(亮色)。 +- **达标后对比度**:`n-500 on n-100` = **5.17:1** ✅;`n-500 on n-0`(白底)= **5.69:1** ✅。暗色组合(`n-400 on n-800` = 6.76:1)原本达标,未动。 + +--- + ## 6. 契约边界(与冻结条款对齐) - **唯一契约**:本文件是唯一冻结契约。历史文档 `web/docs/design-contract.md`(存在于旧分支 `agent/mary/a19f619bb981` / `ed2f1ad360d5`,未进 main)**已退役**,不再作为任何实现依据;若其所在分支后续合并,必须删除该文件或以醒目批注指向本文档。 diff --git a/web/src/components/AuthShell.tsx b/web/src/components/AuthShell.tsx new file mode 100644 index 0000000..50568cb --- /dev/null +++ b/web/src/components/AuthShell.tsx @@ -0,0 +1,48 @@ +import type { ReactNode } from "react"; +import { cn } from "@/lib/utils"; + +/** + * Centered auth card — shared by login/register/forgot/2fa/verify-email/setup + * (design contract §5: 400px width, shadow-2, display-level logo area). + */ +export function AuthShell({ + title, + subtitle, + children, + className, +}: { + title: ReactNode; + subtitle?: ReactNode; + children: ReactNode; + className?: string; +}) { + return ( +
+
+
+
+

{title}

+ {subtitle && ( +

+ {subtitle} +

+ )} +
+ {children} +
+
+
+ ); +} + +/** Inline form error that slides in (200ms, contract §5 auth). */ +export function FormError({ children }: { children: ReactNode }) { + return ( +

+ {children} +

+ ); +} diff --git a/web/src/components/DueRing.tsx b/web/src/components/DueRing.tsx new file mode 100644 index 0000000..e4cabd5 --- /dev/null +++ b/web/src/components/DueRing.tsx @@ -0,0 +1,123 @@ +import { cn } from "@/lib/utils"; + +/** + * Countdown urgency tiers — the single semantic color gradient of the + * design system (design contract §3.1 / §4.6). + */ +export type DueTier = "far" | "soon" | "close" | "over"; + +export function getDueTier(days: number): DueTier { + if (days < 0) return "over"; + if (days <= 7) return "close"; + if (days <= 30) return "soon"; + return "far"; +} + +const TIER_TEXT: Record = { + far: "text-due-far", + soon: "text-due-soon", + close: "text-due-close", + over: "text-due-over", +}; + +const TIER_BADGE: Record = { + far: "bg-due-far/10 text-due-far", + soon: "bg-due-soon/10 text-due-soon", + close: "bg-due-close/10 text-due-close", + over: "bg-due-over/10 text-due-over", +}; + +export function dueTierTextClass(days: number): string { + return TIER_TEXT[getDueTier(days)]; +} + +export function dueTierBadgeClass(days: number): string { + return TIER_BADGE[getDueTier(days)]; +} + +/** Circular remaining-progress ring (design contract §3.1 — countdown is first-class). */ +export function DueRing({ + days, + progress, + size = 28, + strokeWidth = 3, + className, +}: { + days: number; + /** 0..1 — fraction of the period still remaining */ + progress: number; + size?: number; + strokeWidth?: number; + className?: string; +}) { + const tier = getDueTier(days); + const r = (size - strokeWidth) / 2; + const c = 2 * Math.PI * r; + const clamped = Math.max(0, Math.min(1, progress)); + return ( + + + + + ); +} + +/** Ledger-style countdown: large tabular numeral + small unit (§3.1, Cron-style asymmetric type). */ +export function DueCount({ + days, + unit, + size = "md", + className, +}: { + days: number; + unit: string; + size?: "sm" | "md" | "lg"; + className?: string; +}) { + const tier = getDueTier(days); + const numCls = + size === "lg" + ? "text-display-lg" + : size === "md" + ? "text-display" + : "text-title"; + return ( + + + {days < 0 ? `-${Math.abs(days)}` : days} + + {unit} + + ); +} diff --git a/web/src/components/layout/AppLayout.tsx b/web/src/components/layout/AppLayout.tsx index cd0f77f..7bec73a 100644 --- a/web/src/components/layout/AppLayout.tsx +++ b/web/src/components/layout/AppLayout.tsx @@ -203,7 +203,10 @@ export function AppLayout() {

{appName} -