Skip to content

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

Sidebar and bot badge polish from #5978: hover-only chevron, faded last line, aligned row dot

milind-soni3f996b3e09da
diff --git a/src/components/ChatHeadPill.test.ts b/src/components/ChatHeadPill.test.ts
index fd6830e84d..185cdc9fa5 100644
--- a/src/components/ChatHeadPill.test.ts
+++ b/src/components/ChatHeadPill.test.ts
@@ -28,3 +28,9 @@ it("names it too from another conversation's list, in the person's language", ()
const away = { ...bot("main"), mainThreadId: "elsewhere", tasks: [...bot("main").tasks!, { threadId: "elsewhere", title: "Other", createdAt: 3 }] } as Bot;
expect(pill(away, { kind: "shared", team: "Acme" })).toContain("Shared chat");
});
+
+it("keeps the chevron hidden until the pill is hovered or focused", () => {
+ const chevron = pill(bot("main"), null).match(/<span[^>]*data-chathead-chevron[^>]*>/)![0];
+ const classes = chevron.match(/class="([^"]*)"/)![1]!.split(" ");
+ expect(classes).toEqual(expect.arrayContaining(["w-0", "opacity-0", "group-hover:opacity-100", "group-focus-visible:opacity-100"]));
+});
diff --git a/src/components/ChatHeadPill.tsx b/src/components/ChatHeadPill.tsx
index 425286aa9c..020bec3250 100644
--- a/src/components/ChatHeadPill.tsx
+++ b/src/components/ChatHeadPill.tsx
@@ -77,8 +77,9 @@ export function ChatHeadPill({ bot, avatar, privacy, onToggle }: {
<span role="img" data-chathead-elsewhere aria-label={t("task.otherActivity", { count: elsewhere })} className="size-1.5 shrink-0 rounded-full bg-accent" />
)}
{!open && !conversation && (
- <span aria-hidden="true" data-chathead-chevron className="-ml-0.5 flex shrink-0">
- <ChevronRight size={12} className={cn("shrink-0 text-ink-tertiary transition-transform group-hover:translate-x-0.5 group-focus-visible:translate-x-0.5", CHEVRON_MOTION)} />
+ // Hidden at rest and folded into the gap, so the pill stays tight; it slides in on hover or keyboard focus.
+ <span aria-hidden="true" data-chathead-chevron className={cn("-ml-2 flex w-0 shrink-0 overflow-hidden opacity-0 transition-[width,margin,opacity] group-hover:-ml-0.5 group-hover:w-3 group-hover:opacity-100 group-focus-visible:-ml-0.5 group-focus-visible:w-3 group-focus-visible:opacity-100", CHEVRON_MOTION)}>
+ <ChevronRight size={12} className="shrink-0 text-ink-tertiary" />
</span>
)}
</button>
diff --git a/src/components/FadeLine.tsx b/src/components/FadeLine.tsx
new file mode 100644
index 0000000000..b3eb6222ae
--- /dev/null
+++ b/src/components/FadeLine.tsx
@@ -0,0 +1,20 @@
+import { useLayoutEffect, useRef, useState, type ReactNode } from "react";
+
+import { cn } from "@/lib/cn";
+
+/** One line that fades over its last 28px when it is cut off (mirrored for right-to-left text); a line that fits is untouched. */
+export function FadeLine({ children }: { children: ReactNode }) {
+ const ref = useRef<HTMLSpanElement>(null);
+ const [clipped, setClipped] = useState(false);
+ useLayoutEffect(() => {
+ const element = ref.current;
+ if (!element) return;
+ const measure = () => setClipped(element.scrollWidth > element.clientWidth + 1);
+ measure();
+ if (typeof ResizeObserver === "undefined") return;
+ const observer = new ResizeObserver(measure);
+ observer.observe(element);
+ return () => observer.disconnect();
+ }, [children]);
+ return <span ref={ref} dir="auto" className={cn("min-w-0 overflow-hidden whitespace-nowrap", clipped && "fade-end")}>{children}</span>;
+}
diff --git a/src/components/Sidebar.simple-mode.test.ts b/src/components/Sidebar.simple-mode.test.ts
index ef2202591e..1e3fc59017 100644
--- a/src/components/Sidebar.simple-mode.test.ts
+++ b/src/components/Sidebar.simple-mode.test.ts
@@ -158,13 +158,13 @@ describe("bot-first sidebar", () => {
expect(line).toMatch(/^>Done\.<\/span><\/span><span data-testid="model-badge" role="img" aria-label="Model: [^"]+ \(Claude\)" class="[^"]*\bms-auto\b[^"]*"><span data-provider-mark="brand" class="[^"]*\bopacity-60\b/);
expect(line).toMatch(/^>Done\.<\/span><\/span><span data-testid="model-badge"[^>]*><span data-provider-mark="brand"[^>]*><svg[\s\S]*?<\/svg><\/span><\/span><\/div><span class="sr-only">Unread<\/span>/);
const name = markup.slice(markup.indexOf('class="flex items-baseline justify-between gap-2 pr-7"'), markup.indexOf(">Done.<"));
- expect(name).toMatch(/<span aria-hidden="true" data-row-dot="" class="pointer-events-none absolute right-2 top-1 flex size-7 items-center justify-center transition-opacity group-hover:opacity-0 group-focus-within:opacity-0 touch:opacity-0 max-md:hidden"><span data-testid="unread-dot" title="Unread" class="size-2 shrink-0 rounded-full bg-accent"><\/span><\/span>/);
+ expect(name).toMatch(/<span aria-hidden="true" data-row-dot="" class="pointer-events-none absolute right-\[3px\] top-1\.5 flex size-6 items-center justify-center transition-opacity group-hover:opacity-0 group-focus-within:opacity-0 touch:opacity-0 max-md:hidden"><span data-testid="unread-dot" title="Unread" class="size-2 shrink-0 rounded-full bg-accent"><\/span><\/span>/);
expect(name).toContain('<span aria-hidden="true" title="Unread" class="size-2 shrink-0 rounded-full bg-accent hidden self-center max-md:block touch:block"></span>');
expect(markup.match(/data-provider-mark=/g)).toHaveLength(1);
expect(line.slice(0, line.indexOf("data-provider-mark"))).not.toContain("title=");
expect(String(findElement(tree, "data-sidebar-bot-row", bot.id)!.props.className)).not.toContain("group-hover:pr-9");
expect(markup).not.toContain("group-hover:pr-7");
- expect(markup).toMatch(/data-bot-actions="atlas"[^>]*class="[^"]*\bright-2 top-1 translate-y-0\b/);
+ expect(markup).toMatch(/data-bot-actions="atlas"[^>]*class="[^"]*right-\[3px\] top-1\.5 size-6 translate-y-0\b/);
});
it("fades the collapsed rail's engine badge in both modes", () => {
@@ -320,7 +320,7 @@ describe("bot-first sidebar", () => {
expect(queuedDot).toContain("bg-ink-secondary");
expect(queuedDot).not.toContain("size-4");
expect(queuedDot).not.toContain("size-5");
- expect(markup).toContain('class="truncate">Queued</span>');
+ expect(markup).toContain('class="min-w-0 overflow-hidden whitespace-nowrap">Queued</span>');
expect(markup).not.toContain("font-semibold text-warning");
expect(markup).not.toContain("waiting-dot");
});
diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 38a8bc5e83..d13ccfa834 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -6,7 +6,7 @@ import { sidebarState } from "./sidebar-state"; import { sameFields, useStoreDis
import { api, formatTime, visibleMessages, currentTaskBot, botOpensTo, openBot, openThread, type Action, type AppState, type Bot, type BotProject, type Group, type InstanceInfo, type Message } from "@/state/store";
import { approvalModeFor } from "../../shared/approval-mode";
import { liveActivityLabel, sidebarMessage } from "@/lib/live-activity";
-import { SidebarWorkingStep } from "./SidebarWorkingStep";
+import { SidebarWorkingStep } from "./SidebarWorkingStep"; import { FadeLine } from "./FadeLine";
import { openBotRow } from "@/state/thread-navigation";
import { llmThreadTitlesEnabled } from "@/lib/feature-flags";
@@ -832,7 +832,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {
{working ? (
<SidebarWorkingStep bot={bot} last={last} />
) : (
- <span dir="auto" className="truncate">{waiting ? t("sidebar.preview.waiting") : teammateWait ? t("sidebar.preview.waitingOnTeammate") : queued ? t("task.queued") : botPreview(bot, visible, instances, advanced)}</span>
+ <FadeLine>{waiting ? t("sidebar.preview.waiting") : teammateWait ? t("sidebar.preview.waitingOnTeammate") : queued ? t("task.queued") : botPreview(bot, visible, instances, advanced)}</FadeLine>
)}
</span>
)}
@@ -903,7 +903,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {
{showThreads && <button type="button" aria-label={t("folder.newNamed", { name: bot.name })} title={t("folder.new")} onClick={() => { setThreadsOpen(true); setCreatingProject(true); }}
className="pointer-events-none absolute right-8 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded text-ink-secondary opacity-0 hover:bg-raised hover:text-ink group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 max-md:hidden touch:pointer-events-auto touch:opacity-70"><FolderPlus size={14} /></button>}
<button type="button" data-bot-actions={bot.id} aria-label={t("sidebar.bot.actions", { name: bot.name })} title={t("sidebar.bot.actions", { name: bot.name })} aria-haspopup="menu" onClick={(event) => { const rect = event.currentTarget.getBoundingClientRect(); onMenu({ botId: bot.id, x: rect.left, y: rect.bottom }); }}
- className={cn("absolute right-1 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded text-ink-secondary hover:bg-raised hover:text-ink", simpleRow && "right-2 top-1 translate-y-0 rounded-lg",
+ className={cn("absolute right-1 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded text-ink-secondary hover:bg-raised hover:text-ink", simpleRow && "right-[3px] top-1.5 size-6 translate-y-0 rounded-lg",
selected && !simpleRow ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 max-md:pointer-events-auto max-md:opacity-70 touch:pointer-events-auto touch:opacity-70")}><MoreHorizontal size={15} /></button>
</>}
{deleting && iconOnly && (
diff --git a/src/components/SidebarBotListItem.expansion.test.ts b/src/components/SidebarBotListItem.expansion.test.ts
index c52aebaab1..976714fdba 100644
--- a/src/components/SidebarBotListItem.expansion.test.ts
+++ b/src/components/SidebarBotListItem.expansion.test.ts
@@ -99,8 +99,8 @@ describe("bot row expansion follows the visible thread tree", () => {
it.each([
[{ busy: true }, '<span dir="auto" data-sidebar-working-phrase="" class="truncate">Thinking</span>'],
- [{ activity: "waiting-on-you" }, '<span dir="auto" class="truncate">Waiting for you…'],
- [{ waitingForTeammates: true }, '<span dir="auto" class="truncate">Waiting on a teammate…'],
+ [{ activity: "waiting-on-you" }, '<span dir="auto" class="min-w-0 overflow-hidden whitespace-nowrap">Waiting for you…'],
+ [{ waitingForTeammates: true }, '<span dir="auto" class="min-w-0 overflow-hidden whitespace-nowrap">Waiting on a teammate…'],
] as const)("keeps sole-thread activity visible after a reveal (%j)", (status, label) => {
fixture.state.revealThread = { threadId: "current", nonce: 1 };
render({ ...bot, ...status });
diff --git a/src/components/SidebarBotListItem.test.ts b/src/components/SidebarBotListItem.test.ts
index e48994623f..d1e73caad8 100644
--- a/src/components/SidebarBotListItem.test.ts
+++ b/src/components/SidebarBotListItem.test.ts
@@ -63,7 +63,7 @@ describe("BotListItem", () => {
expect(badge).not.toContain("size-3");
expect(waiting).toContain('aria-hidden="true">!</span>');
expect(waiting).toContain('class="flex min-w-0 items-center gap-1.5 truncate text-[13px] leading-[18px] font-semibold text-warning"');
- expect(waiting).toContain('class="truncate">Waiting for you…</span>');
+ expect(waiting).toContain('class="min-w-0 overflow-hidden whitespace-nowrap">Waiting for you…</span>');
const icons = opening(renderRow(bot({ activity: "waiting-on-you" }), "icons"), "waiting-dot");
expect(icons).toContain("size-5");
@@ -75,7 +75,7 @@ describe("BotListItem", () => {
const teammateDot = opening(teammate, "teammate-wait-dot");
expect(teammateDot).toContain("size-2.5");
expect(teammateDot).not.toContain("size-4");
- expect(teammate).toContain('class="truncate">Waiting on a teammate…</span>');
+ expect(teammate).toContain('class="min-w-0 overflow-hidden whitespace-nowrap">Waiting on a teammate…</span>');
expect(teammate).toContain("truncate text-[13px] leading-[18px] text-ink-secondary");
expect(teammate).not.toContain("font-semibold text-warning");
@@ -87,7 +87,7 @@ describe("BotListItem", () => {
const preview = renderRow(bot({
messages: [{ id: "b1", role: "bot", kind: "text", text: "Created notes.txt", at: 2 }] as Bot["messages"],
}));
- expect(preview).toContain('class="truncate">Created notes.txt</span>');
+ expect(preview).toContain('class="min-w-0 overflow-hidden whitespace-nowrap">Created notes.txt</span>');
expect(preview).toContain("truncate text-[13px] leading-[18px] text-ink-secondary");
expect(preview).not.toContain("text-warning");
expect(preview).not.toContain("waiting-dot");
diff --git a/src/components/SidebarRowMarkers.tsx b/src/components/SidebarRowMarkers.tsx
index fab0399081..991acb3c08 100644
--- a/src/components/SidebarRowMarkers.tsx
+++ b/src/components/SidebarRowMarkers.tsx
@@ -30,7 +30,7 @@ export function RowDot({ waiting = false }: { waiting?: boolean }) {
const tone = cn("size-2 shrink-0 rounded-full", waiting ? "bg-warning" : "bg-accent");
return (
<>
- <span aria-hidden="true" data-row-dot="" className="pointer-events-none absolute right-2 top-1 flex size-7 items-center justify-center transition-opacity group-hover:opacity-0 group-focus-within:opacity-0 touch:opacity-0 max-md:hidden">
+ <span aria-hidden="true" data-row-dot="" className="pointer-events-none absolute right-[3px] top-1.5 flex size-6 items-center justify-center transition-opacity group-hover:opacity-0 group-focus-within:opacity-0 touch:opacity-0 max-md:hidden">
<span data-testid={waiting ? "waiting-dot" : "unread-dot"} title={label} className={tone} />
</span>
<span aria-hidden="true" title={label} className={cn(tone, "hidden self-center max-md:block touch:block")} />
diff --git a/src/styles.css b/src/styles.css
index 13a8cb2d56..def24f1a68 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -3613,3 +3613,12 @@ button:disabled.bg-danger {
.trace-step-box { background: color-mix(in srgb, #8b7cf6 14%, var(--color-card)); border-color: color-mix(in srgb, #8b7cf6 30%, var(--color-card)); }
.trace-step-ink { color: color-mix(in srgb, #7c6cf0 85%, var(--color-ink)); }
.trace-tool-ink { color: color-mix(in srgb, #1f9a8c 80%, var(--color-ink)); }
+
+.fade-end {
+ -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
+ mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
+}
+.fade-end:dir(rtl) {
+ -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
+ mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
+}