Skip to content

Commit bd53ec8

Browse files
committed
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 a100bd3 commit bd53ec8

7 files changed

Lines changed: 82 additions & 60 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged.
6262
the Conversations panel has New conversation (⇧N), Search (⌘K) and Artifacts. Search opens the
6363
command palette, which searches every conversation, so the search box in the panel is gone.
6464
Pinned conversations sit under Pinned, the rest under Recents. While a Bot works, its
65-
conversation says so on a muted line under the title, such as "Working" or "Waiting on Research
66-
Bot". How long ago a conversation was used shows when you point at it.
65+
conversation says so at the right, where the age goes, such as "Working" or "Waiting on Research
66+
Bot", and the row keeps its height. With a mouse, how long ago a conversation was used shows when
67+
you point at it. On a touch screen and in a narrow window it always shows.
6768

6869
## 1.2.7
6970

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

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ import type { MessageListEmphasis } from "@/lib/settings/message-list";
1111
* the title, then the unread dot and the pin at the right. It draws no Bot name, and says it to a
1212
* screen reader.
1313
*
14-
* While its Bot works, a row gets one more line under its text: the Bot's live status, muted, as
15-
* the Grok Bot app lists a Bot under its name. The status is `status`, or "Working" while `busy`.
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.
1617
*
17-
* The time since the conversation was last used shows only while the pointer is on the row or the
18-
* row has keyboard focus (`group/row` on the row's link). At rest a screen reader still reads it.
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.
1921
*/
2022
export function ChannelItemContent({
2123
participantIds,
@@ -39,7 +41,7 @@ export function ChannelItemContent({
3941
lastMessageAt?: string;
4042
emphasis: MessageListEmphasis;
4143
busy?: boolean;
42-
/** What the Bot is doing, said under the row's text. "Working" while `busy` if not given. */
44+
/** What the Bot is doing, said in place of the age. "Working" while `busy` if not given. */
4345
status?: string;
4446
unread?: boolean;
4547
pinned?: boolean;
@@ -61,31 +63,37 @@ export function ChannelItemContent({
6163
/>
6264
) : null;
6365
/*
64-
* The age is for the row a person is looking at, so it waits for the pointer or the keyboard. Out
65-
* of sight it stays in the accessibility tree (`sr-only`), so a screen reader still says it.
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.
6672
*/
67-
const time = lastMessageAt ? (
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 ? (
6890
<span
69-
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"
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"
7092
data-slot="last-used"
7193
>
7294
{lastMessageAt}
7395
</span>
7496
) : null;
75-
/*
76-
* The Bot's live state, a muted line of its own under the text. The orb moves as well, so the
77-
* line stays quiet: no color, no weight.
78-
*/
79-
const statusText = status ?? (busy ? "Working" : undefined);
80-
const statusLine = statusText ? (
81-
<div
82-
className="mt-px truncate text-[12px] leading-4 text-muted-foreground"
83-
data-slot="status"
84-
title={statusText}
85-
>
86-
{statusText}
87-
</div>
88-
) : null;
8997
const caret = revealing ? (
9098
<span className="ml-0.5 inline-block h-3 w-px translate-y-px bg-foreground/70 align-middle" />
9199
) : null;
@@ -109,16 +117,13 @@ export function ChannelItemContent({
109117
{avatar ? (
110118
<span className="sr-only" data-slot="bot-name">{`${name}, `}</span>
111119
) : null}
112-
<div className="min-w-0 flex-1">
113-
<div
114-
className={`truncate text-sm leading-5 tracking-[-1%] ${unread ? "font-semibold" : "font-normal"}`}
115-
title={title}
116-
>
117-
{displayedTitle}
118-
{caret}
119-
</div>
120-
{statusLine}
121-
</div>
120+
<span
121+
className={`min-w-0 flex-1 truncate text-sm leading-5 tracking-[-1%] ${unread ? "font-semibold" : "font-normal"}`}
122+
title={title}
123+
>
124+
{displayedTitle}
125+
{caret}
126+
</span>
122127
{time}
123128
{unreadDot}
124129
{pin}
@@ -157,7 +162,6 @@ export function ChannelItemContent({
157162
{displayedTitle}
158163
{caret}
159164
</div>
160-
{statusLine}
161165
</div>
162166
</div>
163167
);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const Channel = memo(function Channel({
6161
canRename: boolean;
6262
unread: boolean;
6363
busy: boolean;
64-
/** What its Bot is doing while it works, said under the row's text. See `ChannelItemContent`. */
64+
/** What its Bot is doing while it works, said in place of its age. See `ChannelItemContent`. */
6565
status?: string;
6666
emphasis: MessageListEmphasis;
6767
/** One line or two: see `ChannelItemContent`. */
@@ -111,7 +111,7 @@ export const Channel = memo(function Channel({
111111
data-slot={slot}
112112
type="button"
113113
className={cn(
114-
// `group/row`: the row's age shows while the pointer or the keyboard is on it.
114+
// `group/row`: with a mouse, the row's age shows while the pointer or the keyboard is on it.
115115
"group/row flex flex-row px-2.5 gap-2 items-center w-full hover:bg-foreground/5 rounded-lg [content-visibility:auto]",
116116
view === "compact"
117117
? "py-1.5 [contain-intrinsic-size:auto_2rem]"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export function isWorking(
126126
}
127127

128128
/**
129-
* What a working conversation's row says under its text, from what the roster already knows: a turn
129+
* What a working conversation's row says in place of its age, from what the roster already knows: a turn
130130
* running says Working, a Bot it asked and waits on is named, a routine firing into it says so, and
131131
* work handed out to a task still under way says Working. Null while nothing is under way.
132132
*/

‎app/tests/channel-item-working.test.tsx‎

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import { agentListQueryOptions } from "@/lib/agents/queries";
77
import { settleReactWork } from "./settle-react-work";
88

99
/**
10-
* While its Bot works, a conversation in the sidebar says what the Bot is doing on a muted line of
11-
* its own under the row's text, as the Grok Bot app lists a Bot's live status under its name. The
12-
* row's age waits for the pointer or the keyboard, and a screen reader reads it all the time.
10+
* While its Bot works, a conversation in the sidebar says what the Bot is doing at the right, in
11+
* place of its age, with no line added: the row keeps its height when work starts or stops. With a
12+
* mouse the age waits for the pointer or the keyboard; on touch and in the narrow sheet it shows at
13+
* rest; a screen reader reads it all the time.
1314
*/
1415

1516
beforeAll(() => GlobalRegistrator.register());
@@ -39,11 +40,15 @@ function row(busy: boolean, status?: string) {
3940
);
4041
}
4142

42-
test("a conversation whose Bot is working says Working on a line under its text", () => {
43+
test("a conversation whose Bot is working says Working where its age goes", () => {
4344
const view = row(true);
4445
const status = view.container.querySelector("[data-slot=status]");
4546
expect(status?.textContent).toBe("Working");
4647
expect(status?.className).toContain("text-muted-foreground");
48+
// On the name's line, at its right: no line of its own.
49+
expect(status?.parentElement?.textContent).toContain("Personal Assistant");
50+
// The age is still said, not drawn.
51+
expect(view.getByText("2m").className).toBe("sr-only");
4752
});
4853

4954
test("a row says the status it is given, such as the Bot it waits on", () => {
@@ -52,19 +57,31 @@ test("a row says the status it is given, such as the Bot it waits on", () => {
5257
expect(view.queryByText("Working")).toBeNull();
5358
});
5459

55-
test("once the Bot is done, the status line goes", () => {
60+
test("a row has as many lines working as idle", () => {
61+
// The lines of the row's text column: the name's line and the title's.
62+
const lines = (busy: boolean) => {
63+
const view = row(busy);
64+
const count =
65+
view.getByText("Plan the trip").parentElement?.childElementCount;
66+
cleanup();
67+
return count;
68+
};
69+
expect(lines(false)).toBe(2);
70+
expect(lines(true)).toBe(2);
71+
});
72+
73+
test("once the Bot is done, the age comes back and the status goes", () => {
5674
const view = row(false);
5775
expect(view.container.querySelector("[data-slot=status]")).toBeNull();
76+
expect(view.getByText("2m")).toBeTruthy();
5877
});
5978

60-
test("the age shows on hover or keyboard focus, and a screen reader always reads it", () => {
61-
for (const busy of [false, true]) {
62-
const view = row(busy);
63-
const age = view.getByText("2m");
64-
const names = age.className.split(" ");
65-
expect(names).toContain("sr-only");
66-
expect(names).toContain("group-hover/row:not-sr-only");
67-
expect(names).toContain("group-focus-visible/row:not-sr-only");
68-
cleanup();
69-
}
79+
test("the age shows on hover or focus with a mouse, and at rest on touch and in the narrow sheet", () => {
80+
const view = row(false);
81+
const names = view.getByText("2m").className.split(" ");
82+
expect(names).toContain("sr-only");
83+
expect(names).toContain("group-hover/row:not-sr-only");
84+
expect(names).toContain("group-focus-visible/row:not-sr-only");
85+
expect(names).toContain("pointer-coarse:not-sr-only");
86+
expect(names).toContain("max-md:not-sr-only");
7087
});

‎app/tests/channel-pagination.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ test("with nothing pinned there is no Pinned label, only Recents", async () => {
407407
expect(labels.map((label) => label.textContent)).toEqual(["Recents"]);
408408
});
409409

410-
test("a working conversation says what its Bot is doing on a line under its title", async () => {
410+
test("a working conversation says what its Bot is doing where its age goes", async () => {
411411
const view = renderSidebar(
412412
[
413413
{ ...channel("Busy conversation"), busy: true },

‎app/tests/compact-conversations.test.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ test("under its Bot in the Bots panel, a compact row does not say the Bot again"
123123
expect(view.container.querySelector("[data-slot=bot-name]")).toBeNull();
124124
});
125125

126-
test("while its Bot works, a compact row says so on a muted line under its title", () => {
126+
test("while its Bot works, a compact row says so where its time goes, and stays one line", () => {
127127
const view = compactRow({ busy: true });
128128
const status = view.container.querySelector("[data-slot=status]");
129129
expect(status?.textContent).toBe("Working");
130130
expect(status?.className).toContain("text-muted-foreground");
131-
// Under the title, in the same column, not at the right where the time goes.
132-
expect(status?.previousElementSibling?.textContent).toBe(
133-
"Trip budget for Lisbon",
134-
);
131+
// Beside the title on its one line, not under it.
132+
const title = view.getByText("Trip budget for Lisbon");
133+
expect(status?.parentElement).toBe(title.parentElement);
134+
expect(view.getByText("2m").className).toBe("sr-only");
135135
const idle = compactRow({ busy: false });
136136
expect(idle.container.querySelector("[data-slot=status]")).toBeNull();
137137
});

0 commit comments

Comments
 (0)