Skip to content

feat(sidebar): add project and session search to the sidebar - #1955

Open
bbedword wants to merge 1 commit into
vastsa:mainfrom
bbedword:feat/sidebar-search
Open

bbedword wants to merge 1 commit into
vastsa:mainfrom
bbedword:feat/sidebar-search

Conversation

@bbedword

Copy link
Copy Markdown

Summary

Add a search input at the top of the sidebar that filters projects and chat sessions by name in real time.

Changes

  • Add search input with icon and clear button to sidebar header
  • Filter pinned sessions, project entries, temporary sessions, and remote project groups by query (case-insensitive)
  • Auto-expand matching project groups during search
  • Show 'No results' placeholder when search yields no projects
  • Add i18n keys for all 9 supported locales (en, zh-CN, zh-TW, de, es, fr, ko, pt-BR, tr)
  • Add CSS styles using existing design tokens

Files

  • �pps/desktop/src/components/Sidebar.tsx — search state, filtering logic, UI
  • �pps/desktop/src/styles/sessions.css — search input styles
  • packages/i18n/src/locales/*/index.ts — translations for 9 locales

Testing

  • Lint: passed
  • Typecheck: no new errors
  • Build: verified (dist:win)

Add a search input at the top of the sidebar that filters projects and
chat sessions by name in real time. Matching projects auto-expand to
reveal matching sessions; non-matching sessions are hidden.

- Add search input with icon and clear button to sidebar header
- Filter pinned sessions, project entries, temporary sessions, and
  remote project groups by query (case-insensitive)
- Auto-expand matching project groups during search
- Show 'No results' placeholder when search yields no projects
- Add i18n keys for all 9 supported locales
- Add CSS styles using existing design tokens

@muzimu217 muzimu217 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The projection approach is the right one: forcing collapsed: false on a derived entry (rather than writing to the stored collapse state) means clearing the query restores exactly what the user had open, with no "search permanently expanded my sidebar" surprise. Same for filtering pinned, temporary and remote groups through one sessionMatchesSearch predicate — one rule, four call sites, which is what keeps them from drifting.

Two things I would add:

  1. No test file. The whole change is a pure filter over four lists plus one predicate, which is the easiest thing in this codebase to pin — and the sidebar already has *.test.mjs neighbours to put it in. A fixture with a pinned session, a project whose name matches but whose sessions do not, a session matched by title only, and a query that matches nothing (the "No results" branch) would cover every branch the diff introduces.

  2. toLowerCase() on a Turkish locale. The app ships tr, where "I".toLowerCase() is "ı" and "i".toLowerCase() is "i", so a user typing an uppercase I will not match i in a title. toLocaleLowerCase() with the active locale — or a simple case-fold that keeps ASCII behaviour for non-Turkish locales — avoids a bug that only that locale will ever report.

Matching the project path as well as its name is a judgement call I would keep: it makes "find that repo by directory name" work when the display name is a shortened label.

@Tioit-Wang

Copy link
Copy Markdown
Collaborator

The shape here is right — a derived entry that expands when it matches and restores your real state when the query is cleared, with one matching rule shared by all four lists, is what keeps this from drifting later.

Two review points are still open in the code: case handling breaks for Turkish, and there is no test file yet. Also, no automatic check has ever run on this branch, so nothing here is verified yet.

这里的形状是对的——命中时派生条目展开、清空查询后恢复你原来的状态,四张列表共用一条匹配规则,这样以后不容易走样。

代码里还有两个 review 点没落:大小写处理在土耳其语下会出错;还没有测试文件。另外这个分支从未跑过任何自动检查,所以目前还没有经过验证。

This branch has not been deployed

No deployments
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.

3 participants