Skip to content

Commit 646a41d

Browse files
authored
Conversations panel: labeled New conversation and Search rows, Pinned and Recents, status in place of the age (#2696)
* Conversations panel: labeled New conversation and Search rows, Pinned and Recents, status under the title - 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 <Bot>" for a Bot it asked, or "Running a routine". Read from the fields the roster already has (busy, work, delegated tasks). No API change. * Conversation rows: status in place of the age, age at rest on touch - While a Bot works, its status ("Working", "Waiting on <Bot>", "Running a routine") sits at the right where the age goes, muted like the age, instead of a line of its own. A row keeps its height when work starts or stops, and Compact rows stay one line. - The age shows at rest on a touch screen (pointer-coarse) and in the narrow window's sheet (below 768px), where there is no hover. With a mouse it still waits for hover or focus.
1 parent 22d69b1 commit 646a41d

11 files changed

Lines changed: 341 additions & 477 deletions

‎app/src/components/app-sidebar/app-sidebar.tsx‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ export {
1313
isUnread,
1414
matchingChannels,
1515
pinnedFirst,
16-
SEARCH_DEBOUNCE_MS,
17-
SEARCH_HINT,
18-
SEARCH_SCOPE,
1916
} from "./conversations-panel";
2017

2118
/**

‎app/src/components/app-sidebar/bots-panel.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import {
5858
isWorking,
5959
NONE_DELEGATING,
6060
pinnedFirst,
61+
workStatus,
6162
} from "./conversations-panel";
6263

6364
/** 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({
172173
{pinnedFirst(conversations.data).map((channel) => (
173174
<Channel
174175
busy={isWorking(channel, delegating)}
176+
status={workStatus(channel, delegating) ?? undefined}
175177
canRename={channel.canRename ?? false}
176178
channelId={channel.id}
177179
data-slot="bot-conversation-row"

‎app/src/components/app-sidebar/channel-item-content.tsx‎

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ import type { MessageListEmphasis } from "@/lib/settings/message-list";
66
/**
77
* Shared by live conversations and the appearance preference previews.
88
*
9-
* `view` picks the row's shape. Detailed (the default here) is two lines: the Bot's name, its time
10-
* and marks, then the title. Compact is one line, as Claude's sidebar lists chats: a small avatar
11-
* and the title, then the time, the unread dot and the pin at the right. It draws no Bot name, and
12-
* says it to a screen reader.
9+
* `view` picks the row's shape. Detailed (the default here) is two lines: the Bot's name and its
10+
* marks, then the title. Compact is one line, as Claude's sidebar lists chats: a small avatar and
11+
* the title, then the unread dot and the pin at the right. It draws no Bot name, and says it to a
12+
* screen reader.
13+
*
14+
* While its Bot works, the row says what the Bot is doing at the right, in place of the age and in
15+
* the age's muted style: `status`, or "Working" while `busy`. No line is added, so a row keeps its
16+
* height when a Bot starts or stops and the rows under it don't move.
17+
*
18+
* The age (the time since the conversation was last used) shows while the pointer is on the row or
19+
* the row has keyboard focus (`group/row` on the row's link). Where there is no hover, a touch
20+
* screen or the narrow window's sheet, it shows at rest. A screen reader always reads it.
1321
*/
1422
export function ChannelItemContent({
1523
participantIds,
@@ -19,6 +27,7 @@ export function ChannelItemContent({
1927
lastMessageAt,
2028
emphasis,
2129
busy = false,
30+
status,
2231
unread = false,
2332
pinned = false,
2433
revealing = false,
@@ -32,6 +41,8 @@ export function ChannelItemContent({
3241
lastMessageAt?: string;
3342
emphasis: MessageListEmphasis;
3443
busy?: boolean;
44+
/** What the Bot is doing, said in place of the age. "Working" while `busy` if not given. */
45+
status?: string;
3546
unread?: boolean;
3647
pinned?: boolean;
3748
revealing?: boolean;
@@ -52,18 +63,37 @@ export function ChannelItemContent({
5263
/>
5364
) : null;
5465
/*
55-
* While a Bot works on it, the row says so where its time goes, in the scheme's color for what is
56-
* working: said as well as shown by the orb, and the time is news only once the work is done.
66+
* The age is for the row a person is looking at, so with a mouse it waits for the pointer or the
67+
* keyboard. A touch screen (`pointer-coarse`) and the sheet below 768px (`max-md`) have no hover,
68+
* so there it shows at rest. Out of sight it stays readable to a screen reader (`sr-only`).
69+
*
70+
* While the Bot works, its status takes the age's place, muted like the age and always shown. The
71+
* age is then only said, not drawn.
5772
*/
58-
const time = busy ? (
59-
<span className="shrink-0 whitespace-nowrap font-medium text-[12px] text-success leading-4">
60-
Working
61-
</span>
62-
) : (
63-
<span className="shrink-0 whitespace-nowrap text-[12px] leading-4 text-muted-foreground/70">
73+
const statusText = status ?? (busy ? "Working" : undefined);
74+
const time = statusText ? (
75+
<>
76+
<span
77+
className="min-w-0 max-w-2/5 shrink truncate whitespace-nowrap text-[12px] leading-4 text-muted-foreground"
78+
data-slot="status"
79+
title={statusText}
80+
>
81+
{statusText}
82+
</span>
83+
{lastMessageAt ? (
84+
<span className="sr-only" data-slot="last-used">
85+
{lastMessageAt}
86+
</span>
87+
) : null}
88+
</>
89+
) : lastMessageAt ? (
90+
<span
91+
className="sr-only shrink-0 whitespace-nowrap text-[12px] leading-4 text-muted-foreground/70 group-hover/row:not-sr-only group-focus-visible/row:not-sr-only pointer-coarse:not-sr-only max-md:not-sr-only"
92+
data-slot="last-used"
93+
>
6494
{lastMessageAt}
6595
</span>
66-
);
96+
) : null;
6797
const caret = revealing ? (
6898
<span className="ml-0.5 inline-block h-3 w-px translate-y-px bg-foreground/70 align-middle" />
6999
) : null;

‎app/src/components/app-sidebar/channel.tsx‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const Channel = memo(function Channel({
4242
canRename,
4343
unread,
4444
busy,
45+
status,
4546
emphasis,
4647
view = "detailed",
4748
avatar = true,
@@ -60,6 +61,8 @@ export const Channel = memo(function Channel({
6061
canRename: boolean;
6162
unread: boolean;
6263
busy: boolean;
64+
/** What its Bot is doing while it works, said in place of its age. See `ChannelItemContent`. */
65+
status?: string;
6366
emphasis: MessageListEmphasis;
6467
/** One line or two: see `ChannelItemContent`. */
6568
view?: ConversationView;
@@ -108,7 +111,8 @@ export const Channel = memo(function Channel({
108111
data-slot={slot}
109112
type="button"
110113
className={cn(
111-
"flex flex-row px-2.5 gap-2 items-center w-full hover:bg-foreground/5 rounded-lg [content-visibility:auto]",
114+
// `group/row`: with a mouse, the row's age shows while the pointer or the keyboard is on it.
115+
"group/row flex flex-row px-2.5 gap-2 items-center w-full hover:bg-foreground/5 rounded-lg [content-visibility:auto]",
112116
view === "compact"
113117
? "py-1.5 [contain-intrinsic-size:auto_2rem]"
114118
: "py-2 [contain-intrinsic-size:auto_3.25rem]",
@@ -125,6 +129,7 @@ export const Channel = memo(function Channel({
125129
lastMessageAt={lastMessageAt}
126130
emphasis={emphasis}
127131
busy={busy}
132+
status={status}
128133
unread={unread}
129134
pinned={pinned}
130135
revealing={revealed.typing}

0 commit comments

Comments
 (0)