From 7e19661a9977fbda72e8b9d063b646e24fb9cdcb Mon Sep 17 00:00:00 2001 From: zhangxiang Date: Thu, 3 Sep 2026 19:28:18 +0800 Subject: [PATCH] =?UTF-8?q?perf(motion):=20=E6=B8=85=E7=90=86=E6=9C=AB?= =?UTF-8?q?=E6=89=B9=20P0=20=E2=80=94=E2=80=94=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E5=8A=A8=E7=94=BB=20+=20=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=AD=BB=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 按用户决策收尾 Task #16,P0 硬违规 13 → 0: - 移除 3 处循环动画(均违反 CONTEXT.md「禁循环动画」) detail-hero 徽章 Sparkles 旋转 4s、滚动箭头浮动 2s、brand-visuals 半径脉冲 4s → motion.* 改静态元素,保留视觉语义但不再循环 - 删除死代码 src/lib/animations.tsx(923 行,全站零引用,含 10 处 P0 + spring variants) 同步删除 src/lib/animations.test.tsx - 级联修复:brand-visuals 因删 guard 冗余的 shouldReduceMotion 声明一并移除 验证: - 审计 P0 13 → 0,P1 163→156,P2 28→25(死代码移除导致分母下降) - tsc --noEmit 0 error;eslint 0 error - 视觉基线不变:时长/循环改动在 reducedMotion+animations disabled 下不改变最终像素 --- src/components/detail/detail-hero.tsx | 13 +- src/components/ui/brand-visuals.tsx | 14 +- src/lib/animations.test.tsx | 841 ----------------------- src/lib/animations.tsx | 923 -------------------------- 4 files changed, 8 insertions(+), 1783 deletions(-) delete mode 100644 src/lib/animations.test.tsx delete mode 100644 src/lib/animations.tsx diff --git a/src/components/detail/detail-hero.tsx b/src/components/detail/detail-hero.tsx index 7b755da..8576f7a 100644 --- a/src/components/detail/detail-hero.tsx +++ b/src/components/detail/detail-hero.tsx @@ -83,12 +83,9 @@ export function DetailHero({ borderColor: `${theme.accentColor}25`, }} > - + - + {badge || theme.badge} )} @@ -192,13 +189,11 @@ export function DetailHero({ transition={{ delay: 1.5, duration: 0.3 }} className="absolute bottom-8 left-1/2 -translate-x-1/2" > - - + diff --git a/src/components/ui/brand-visuals.tsx b/src/components/ui/brand-visuals.tsx index a68cf4d..3ad43a1 100644 --- a/src/components/ui/brand-visuals.tsx +++ b/src/components/ui/brand-visuals.tsx @@ -5,8 +5,6 @@ import { useReducedMotion } from '@/hooks/use-reduced-motion'; // ===== 抽象几何装饰 - 用于各 section 背景 ===== export function GeometricDecoration({ variant = 'circles' }: { variant?: 'circles' | 'lines' | 'grid' | 'waves' }) { - const shouldReduceMotion = useReducedMotion(); - if (variant === 'circles') { return (