Skip to content

前端:历史页新增来源标签、渠道/状态筛选和失败详情展示 - #159

Merged
todosdev[bot] merged 2 commits into
mainfrom
tds/conv-01a18117-84b1-759d-bb0f-e06144e5f27f
Oct 28, 2026
Merged

todosdev[bot] merged 2 commits into
mainfrom
tds/conv-01a18117-84b1-759d-bb0f-e06144e5f27f

Conversation

@todosdev

@todosdev todosdev Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • 通知历史页新增来源徽章(事项 / API / 测试)、渠道筛选与「全部 / 仅成功 / 仅失败」三态切换;筛选条件写入 URL 并作为 query 参数下推后端,刷新或分享链接可复现。
  • 失败记录的详情面板按渠道完整展示 error 全文;桌面表格与移动端卡片两种布局均已适配。
  • 改动仅限 web/,worker、接口契约与依赖均未变动。

Changes

  • web/src/pages/history/HistoryPage.tsx
    • 筛选状态读自 useSearchParams(channel、success),setSearchParams(..., { replace: true }) 同步 URL,不跳转、不堆历史;?channel=all、非法 success 值按「无筛选」处理。
    • 列表请求携带 channel/success 且 limit=200 不变;保留前端按标题/时间分组;递增请求序号丢弃过期响应,切换筛选时旧列表淡化而非闪骨架,成功后清空错误态。
    • 渠道下拉候选集从已加载历史累积去重;首屏 URL 已带筛选时补取一次未筛选数据填满候选集(失败静默),未知渠道仍可显示并切走。
    • 来源徽章:item/api/test → 事项/API/测试,null/其他不渲染;表格行、移动卡片、详情面板各一处。
    • 详情面板「失败原因」按渠道分块,<pre> + pre-wrap/break-words 全文展示;标题改为折行全文,不截断。
    • 筛选无结果时显示专用空态与「清除筛选」;移动卡片加 w-full min-w-0,修复长错误文本造成的横向溢出。
  • web/src/components/ui/select.tsx(新增):基于已安装 @radix-ui/react-select 的 shadcn/Nova 风格封装(Select/SelectTrigger/SelectValue/SelectContent/SelectItem),未新增依赖。
  • web/src/lib/channels.ts:新增 getChannelLabel(id),未知/已下线渠道回落原始 id。
  • web/src/locales/zh.json、en.json:新增 13 个 history.* 键(来源 3 个、筛选 5 个、失败原因、清除筛选、筛选空态 2 个)。

Testing

  • pnpm --filter web typecheck → 退出码 0;pnpm lint(仓库根 biome)→ 0,仅既有的 worker/src/routes/items.ts unused-import warning;pnpm format:check → 0;pnpm build:web → 成功。
  • 本地 wrangler + 构建产物 + 无头 Chrome 实测:
    • 渠道选择后 URL 变 /history?channel=telegram 且请求带 &channel=telegram;「仅失败」后 URL/请求带 success=false,仅剩失败记录;刷新带参 URL 筛选保留、下拉仍有全部 7 个渠道。
    • 徽章三态与旧数据(trigger_source=null)不显示;详情面板 387 字符多行错误全文折行、无截断;筛选空态 + 清除筛选回到 /history。
    • 1440×900(表格)、390×844(卡片)、320×640(卡片)三种宽度:移动端筛选栏纵向堆叠、Select 与 Tabs 占满整行,320 下 body.scrollWidth = 320、卡片宽 288。
    • 168 字超长标题在详情面板折行 6 行(桌面)/ 8 行(移动),clientWidth = scrollWidth,无省略号。
  • 测试数据来自本地 .wrangler 临时库(验证后已删除),未触碰生产环境。

Todos added 2 commits October 28, 2026 14:34
Filter history by channel and success through URL search params backed by the
notification-history query params. Show trigger_source badges in the table,
mobile cards and detail panel, and render full channel errors in the detail view.

Checkpoint: LSedHhJJ_GPziIAYlRyC0
Let the detail title wrap instead of truncating so long titles stay readable;
table rows and mobile cards keep their single-line ellipsis.

Checkpoint: 23Cz-MLPLqIP-XHg69NCE
@todosdev
todosdev Bot merged commit f9f3328 into main Oct 28, 2026
1 check passed
@mapxn
mapxn deleted the tds/conv-01a18117-84b1-759d-bb0f-e06144e5f27f branch November 8, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants