refactor: 收口公开作品展示格式

This commit is contained in:
2026-06-03 18:18:01 +08:00
parent f67f57b415
commit 5fecceef4f
6 changed files with 150 additions and 64 deletions

View File

@@ -0,0 +1,28 @@
# 【前端架构】Public Work Presentation 收口计划
## 背景
`RpgEntryHomeView.tsx` 的作品卡、推荐 runtime meta、排行项、分类项、搜索结果和桌面 hero 共用公开作品玩法类型 label 与紧凑计数格式。原先 `describePublicGalleryCardKind``formatCompactCount` 放在页面 **Implementation** 内,导致新增玩法或调整数字展示时需要穿过多段 JSX。
## 决策
`src/components/rpg-entry/rpgEntryWorldPresentation.ts` 追加单作品展示 **Interface**
- `describePlatformPublicWorkKind(entry)`:统一公开作品玩法类型 label并继续复用 `formatPlatformWorkDisplayTag` 的 4 字截断口径。
- `formatPlatformCompactCount(value)`:统一游玩、改造、点赞、排行和分类指标的紧凑数字展示。
`RpgEntryHomeView.tsx` 删除本地类型 label 与紧凑计数 **Implementation**,仅消费 `rpgEntryWorldPresentation.ts`。集合筛选、排序和指标选择仍留在 `rpgEntryPublicGalleryViewModel.ts`,避免单作品展示 **Module** 与集合 **Module** 混杂。
## 约定
- 紧凑计数保留既有口径:`10000` 显示 `1.0万``100000000` 显示 `1.0亿`,一万以下不加千分位。
- 玩法类型 label 继续遵循 4 字展示限制,例如“大鱼吃小鱼”外显为“大鱼吃小”。
- 本次不迁移排行 metric label / value 配对;该规则属于集合排序 **Module** 的后续切片。
## 验证
- `npm run test -- src/components/rpg-entry/rpgEntryWorldPresentation.test.ts`
- `npm run test -- src/components/rpg-entry/RpgEntryHomeView.recharge.test.tsx -t "recommend|ranking|category"`
- 针对变更文件执行 ESLint
- `npm run typecheck`
- `npm run check:encoding`