Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

sidebar: make the open conversation read at a glance

wayne60c2eb0d7967
diff --git a/src/components/Sidebar.simple-mode.test.ts b/src/components/Sidebar.simple-mode.test.ts
index d7830ccc9c..a994316bf8 100644
--- a/src/components/Sidebar.simple-mode.test.ts
+++ b/src/components/Sidebar.simple-mode.test.ts
@@ -243,7 +243,7 @@ describe("bot-first sidebar", () => {
fixture.state = { ...fixture.state, selectedId: bot.id, activeView: "chat" };
const candidate = { ...bot, tasks: [], projects: [] };
const simple = renderToStaticMarkup(createElement(BotListItem, rowProps("comfortable", candidate)));
- expect(simple).toContain("[--row:var(--color-raised)]");
+ expect(simple).toContain("[--row:color-mix(in_srgb,var(--color-accent)_15%,var(--color-panel))]");
expect(simple).toMatch(/data-bot-actions="atlas"[^>]*class="[^"]*\bpointer-events-none opacity-0 group-hover:pointer-events-auto/);
expect(simple).toContain('class="flex items-baseline justify-between gap-2 pr-7"');
fixture.advanced = true;
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 746a402e2b..13d519cb28 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -91,7 +91,7 @@ import { attentionHasRunningWork, attentionJumpAction, attentionUnpinAction, cro
import { SidebarNoBots, SidebarTileGrid } from "./SidebarTiles";
import { BotContextMenu } from "./SidebarBotMenu";
export { BotContextMenu };
-import { AvatarActivityDot, RowDot, RowStatusText, rowSurface } from "./SidebarRowMarkers";
+import { AvatarActivityDot, RowDot, RowStatusText, rowSelectedSurface, rowSurface } from "./SidebarRowMarkers";
import { SidebarAttentionPanel } from "./SidebarAttentionPanel";
@@ -189,14 +189,12 @@ export const GroupListItem = memo(function GroupListItem({
"relative flex w-full items-center rounded-md text-left", SIMPLE_ROW_FOCUS,
density === "icons" ? (railTile ? "h-[54px] justify-center" : "justify-center px-1 py-1.5") : simpleRow
? cn("gap-2 rounded-[8px] py-2 pr-2 group-hover:pr-9 group-focus-within:pr-9 max-md:pr-9 touch:pr-9 md:h-[54px] md:py-0", !group.dm && hasThreadList ? "pl-6" : "pl-2") : "gap-2 py-1.5 pl-6 pr-9",
- selected && !expanded ? "bg-raised" : "hover:bg-raised/50",
+ selected && !expanded ? rowSelectedSurface : "hover:bg-raised/50",
)}
title={density === "icons" ? group.name : undefined}
aria-label={density === "icons" ? group.name : undefined}
>
- <span className={cn("rounded-full", selected && !expanded && "ring-2 ring-accent/70 ring-offset-2 ring-offset-panel")}>
- {group.dm ? <StackedMauses members={members} density={railTile ? "comfortable" : density} large={simpleRow || railTile} /> : <RoomMark density={railTile ? "comfortable" : density} large={simpleRow || railTile} />}
- </span>
+ <span className={cn("rounded-full", selected && !expanded && "ring-2 ring-accent/70 ring-offset-2 ring-offset-panel")}>{group.dm ? <StackedMauses members={members} density={railTile ? "comfortable" : density} large={simpleRow || railTile} /> : <RoomMark density={railTile ? "comfortable" : density} large={simpleRow || railTile} />}</span>
<div className={cn("min-w-0 flex-1", density === "icons" && "hidden")}>
<div className={cn("flex items-baseline justify-between gap-2", simpleRow && "pr-7")}>
<span className={cn("truncate text-[14px] text-ink", simpleRow ? "font-medium leading-5" : "font-semibold")}>{group.name}</span>
@@ -727,7 +725,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {
: simpleRow ? "gap-2 rounded-[8px] py-2 pl-2 pr-2 md:h-[54px] md:py-0"
: cn(showThreads ? "gap-2 py-2" : "gap-3 py-2", showThreads ? "pl-6 pr-9 group-hover:pr-[5.75rem] group-focus-within:pr-[5.75rem] max-md:pr-9 touch:pr-[5.75rem]" : "pl-2.5 pr-9"),
!iconOnly && "max-md:rounded-2xl max-md:py-2.5",
- selected ? "bg-raised" : "hover:bg-raised/50",
+ selected ? rowSelectedSurface : "hover:bg-raised/50",
simpleRow && rowSurface(selected),
);
const { waiting, working, teammateWait, queued } = sidebarBotStatus(bot, pendingQueued);
diff --git a/src/components/SidebarBotActivity.tsx b/src/components/SidebarBotActivity.tsx
index d86e2cfc36..a319861b2f 100644
--- a/src/components/SidebarBotActivity.tsx
+++ b/src/components/SidebarBotActivity.tsx
@@ -7,6 +7,7 @@ import { t } from "@/lib/i18n";
import { isArchived, orderedSidebarThreads, orderedThreadList, threadRecency, threadUpdatedLabel } from "./SidebarThreadRow";
import type { SidebarDensity } from "@/lib/sidebar-preferences";
import { localizedTaskTitle } from "@/lib/task-title";
+import { rowSelectedSurface } from "./SidebarRowMarkers";
export function sidebarBotActivityTasks(bot: Bot, queued: Record<string, unknown[]>, archivedApprovals = false): Array<Task & { queued: boolean }> {
const tasks = bot.tasks ?? [{
@@ -72,6 +73,20 @@ export type AttentionThread =
| { kind: "bot"; botId: string; botName: string; task: Task & { queued: boolean } }
| { kind: "group"; groupId: string; groupName: string; groupThreadId: string; task: Task & { queued: boolean } };
+/** The conversation the chat window has open, matched against the rows these lists render. */
+export type OpenThread =
+ | { kind: "bot"; botId: string; threadId: string }
+ | { kind: "group"; groupId: string; threadId: string };
+
+export function isOpenThread(entry: AttentionThread, open: OpenThread | undefined): boolean {
+ if (!open || entry.task.threadId !== open.threadId) return false;
+ if (entry.kind === "bot") return open.kind === "bot" && entry.botId === open.botId;
+ return open.kind === "group" && entry.groupId === open.groupId;
+}
+
+/** LOCAL: the row of the conversation the chat window has open. A tint, a left accent bar and an inset outline read as one mark at a glance. */
+export const openThreadRow = rowSelectedSurface;
+
export function attentionOwnerName(entry: AttentionThread): string {
return entry.kind === "bot" ? entry.botName : entry.groupName;
}
@@ -156,20 +171,30 @@ export function crossBotPinnedThreads(bots: Bot[], groups: Group[], queued: Reco
: { kind: "bot", botId: botId!, botName: botName!, task });
}
-export function AttentionThreadRows({ entries, onJump, inset = false }: { entries: AttentionThread[]; onJump: (entry: AttentionThread) => void; inset?: boolean }) {
+export function AttentionThreadRows({ entries, onJump, inset = false, unreadDot = false, current }: {
+ entries: AttentionThread[]; onJump: (entry: AttentionThread) => void; inset?: boolean;
+ /** LOCAL: mark an unread conversation with a dot and a heavier title, the way the Inbox's own rows are marked. */
+ unreadDot?: boolean;
+ /** LOCAL: the conversation the chat window has open, tinted like a selected sidebar row. */
+ current?: OpenThread;
+}) {
return <>
{entries.map((entry) => {
const { Icon, colorClass, label: status } = attentionRowStatus(entry.task);
const name = attentionOwnerName(entry);
const label = t("attention.item", { title: entry.task.title, name, status });
+ const unread = unreadDot && entry.task.unread === true;
+ const open = isOpenThread(entry, current);
return <button key={`${entry.kind}-${entry.kind === "bot" ? entry.botId : entry.groupId}-${entry.task.threadId}`} type="button" aria-label={label} title={label}
+ aria-current={open ? "page" : undefined} data-open-thread={open || undefined}
onClick={() => onJump(entry)}
- className={cn("flex w-full items-center gap-2.5 text-left text-[13px] text-ink hover:bg-menu-hover", inset ? "rounded-md px-2 py-1.5" : "px-3.5 py-2")}>
+ className={cn("flex w-full items-center gap-2.5 text-left text-[13px] text-ink hover:bg-menu-hover", inset ? "rounded-md px-2 py-1.5" : "px-3.5 py-2", open && openThreadRow)}>
<Icon size={inset ? 16 : 15} aria-hidden="true" className={cn("shrink-0", colorClass)} />
<span className="min-w-0 flex-1">
- <span className="block truncate">{entry.task.title}</span>
+ <span className={cn("block truncate", unread && "font-medium text-ink")}>{entry.task.title}</span>
<span className="block truncate text-[11px] text-ink-secondary">{name} · {status}</span>
</span>
+ {unread && <span data-attention-unread-dot aria-hidden="true" className="size-1.5 shrink-0 rounded-full bg-accent" />}
</button>;
})}
</>;
diff --git a/src/components/SidebarRowMarkers.tsx b/src/components/SidebarRowMarkers.tsx
index 991acb3c08..a2d78a7808 100644
--- a/src/components/SidebarRowMarkers.tsx
+++ b/src/components/SidebarRowMarkers.tsx
@@ -4,10 +4,14 @@ import { t } from "@/lib/i18n";
/** The colour behind a Simple row, which the status dot on its avatar is ring-cut against. */
export function rowSurface(selected: boolean): string {
return selected
- ? "[--row:var(--color-raised)]"
+ ? "[--row:color-mix(in_srgb,var(--color-accent)_15%,var(--color-panel))]"
: "[--row:var(--color-panel)] max-md:[--row:var(--color-app)] hover:[--row:color-mix(in_srgb,var(--color-raised)_50%,var(--color-panel))]";
}
+/** LOCAL: the conversation the chat window has open. A tint, a left accent bar and an inset outline, the same mark the Inbox
+ * uses, because `raised` sits only a shade away from `panel` on both the dark and the light skins. */
+export const rowSelectedSurface = "bg-accent/15 shadow-[inset_3px_0_0_0_var(--color-accent)] ring-1 ring-inset ring-accent/30 hover:bg-accent/20";
+
export type RowActivity = "working" | "teammate" | "queued";
const ACTIVITY = {
diff --git a/src/components/SidebarThreadRow.tsx b/src/components/SidebarThreadRow.tsx
index be7a43bcbe..f76b362273 100644
--- a/src/components/SidebarThreadRow.tsx
+++ b/src/components/SidebarThreadRow.tsx
@@ -18,6 +18,7 @@ import { threadLinkLabel } from "../../shared/thread-link";
import { isSnoozed, orderedThreadList } from "../../shared/wire";
import { Select } from "./Select";
import { WorkingTimer } from "./WorkingIndicator";
+import { rowSelectedSurface } from "./SidebarRowMarkers";
import { useHeldText } from "./SidebarWorkingStep";
import { localizedTaskTitle } from "@/lib/task-title";
import { ShareRowItems } from "./conversation-share/ShareRowItems";
@@ -341,7 +342,7 @@ export const SidebarThreadRow = memo(function SidebarThreadRow({ task, ownerId,
)}
</span>;
return <>
- <div className={cn("group/thread relative flex min-w-0 items-center rounded-md", selectMode && checked ? "bg-accent/10" : current ? "bg-raised" : "hover:bg-raised/50", panel && cn("items-start rounded-[8px]", current ? "bg-ink/[0.07]" : "hover:bg-ink/[0.04]"))}>
+ <div className={cn("group/thread relative flex min-w-0 items-center rounded-md", selectMode && checked ? "bg-accent/10" : current ? rowSelectedSurface : "hover:bg-raised/50", panel && cn("items-start rounded-[8px]", current ? "bg-ink/[0.07]" : "hover:bg-ink/[0.04]"))}>
{renaming ? <input autoFocus value={draft} maxLength={80} aria-label={t("task.renameAria")}
onFocus={(event) => event.currentTarget.select()} onChange={(event) => setDraft(event.target.value)} onBlur={() => finishRename(true)}
onKeyDown={(event) => { if (imeComposing(event.nativeEvent)) { event.stopPropagation(); return; } if (event.key === "Enter") { event.preventDefault(); finishRename(true); } else if (event.key === "Escape") { event.preventDefault(); event.stopPropagation(); finishRename(false); } }}
diff --git a/src/components/SidebarTiles.test.ts b/src/components/SidebarTiles.test.ts
index 2c779ed42b..36be454336 100644
--- a/src/components/SidebarTiles.test.ts
+++ b/src/components/SidebarTiles.test.ts
@@ -62,7 +62,7 @@ describe("the sidebar tiles", () => {
it("fills the selected tile and marks it current, and shows working, waiting and unread as a dot on the avatar", () => {
const selected = renderToStaticMarkup(createElement(SidebarBotTile, { ...props(bot(), true), primary: true }));
expect(selected).toContain('aria-current="page"');
- expect(selected).toContain("[--tile:var(--color-raised)]");
+ expect(selected).toContain("[--tile:color-mix(in_srgb,var(--color-accent)_15%,var(--color-panel))]");
expect(renderToStaticMarkup(createElement(SidebarBotTile, props(bot({ busy: true }))))).toContain('data-testid="working-dot"');
expect(renderToStaticMarkup(createElement(SidebarBotTile, props(bot({ activity: "waiting-on-you" }))))).toContain('data-testid="waiting-dot"');
const unread = renderToStaticMarkup(createElement(SidebarBotTile, props(bot({ unread: true }))));
diff --git a/src/components/SidebarTiles.tsx b/src/components/SidebarTiles.tsx
index 514eb65b3c..cae2f54c6a 100644
--- a/src/components/SidebarTiles.tsx
+++ b/src/components/SidebarTiles.tsx
@@ -76,7 +76,7 @@ export const SidebarBotTile = memo(function SidebarBotTile({ primary = false, dr
onContextMenu={(event) => openBotContextMenu(onMenu, bot.id, event)}
className={cn(
"flex h-[92px] w-[78px] shrink-0 cursor-pointer flex-col items-center rounded-[8px] bg-[var(--tile)] px-1 pt-2 transition-colors duration-150", SIMPLE_ROW_FOCUS,
- selected ? "[--tile:var(--color-raised)]" : "[--tile:var(--color-panel)] hover:[--tile:color-mix(in_srgb,var(--color-raised)_50%,var(--color-panel))]",
+ selected ? "[--tile:color-mix(in_srgb,var(--color-accent)_15%,var(--color-panel))]" : "[--tile:var(--color-panel)] hover:[--tile:color-mix(in_srgb,var(--color-raised)_50%,var(--color-panel))]",
pinnedCircleDragClass({ drag, dragging, drop }),
)}
>