Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/src/components/app-sidebar/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ export {
isUnread,
matchingChannels,
pinnedFirst,
SEARCH_DEBOUNCE_MS,
SEARCH_HINT,
SEARCH_SCOPE,
} from "./conversations-panel";

/**
Expand Down
2 changes: 2 additions & 0 deletions app/src/components/app-sidebar/bots-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -172,6 +173,7 @@ function BotConversations({
{pinnedFirst(conversations.data).map((channel) => (
<Channel
busy={isWorking(channel, delegating)}
status={workStatus(channel, delegating) ?? undefined}
canRename={channel.canRename ?? false}
channelId={channel.id}
data-slot="bot-conversation-row"
Expand Down
56 changes: 43 additions & 13 deletions app/src/components/app-sidebar/channel-item-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ import type { MessageListEmphasis } from "@/lib/settings/message-list";
/**
* Shared by live conversations and the appearance preference previews.
*
* `view` picks the row's shape. Detailed (the default here) is two lines: the Bot's name, its time
* and marks, then the title. Compact is one line, as Claude's sidebar lists chats: a small avatar
* and the title, then the time, the unread dot and the pin at the right. It draws no Bot name, and
* says it to a screen reader.
* `view` picks the row's shape. Detailed (the default here) is two lines: the Bot's name and its
* marks, then the title. Compact is one line, as Claude's sidebar lists chats: a small avatar and
* the title, then the unread dot and the pin at the right. It draws no Bot name, and says it to a
* screen reader.
*
* While its Bot works, the row says what the Bot is doing at the right, in place of the age and in
* the age's muted style: `status`, or "Working" while `busy`. No line is added, so a row keeps its
* height when a Bot starts or stops and the rows under it don't move.
*
* The age (the time since the conversation was last used) shows while the pointer is on the row or
* the row has keyboard focus (`group/row` on the row's link). Where there is no hover, a touch
* screen or the narrow window's sheet, it shows at rest. A screen reader always reads it.
*/
export function ChannelItemContent({
participantIds,
Expand All @@ -19,6 +27,7 @@ export function ChannelItemContent({
lastMessageAt,
emphasis,
busy = false,
status,
unread = false,
pinned = false,
revealing = false,
Expand All @@ -32,6 +41,8 @@ export function ChannelItemContent({
lastMessageAt?: string;
emphasis: MessageListEmphasis;
busy?: boolean;
/** What the Bot is doing, said in place of the age. "Working" while `busy` if not given. */
status?: string;
unread?: boolean;
pinned?: boolean;
revealing?: boolean;
Expand All @@ -52,18 +63,37 @@ export function ChannelItemContent({
/>
) : 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 with a mouse it waits for the pointer or the
* keyboard. A touch screen (`pointer-coarse`) and the sheet below 768px (`max-md`) have no hover,
* so there it shows at rest. Out of sight it stays readable to a screen reader (`sr-only`).
*
* While the Bot works, its status takes the age's place, muted like the age and always shown. The
* age is then only said, not drawn.
*/
const time = busy ? (
<span className="shrink-0 whitespace-nowrap font-medium text-[12px] text-success leading-4">
Working
</span>
) : (
<span className="shrink-0 whitespace-nowrap text-[12px] leading-4 text-muted-foreground/70">
const statusText = status ?? (busy ? "Working" : undefined);
const time = statusText ? (
<>
<span
className="min-w-0 max-w-2/5 shrink truncate whitespace-nowrap text-[12px] leading-4 text-muted-foreground"
data-slot="status"
title={statusText}
>
{statusText}
</span>
{lastMessageAt ? (
<span className="sr-only" data-slot="last-used">
{lastMessageAt}
</span>
) : null}
</>
) : lastMessageAt ? (
<span
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"
data-slot="last-used"
>
{lastMessageAt}
</span>
);
) : null;
const caret = revealing ? (
<span className="ml-0.5 inline-block h-3 w-px translate-y-px bg-foreground/70 align-middle" />
) : null;
Expand Down
7 changes: 6 additions & 1 deletion app/src/components/app-sidebar/channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const Channel = memo(function Channel({
canRename,
unread,
busy,
status,
emphasis,
view = "detailed",
avatar = true,
Expand All @@ -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 in place of its age. See `ChannelItemContent`. */
status?: string;
emphasis: MessageListEmphasis;
/** One line or two: see `ChannelItemContent`. */
view?: ConversationView;
Expand Down Expand Up @@ -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`: with a mouse, 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]",
Expand All @@ -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}
Expand Down
Loading
Loading