Skip to content

fix(history): 历史页搜索框可点击、可搜索 (#612)#627

Merged
H-Chris233 merged 1 commit into
betafrom
fix/issue-612-history-search
Jun 9, 2026
Merged

fix(history): 历史页搜索框可点击、可搜索 (#612)#627
H-Chris233 merged 1 commit into
betafrom
fix/issue-612-history-search

Conversation

@appergb

@appergb appergb commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

User description

背景

issue #612:设置 → 历史记录页,顶部带搜索图标的区域无法点击、无法获得焦点、无法输入,只能看到「共 N 条 · 显示 M」统计文案,无法按关键词过滤历史条目。History.tsx 实现为静态 div,未使用 input,也无搜索逻辑。

改动(History.tsx + 5 个 i18n,单一职责)

  • 把伪装成搜索框的静态 <span> 替换为真实 <input type="search">,可聚焦、可输入;原统计文案下移为独立小字行。
  • 输入后实时过滤左侧列表:匹配 finalText / rawTranscript / appName(大小写不敏感、trim),与现有 mode 筛选叠加。
  • 清空关键词恢复显示全部(受当前 mode 筛选)。
  • ⌘K / Ctrl+K 聚焦搜索框(设计稿 pages.jsx 预期)。
  • 搜索无结果时显示专门提示 history.searchNoMatch,区别于「暂无历史」。
  • 新增 i18n:history.searchPlaceholder / history.searchNoMatch(en / ja / ko / zh-CN / zh-TW)。

type="search" 在 WebKit 内提供原生清除按钮,无需自绘。

验收对照

  • 顶部搜索区域可点击并获得焦点、支持输入关键词
  • 实时按 rawTranscript / finalText 过滤左侧列表(额外含 appName)
  • 清空搜索词恢复显示全部
  • ⌘K / Ctrl+K 聚焦搜索框

验证

  • npm run build(tsc 类型检查 + vite 构建)✅

🤖 Generated with Claude Code


PR Type

Bug fix


Description

  • Replace static div with real

  • Add real-time filtering by finalText/rawTranscript/appName

  • Add keyboard shortcut (⌘K/Ctrl+K) to focus search box

  • Add i18n keys for search placeholder and no-match message


Diagram Walkthrough

flowchart LR
  User["User types query"] --> Input["Search input (real <input>)"]
  Input --> Filter["Filter list by finalText/rawTranscript/appName"]
  Filter --> List["Show matching entries or no-match message"]
Loading

File Walkthrough

Relevant files
Localization
en.ts
Add i18n keys for search placeholder and no-match (en)     

openless-all/app/src/i18n/en.ts

  • Added history.searchPlaceholder with shortcut interpolation
  • Added history.searchNoMatch for empty search results
+2/-0     
ja.ts
Add i18n keys for search placeholder and no-match (ja)     

openless-all/app/src/i18n/ja.ts

  • Added history.searchPlaceholder translation
  • Added history.searchNoMatch translation
+2/-0     
ko.ts
Add i18n keys for search placeholder and no-match (ko)     

openless-all/app/src/i18n/ko.ts

  • Added history.searchPlaceholder translation
  • Added history.searchNoMatch translation
+2/-0     
zh-CN.ts
Add i18n keys for search placeholder and no-match (zh-CN)

openless-all/app/src/i18n/zh-CN.ts

  • Added history.searchPlaceholder translation
  • Added history.searchNoMatch translation
+2/-0     
zh-TW.ts
Add i18n keys for search placeholder and no-match (zh-TW)

openless-all/app/src/i18n/zh-TW.ts

  • Added history.searchPlaceholder translation
  • Added history.searchNoMatch translation
+2/-0     
Bug fix
History.tsx
Implement search input and filtering logic                             

openless-all/app/src/pages/History.tsx

  • Imports useRef and useState for search query state
  • Adds query state and searchRef ref
  • Adds keyboard shortcut listener (⌘K/Ctrl+K) to focus search
  • Updates filtered memo to include keyword matching on finalText,
    rawTranscript, appName
  • Replaces static with real element
  • Moves summary text below the search bar
  • Displays searchNoMatch text when query is non-empty and results empty
+46/-8   

历史页顶部带搜索图标的区域此前是静态 div,只显示「共 N 条 · 显示 M」统计,
无法获得焦点、无法输入、无过滤逻辑(issue #612,Windows beta 实测)。

- 把静态 span 改为真实 `<input type="search">`,可聚焦输入;统计文案下移为独立小字。
- 按关键词实时过滤左侧列表,匹配 finalText / rawTranscript / appName(大小写不敏感、trim);
  与现有 mode 筛选叠加。
- 清空关键词恢复显示全部(受当前 mode 筛选)。
- ⌘K / Ctrl+K 聚焦搜索框(设计稿预期)。
- 搜索无结果时显示专门提示 history.searchNoMatch,区别于「暂无历史」。
- 新增 i18n: history.searchPlaceholder / history.searchNoMatch(en/ja/ko/zh-CN/zh-TW)。
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

612 - Partially compliant

Compliant requirements:

  • 搜索区域可点击并获得焦点,支持输入关键词
  • 输入后实时按 finalText / rawTranscript / appName 过滤左侧列表(appName 为额外实现)
  • 清空搜索词后恢复显示全部(受当前 mode 筛选)
  • 实现 ⌘K / Ctrl+K 快捷键聚焦搜索框

Non-compliant requirements:

(empty)

Requires further human verification:

(empty)

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@H-Chris233 H-Chris233 merged commit aaf9133 into beta Jun 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants