From 05a67f4b8f0b0831106c0b95f442b03843f93c59 Mon Sep 17 00:00:00 2001 From: cattan0710-tech Date: Tue, 10 Nov 2026 14:52:34 +0800 Subject: [PATCH 1/2] fix: embed catalog reports and shorten model and recipe URLs --- docs/development/catalog-implementation.md | 12 +- src/components/LanguageSwitch/index.tsx | 12 +- src/features/catalog/CatalogLink.tsx | 47 +++ src/features/catalog/CatalogPage.tsx | 49 +++- src/features/catalog/DetailPage.tsx | 127 ++++++-- src/features/catalog/GainMeter.tsx | 16 +- src/features/catalog/ModelCard.tsx | 38 ++- src/features/catalog/RecipeOverview.tsx | 40 ++- src/features/catalog/ReportPage.tsx | 4 +- src/features/catalog/ReportPanel.module.css | 17 ++ src/features/catalog/ReportPanel.tsx | 88 ++++-- src/features/catalog/components.tsx | 54 +++- src/features/catalog/data.ts | 40 ++- src/features/catalog/report.ts | 25 +- src/features/catalog/routes.ts | 60 +++- src/features/catalog/useCatalog.ts | 5 +- src/pages/model.tsx | 6 + src/pages/recipe.tsx | 6 + src/theme/Navbar/index.tsx | 4 +- src/theme/SkipToContent/index.tsx | 4 +- tests/e2e/catalog.spec.ts | 86 +++--- tests/e2e/i18n.spec.ts | 4 +- tests/e2e/model-url.spec.ts | 310 ++++++++++++++++++++ tests/e2e/recipe-overview.spec.ts | 44 ++- tests/e2e/recipe-url.spec.ts | 144 +++++++++ tests/e2e/report-language.spec.ts | 118 +++++++- tests/pages/deployment.spec.ts | 6 +- tests/unit/catalog.test.ts | 28 +- tests/unit/model-url.test.ts | 54 ++++ tests/unit/recipe-url.test.ts | 76 +++++ tests/unit/report.test.ts | 74 +++++ 31 files changed, 1375 insertions(+), 223 deletions(-) create mode 100644 src/features/catalog/CatalogLink.tsx create mode 100644 src/features/catalog/ReportPanel.module.css create mode 100644 src/pages/model.tsx create mode 100644 src/pages/recipe.tsx create mode 100644 tests/e2e/model-url.spec.ts create mode 100644 tests/e2e/recipe-url.spec.ts create mode 100644 tests/unit/model-url.test.ts create mode 100644 tests/unit/recipe-url.test.ts diff --git a/docs/development/catalog-implementation.md b/docs/development/catalog-implementation.md index 2ed55e9..0a0a295 100644 --- a/docs/development/catalog-implementation.md +++ b/docs/development/catalog-implementation.md @@ -7,10 +7,10 @@ ## 当前交付范围 - `/models`:模型数、配方数、调优对照组数及覆盖率、源记录提升中位数及范围、最佳提升及配方入口五项统计;搜索、家族/引擎/配方角色/硬件厂商/硬件型号多选/拓扑筛选、源记录增幅/名称/配方发布日期排序、卡片/表格视图、分页和统一配方详情入口。默认展示配方,模型/配方视角选择器与技术标签筛选已移除;旧 `view=models` 链接继续兼容,旧 `tag` 参数不再参与筛选。 -- `/models/detail?modelId=…`:模型资料和可用配方。 +- `/model?id=…`:模型资料和可用配方的短分享入口,使用通用静态页面,新增模型不需要重建页面。旧 `/models/detail?modelId=…` 使用 replace 转到新入口;显式 `dataVersion` 保留,筛选返回地址移入浏览器当前历史记录。普通站内点击同样通过历史记录保存目录版本及返回筛选条件,新标签页的短分享链接展示当前目录。 - 模型和配方详情在首屏脚本接管及目录数据等待阶段显示骨架屏,支持明暗主题、窄屏与减少动态效果偏好;请求结束后显示详情或原有错误状态。“需要 JavaScript”及原目录入口仅在 `