feat(web): sort the workspace picker by recent use and make it searchable
The chat sidebar's workspace picker listed rows in daemon order, which says nothing about where the user was last. It now orders by recent use and filters as you type. - new `features/chat/workspace-order.ts`: recency = browser-local stamp (`pi2-workspace-recency`, written whenever a workspace becomes active) > daemon `lastActiveAt` > name/id, so the order is deterministic and stable; search matches name, alias, cwd, directory name and id, whitespace-split terms all required - `WorkspaceSwitch` becomes a filterable listbox: fixed search field on top (focused on open, cleared on close), scrolling row list, empty state, arrow/Home/End focus, Enter takes the first match, Esc returns focus to the trigger; rows are `role=option` + `aria-selected` - pages/chat.tsx stamps whichever workspace is active (deep link, picker, default), styles and en/zh strings for the search field - tests for ordering, matching, persistence and the keyboard/selection paths; the B5 UI e2e scenario follows the ARIA change and asserts the filter
This commit is contained in:
1 parent
00c81a56f4
commit
3a797ac3f7
10 files changed
+651
-54
No files matched your search
@@ -51,6 +51,7 @@ import { SessionTree } from "@/features/chat/session-tree";
|
||||
import { SubagentView } from "@/features/chat/subagent-view";
|
||||
import { useChatStore, type TrayTab } from "@/features/chat/store";
|
||||
import { Telemetry } from "@/features/chat/telemetry";
|
||||
import { markWorkspaceUsed } from "@/features/chat/workspace-order";
|
||||
|
||||
import "@/styles/pages/chat.css";
|
||||
|
||||
@@ -106,6 +107,11 @@ function ChatExperience({ sessionId }: { sessionId?: string }) {
|
||||
workspaces[0]?.workspaceId;
|
||||
|
||||
const sessionsQuery = useChatSessions(workspaceId, paired);
|
||||
// "Recently used" for the workspace picker: whichever workspace is active
|
||||
// (deep link, picker pick, default choice) gets a browser-local stamp.
|
||||
useEffect(() => {
|
||||
if (workspaceId) markWorkspaceUsed(workspaceId);
|
||||
}, [workspaceId]);
|
||||
const sessions = sessionsQuery.sessions;
|
||||
const sessionIds = useMemo(() => sessions.map((session) => session.sessionId), [sessions]);
|
||||
useChatSocket(workspaceId, sessionIds, paired);
|
||||
|
||||
Reference in new issue
Block a user