Files
frontend_v2/.workbuddy/memory/2026-08-29.md
toom1996 e24bfe164d
Some checks failed
deploy / deploy (push) Has been cancelled
update
2026-08-29 20:17:13 +08:00

33 lines
3.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 2026-08-29 工作日志
## 前端列表页重构 + 详情路由统一(17:00–17:45)
用户要求:① 所有文章详情集成到 `/item`(含 street 详情);② 之前分析过的列表页抽象(共享 CSS / 共享 Alpine 工具 / 品牌弹窗组件)一并落地。
### 现状核对(重要:大部分已提前落地)
- 排查发现 RunwayLooks.astro 与 StreetSnaps.astro 的 `<script>` **已**抽成共享工具(import `@/lib/looks-grid`,`getCardSlots`→`makeCardSlots`、`pageList`→`buildPageList`、`SPIN_SVG` 从工具导入),且 RunwayLooks 的重复 `toggleBrand`(selectedBrands 数组误写)**已**删除;品牌弹窗**已**抽成 `src/components/BrandModal.astro`。
- 详情路由:`cn/item/[id].astro` 与 `en/item/[id].astro` **已**实现「先 article 后 street 回落」统一渲染;RunwayLooks 卡片链接**已**用 `ROUTES.item` → `/item/`。
### 本次实际改动
- **共享 CSS**:新建 `src/styles/look-grid.css`,集中两列表页重复的卡片/网格/分页/侧栏/spinner/骨架/动画样式(类名保留 `.shows*`/`.snaps*`,keyframes 统一为 `looksProg`/`looksShim`)。用 node 脚本剥离两个组件内部 `<style>` 块,frontmatter 各 `import "@/styles/look-grid.css"`。
- **路由统一**:`src/lib/routes.ts` 将 `article`/`streetSnap` 两个工厂函数都改为 `(id)=>/item/${id}`(原 `article` 还是旧的 `/article?id=` 死路径)。
- **删遗留旧详情页**:`cn|en/street-snaps/[id].astro`、`cn|en/article.astro`(?id= 旧详情,全仓无任何内链)。`runway-looks/[id]` 早就被删。
- 验证:`npm run build` 通过(BUILD_EXIT=0);详情组件回链指向列表页 `/street-snaps`、`/runway-looks`(仍存在),api.ts 内 `/api/v1/public/...` 是后端地址未动;全仓无悬空引用。
### 余留(已解决)
- `src/components/pages/article.astro`(`Article` 组件)已删除(见下方清理)。
- `ROUTES.article` 与 `ROUTES.item` 现为同义重复,保留 `article` 仅为语义兼容(暂未动)。
## 清理孤儿代码(18:50)
用户要求删除没用的页面/css/js。排查全仓引用后执行:
- **删 9 个孤儿组件/资源**:`components/pages/` 下 8 个(`About`/`Contact`/`LatestProjects`/`Portfolio`/`Login`/`Register`/`AuthForm`/`article`,全是 ComingSoon 占位或旧详情组件,无任何页面 import、也不是真实路由)+ `components/LanguageDetector.astro`(Layout 里被注释掉的死 import)。并移除空的 `components/pages/` 目录 + `assets/astro.svg`、`assets/background.svg`(Astro 脚手架残留,全仓零引用)。
- **修隐藏 bug**:`ComingSoon.astro` 引用了 `ROUTES.articles`(routes.ts 从未定义该 key)→ 改为 `ROUTES.runwayLooks`(真实路由),否则「浏览走秀档案」按钮指向 undefined。
- **清 Layout 死引用**:删除 `import LanguageDetector` 与 `<!-- TODO <LanguageDetector /> -->`。
- **本次保留(未动)**:`ComingSoon`(Index 在用)、`looks-grid.ts`(两列表页 import)、`global.css`(Layout 引用)、`Breadcrumb/BrandModal/Item/StreetSnap` 等都在用。
- **未动 header 导航**:导航仍链到 `/about` `/contact` `/portfolio` `/latest-projects` `/login` `/register`,但这些路由**根本不存在**(占位组件已删、也从未有真实页面)→ 是死链。按用户「header 别动」旧约束未删导航项,待用户决定是否一并移除。
- 验证:`npm run build` BUILD_EXIT=0;read_lints Layout/ComingSoon 均 0;全仓 grep `LanguageDetector|components/pages|ROUTES.articles|astro.svg|background.svg` 零命中。
## 删冗余 ROUTES.article(19:00)
- `ROUTES.article`(routes.ts 里 `(id)=>/item/${id}`)全仓只有定义、零引用(另几处 `article:` 是 Item.astro / api.ts 的数据字段,无关),与 `ROUTES.item` 完全同义 → 按用户要求删除。保留 `streetSnap`(同样指向 /item,暂未动)。
- 验证:`npm run build` BUILD_EXIT=0;read_lints routes.ts 0。