From a100bd34d4059cbf72d008eccdfd739e7a930ddf Mon Sep 17 00:00:00 2001 From: Sam Julien Date: Tue, 1 Dec 2026 15:42:16 -0800 Subject: [PATCH 1/2] Conversations panel: labeled New conversation and Search rows, Pinned and Recents, status under the title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New conversation is a row with its name and ⇧N, not an unlabeled icon in the header. - Search is a row with ⌘K that opens the command palette. The palette already searches every conversation on the server, so the panel's own search box and its results list are removed. - The list is grouped under small muted labels: Pinned (when anything is pinned), then Recents. - A row's age ("2w") shows on hover or keyboard focus. A screen reader still reads it. - While a Bot works, the row says so on a muted line under its text: "Working", "Waiting on " for a Bot it asked, or "Running a routine". Read from the fields the roster already has (busy, work, delegated tasks). No API change. --- CHANGELOG.md | 9 + .../components/app-sidebar/app-sidebar.tsx | 3 - app/src/components/app-sidebar/bots-panel.tsx | 2 + .../app-sidebar/channel-item-content.tsx | 66 +++- app/src/components/app-sidebar/channel.tsx | 7 +- .../app-sidebar/conversations-panel.tsx | 368 ++++++------------ .../components/navigation/command-menu.tsx | 15 +- app/tests/channel-item-working.test.tsx | 38 +- app/tests/channel-pagination.test.tsx | 252 ++++-------- app/tests/compact-conversations.test.tsx | 13 +- app/tests/narrow-sidebar-sheet.test.tsx | 23 +- app/tests/section-strip.test.tsx | 26 +- 12 files changed, 337 insertions(+), 485 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3076d58f3d..b09e06c7ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,15 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged. long list never meets a proxy's limit on an address. The web app uses the new operations, and falls back to the old ones on a server from before them. +**The conversation list.** + +- **New conversation and Search are labeled rows, and the list has Pinned and Recents.** The top of + the Conversations panel has New conversation (⇧N), Search (⌘K) and Artifacts. Search opens the + command palette, which searches every conversation, so the search box in the panel is gone. + Pinned conversations sit under Pinned, the rest under Recents. While a Bot works, its + conversation says so on a muted line under the title, such as "Working" or "Waiting on Research + Bot". How long ago a conversation was used shows when you point at it. + ## 1.2.7 **Before upgrading.** diff --git a/app/src/components/app-sidebar/app-sidebar.tsx b/app/src/components/app-sidebar/app-sidebar.tsx index e0b9575aaf..3cde57e09e 100644 --- a/app/src/components/app-sidebar/app-sidebar.tsx +++ b/app/src/components/app-sidebar/app-sidebar.tsx @@ -13,9 +13,6 @@ export { isUnread, matchingChannels, pinnedFirst, - SEARCH_DEBOUNCE_MS, - SEARCH_HINT, - SEARCH_SCOPE, } from "./conversations-panel"; /** diff --git a/app/src/components/app-sidebar/bots-panel.tsx b/app/src/components/app-sidebar/bots-panel.tsx index 30460283aa..24758b3027 100644 --- a/app/src/components/app-sidebar/bots-panel.tsx +++ b/app/src/components/app-sidebar/bots-panel.tsx @@ -58,6 +58,7 @@ import { isWorking, NONE_DELEGATING, pinnedFirst, + workStatus, } from "./conversations-panel"; /** Where a Bot's row hands up that its conversations are held back, by Bot, for the panel to say once. */ @@ -172,6 +173,7 @@ function BotConversations({ {pinnedFirst(conversations.data).map((channel) => ( ) : null; /* - * While a Bot works on it, the row says so where its time goes, in the scheme's color for what is - * working: said as well as shown by the orb, and the time is news only once the work is done. + * The age is for the row a person is looking at, so it waits for the pointer or the keyboard. Out + * of sight it stays in the accessibility tree (`sr-only`), so a screen reader still says it. */ - const time = busy ? ( - - Working - - ) : ( - + const time = lastMessageAt ? ( + {lastMessageAt} - ); + ) : null; + /* + * The Bot's live state, a muted line of its own under the text. The orb moves as well, so the + * line stays quiet: no color, no weight. + */ + const statusText = status ?? (busy ? "Working" : undefined); + const statusLine = statusText ? ( +
+ {statusText} +
+ ) : null; const caret = revealing ? ( ) : null; @@ -87,13 +109,16 @@ export function ChannelItemContent({ {avatar ? ( {`${name}, `} ) : null} - - {displayedTitle} - {caret} - +
+
+ {displayedTitle} + {caret} +
+ {statusLine} +
{time} {unreadDot} {pin} @@ -132,6 +157,7 @@ export function ChannelItemContent({ {displayedTitle} {caret} + {statusLine} ); diff --git a/app/src/components/app-sidebar/channel.tsx b/app/src/components/app-sidebar/channel.tsx index c1109c5b15..bd88a526f1 100644 --- a/app/src/components/app-sidebar/channel.tsx +++ b/app/src/components/app-sidebar/channel.tsx @@ -42,6 +42,7 @@ export const Channel = memo(function Channel({ canRename, unread, busy, + status, emphasis, view = "detailed", avatar = true, @@ -60,6 +61,8 @@ export const Channel = memo(function Channel({ canRename: boolean; unread: boolean; busy: boolean; + /** What its Bot is doing while it works, said under the row's text. See `ChannelItemContent`. */ + status?: string; emphasis: MessageListEmphasis; /** One line or two: see `ChannelItemContent`. */ view?: ConversationView; @@ -108,7 +111,8 @@ export const Channel = memo(function Channel({ data-slot={slot} type="button" className={cn( - "flex flex-row px-2.5 gap-2 items-center w-full hover:bg-foreground/5 rounded-lg [content-visibility:auto]", + // `group/row`: the row's age shows while the pointer or the keyboard is on it. + "group/row flex flex-row px-2.5 gap-2 items-center w-full hover:bg-foreground/5 rounded-lg [content-visibility:auto]", view === "compact" ? "py-1.5 [contain-intrinsic-size:auto_2rem]" : "py-2 [contain-intrinsic-size:auto_3.25rem]", @@ -125,6 +129,7 @@ export const Channel = memo(function Channel({ lastMessageAt={lastMessageAt} emphasis={emphasis} busy={busy} + status={status} unread={unread} pinned={pinned} revealing={revealed.typing} diff --git a/app/src/components/app-sidebar/conversations-panel.tsx b/app/src/components/app-sidebar/conversations-panel.tsx index b8a9cce622..2da0355efe 100644 --- a/app/src/components/app-sidebar/conversations-panel.tsx +++ b/app/src/components/app-sidebar/conversations-panel.tsx @@ -6,16 +6,17 @@ import { import { useInfiniteQuery, useQuery } from "@tanstack/react-query"; import { Link, useParams } from "@tanstack/react-router"; import { AnimatePresence, motion, useReducedMotion } from "motion/react"; -import { useEffect, useLayoutEffect, useRef, useState } from "react"; +import { type ReactNode, useRef } from "react"; import { SectionPanel } from "@/components/layout/section-panel"; import { - InputGroup, - InputGroupAddon, - InputGroupInput, -} from "@/components/ui/input-group"; + COMMAND_MENU_KEYS, + HotkeyKeys, + openCommandMenu, +} from "@/components/navigation/command-menu"; import { SidebarContent, SidebarGroup, + SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem, @@ -24,11 +25,7 @@ import { untitledLine } from "@/lib/channels/label"; import { type ChannelSummary, channelListQueryOptions, - channelSearchInfiniteQueryOptions, - isChannelSearchable, - normalizeChannelSearch, } from "@/lib/channels/queries"; -import { loadFailure } from "@/lib/load-failure"; import { EASE_OUT, ENTRANCE_SECONDS } from "@/lib/motion"; import { relativeTimeShort } from "@/lib/relative-time"; import { @@ -40,7 +37,6 @@ import { useMessageListEmphasis, } from "@/lib/settings/message-list"; import { delegatingConversationsQueryOptions } from "@/lib/tasks/queries"; -import { Button } from "../ui/button"; import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../ui/empty"; import { Channel } from "./channel"; import { ChannelPagination } from "./channel-pagination"; @@ -58,8 +54,9 @@ const MAX_ANIMATED_ROWS = 60; * cannot account for. The opening and the last message are included because one of them is what the * second line draws until the conversation has been named. * - * Only what is loaded. This sidebar asks the server instead (see `SearchResults`), which searches - * the whole history; the alternate skins' rosters still narrow their loaded rows with this. + * Only what is loaded. This sidebar has no box of its own: its Search row opens the command menu, + * which asks the server and searches the whole history. The alternate skins' rosters still narrow + * their loaded rows with this. * * An empty query returns the input array unchanged rather than a copy, so typing and clearing does * not hand `AnimatePresence` a new array identity and restage the whole list. @@ -82,26 +79,6 @@ export function matchingChannels( ); } -/** How long typing has to pause before the box is searched. */ -export const SEARCH_DEBOUNCE_MS = 250; - -/** What the search box searches, said where the person types. Not every word of every message. */ -export const SEARCH_SCOPE = "Search conversation names and recent messages"; -export const SEARCH_HINT = "Type at least 2 characters to search history"; - -/** - * `value`, once it has stopped changing for `delay`. Each search is a request, so one per pause in - * typing rather than one per keystroke. - */ -function useDebounced(value: string, delay: number): string { - const [debounced, setDebounced] = useState(value); - useEffect(() => { - const timer = setTimeout(() => setDebounced(value), delay); - return () => clearTimeout(timer); - }, [value, delay]); - return debounced; -} - /** * Pinned channels first, everything else after, newest activity first within each group. * @@ -148,6 +125,26 @@ export function isWorking( ); } +/** + * What a working conversation's row says under its text, from what the roster already knows: a turn + * running says Working, a Bot it asked and waits on is named, a routine firing into it says so, and + * work handed out to a task still under way says Working. Null while nothing is under way. + */ +export function workStatus( + channel: ChannelSummary, + delegating: readonly string[], +): string | null { + if (channel.busy) return "Working"; + const waiting = channel.work?.[0]; + if (waiting?.kind === "handoff") { + return waiting.botName + ? `Waiting on ${waiting.botName}` + : "Waiting on another Bot"; + } + if (waiting?.kind === "routine") return "Running a routine"; + return delegating.includes(channel.id) ? "Working" : null; +} + /** No conversation's work handed out and still working: the answer before the task list is read. */ export const NONE_DELEGATING: readonly string[] = []; @@ -216,127 +213,59 @@ function ChannelRow({ unread={unread} // A turn running, work the conversation waits on (a hop, a routine), or a task it handed out. busy={isWorking(channel, delegating)} + status={workStatus(channel, delegating) ?? undefined} /> ); } /** - * What the server found for the search box, a page at a time. - * - * The answer is for the text in the box or it is not shown: while the box is still settling, or the - * first page is on its way, this says it is searching. A list left over from what was typed a - * moment ago would answer a question nobody is asking any more, and an empty one would say there - * is nothing to find. A failure says so and offers Retry. It is never shown as no matches. - * - * FILTERING DOES NOT ANIMATE. The rows are drawn without the roster's order animation: results - * replace each other as somebody types, and a list that moves under them is the very thing they - * are trying to read. + * A group of the roster's rows under a small muted label, as Claude's sidebar lists Pinned and + * Recents. Each group animates its own rows: a pin moves a row from one group to the other. */ -function SearchResults({ - term, - settled, +function RosterGroup({ + label, + channels, + animateOrder, emphasis, view, delegating, + children, }: { - /** The search as it was when typing last paused, normalised. This is what is asked for. */ - term: string; - /** Whether that is still what is in the box. */ - settled: boolean; + label: string; + channels: ChannelSummary[]; + animateOrder: boolean; emphasis: MessageListEmphasis; view: ConversationView; delegating: readonly string[]; + children?: ReactNode; }) { - const results = useInfiniteQuery(channelSearchInfiniteQueryOptions(term)); - - if (!settled || results.isPending) { - return ( -

- Searching… -

- ); - } - if (!results.data) { - return ( -
-

- {loadFailure( - results.error, - results.error?.message || "Couldn't search your conversations.", - )} -

- -
- ); - } - if (results.data.length === 0) { - return ( -
- - - No conversations match your search - - {`No conversation has “${term}” in its name or recent messages.`} - - - -
- ); - } return ( - <> - {/* Mounted with its first rows, so they appear without the entrance a new channel gets. */} + + {label} - {results.data.map((channel) => ( + {channels.map((channel) => ( ))} - {results.hasNextPage ? ( -
- {results.isFetchNextPageError ? ( -

- {loadFailure(results.error, "Couldn't load more results.")} -

- ) : null} - -
- ) : null} - + {children} +
); } /** - * The Conversations section's panel: every conversation, pinned first and newest first after, with - * a search over the whole history and New conversation at the top. Today's roster, moved beside the - * strip and otherwise unchanged. + * The Conversations section's panel. + * + * At the top, three rows with words on them: New conversation and its shortcut, Search and its + * shortcut, and Artifacts. Search opens the command menu, which searches every conversation on the + * server. Under them the conversations, pinned under Pinned, the rest newest first under Recents. */ export function ConversationsPanel({ hidden = false }: { hidden?: boolean }) { const emphasis = useMessageListEmphasis(); @@ -344,34 +273,12 @@ export function ConversationsPanel({ hidden = false }: { hidden?: boolean }) { const channels = useInfiniteQuery(channelListQueryOptions()); const delegating = useQuery(delegatingConversationsQueryOptions()).data ?? NONE_DELEGATING; - const [search, setSearch] = useState(""); - const debouncedSearch = useDebounced(search, SEARCH_DEBOUNCE_MS); const scrollRoot = useRef(null); - const term = normalizeChannelSearch(search); - const debouncedTerm = normalizeChannelSearch(debouncedSearch); - const searching = term.length > 0; - const searchable = isChannelSearchable(term); - /* - * WHILE SEARCHING, THE ROSTER IS NOT ON SCREEN. Its rows and its pagination unmount, so nothing - * pages through recent history looking for a match: the server searches all of it. Clearing the - * box puts the roster back as it was, scrolled where it was. - */ - const rosterScroll = useRef(null); - const changeSearch = (value: string) => { - if (!searching && normalizeChannelSearch(value)) { - rosterScroll.current = scrollRoot.current?.scrollTop ?? 0; - } - setSearch(value); - }; - useLayoutEffect(() => { - if (searching || rosterScroll.current === null || !scrollRoot.current) { - return; - } - scrollRoot.current.scrollTop = rosterScroll.current; - rosterScroll.current = null; - }, [searching]); const visibleChannels = pinnedFirst(channels.data ?? []); + const pinned = visibleChannels.filter((channel) => channel.pinned); + const recents = visibleChannels.filter((channel) => !channel.pinned); const animateOrder = (channels.data?.length ?? 0) <= MAX_ANIMATED_ROWS; + const rows = { animateOrder, emphasis, view, delegating }; return (