From f4bea7f26d6930c395df3b953a562bf9db679d4d Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Sat, 11 Jul 2026 14:04:14 +0200 Subject: [PATCH] =?UTF-8?q?feat(ui):=20=E5=BC=B9=E5=B1=82=E8=BF=9B?= =?UTF-8?q?=E5=87=BA=E5=9C=BA=E8=BF=87=E6=B8=A1=20+=20=E9=A6=96=E5=B1=8F?= =?UTF-8?q?=E6=9A=96=E6=B7=B1=E8=89=B2=E8=8B=B1=E9=9B=84=EF=BC=88P2-6/P4-6?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - useMountTransition hook(延迟卸载播放退场,尊重 reduced-motion)+ vitest - Drawer 淡入+滑入进出场;focus/scroll-lock 仍由 open 驱动、focus 键 shouldRender 防丢首焦 - Toast 入场 toast-in 动画(motion-safe) - P4-6 首屏零作品用 callout 暖深色编辑部英雄(对标 cta-band-dark,不干扰工作库) 新增 callout/on-callout/on-callout-soft 双主题成对 token --- apps/web/app/globals.css | 26 +++++++++++ apps/web/app/page.tsx | 50 ++++++++++---------- apps/web/components/Drawer.tsx | 29 ++++++++++-- apps/web/components/Toast.tsx | 2 +- apps/web/lib/ui/useMountTransition.test.ts | 53 ++++++++++++++++++++++ apps/web/lib/ui/useMountTransition.ts | 29 ++++++++++++ apps/web/tailwind.config.ts | 3 ++ 7 files changed, 162 insertions(+), 30 deletions(-) create mode 100644 apps/web/lib/ui/useMountTransition.test.ts create mode 100644 apps/web/lib/ui/useMountTransition.ts diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css index 1b52c18..dc332cc 100644 --- a/apps/web/app/globals.css +++ b/apps/web/app/globals.css @@ -32,6 +32,10 @@ --color-info: #4a5a6b; --color-conflict-mark: #b5543a26; --color-conflict-mark-strong: #b5543a8c; + /* 暖深色 callout:仅用于英雄/CTA 时刻(对标 DESIGN.md cta-band-dark),非内容底。 */ + --color-callout: #201d18; + --color-on-callout: #f2ede2; + --color-on-callout-soft: #b8ae9c; --shadow-paper: #2b26200f; color-scheme: light; } @@ -71,6 +75,10 @@ --color-info: #8ca8ca; --color-conflict-mark: #ef8a7230; --color-conflict-mark-strong: #ef8a7290; + /* 夜读下 callout 为更深的凹陷暖井,仍与 bg 拉开层次。 */ + --color-callout: #100e0c; + --color-on-callout: #efe6d7; + --color-on-callout-soft: #a89d8a; --shadow-paper: #00000045; color-scheme: dark; } @@ -126,6 +134,21 @@ body { } } +/* Toast 入场:淡入 + 轻微上移(尊重 prefers-reduced-motion,见下)。 */ +.toast-enter { + animation: toast-in var(--dur-base) var(--ease-standard); +} +@keyframes toast-in { + from { + opacity: 0; + transform: translateY(6px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + @media (prefers-reduced-motion: reduce) { .typewriter-cursor { animation: none; @@ -137,4 +160,7 @@ body { animation: none; outline: 2px solid var(--color-conflict); } + .toast-enter { + animation: none; + } } diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index 5c37b63..8c2c3c0 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -4,7 +4,6 @@ import { BookOpen, PenLine, Plus } from "lucide-react"; import { AppShell } from "@/components/AppShell"; import { BackendDownNotice } from "@/components/BackendDownNotice"; import { ProjectLibrary } from "@/components/projects/ProjectLibrary"; -import { EmptyState } from "@/components/ui/EmptyState"; import { PageContainer } from "@/components/ui/PageContainer"; import { PageHeader } from "@/components/ui/PageHeader"; import { fetchProjects } from "@/lib/api/server"; @@ -51,29 +50,32 @@ export default async function DashboardPage() { {loadError ? ( ) : projects.length === 0 ? ( - - -