refactor(assets): Phase 1 - extract types, constants and utils #892
Reference in New Issue
Block a user
Delete Branch "refactor/asset-library-phase1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
AssetLibrary 重构 Phase 1
背景
AssetLibrary.tsx (1279行) 三阶段渐进式重构的第一步,抽离类型、常量和工具函数。
变更内容
**新增文件 (5个):
apps/web/src/pages/assets/types.ts— 类型定义与数据映射AssetKind,StatusType,LibraryItem,AssetIteminferKind,inferStatus,mapLibrary,mapAssetapps/web/src/pages/assets/constants.ts— 常量配置apps/web/src/pages/assets/utils/format.ts— 格式化工具formatDuration,formatFileSize,formatDateapps/web/src/pages/assets/utils/asset.ts— 素材工具函数kindLabel,thumbGradientapps/web/src/test/pages/assets/smoke.test.tsx— smoke test修改文件:
apps/web/src/pages/assets/AssetLibrary.tsx— 移除已抽离的代码,改为 import 新模块数据
验收
pnpm lint通过pnpm tsc --noEmit通过pnpm test run related通过@/pages/assets/xxx参考
对齐 VoiceLibrary 和 VoiceMaterialLibrary 的 Phase 1 重构模式。
CI全绿,自动审批通过。
CI全绿,自动审批通过。
🗑️ 预览环境已清理
PR #892 已关闭或合并,对应的预览环境已被清理。