Skip to content

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

Sidebar: a quieter server switcher at the top of the sidebar

luishron1235b158f138cb4
diff --git a/src/components/DesktopWorkspaceSwitcher.test.ts b/src/components/DesktopWorkspaceSwitcher.test.ts
index 043241504b..83843a72e0 100644
--- a/src/components/DesktopWorkspaceSwitcher.test.ts
+++ b/src/components/DesktopWorkspaceSwitcher.test.ts
@@ -76,15 +76,16 @@ it("is the Show me how tip's anchor, and opens the menu as reached from the tip
it("draws Simple mode's switcher as a rounded pill that names the server in full, swapping to the laptop icon only when the row is too narrow", () => {
vi.stubGlobal("window", { ogb: { workspaces: { state: () => new Promise(() => {}), menu: () => Promise.resolve() } } });
const pill = renderToStaticMarkup(createElement(DesktopWorkspaceSwitcher, { inline: true, pill: true }));
- expect(pill).toMatch(/aria-label="Switch server: Servers" aria-haspopup="menu" aria-expanded="false"[^>]*class="[^"]*\bh-8\b[^"]*\brounded-full\b[^"]*\bbg-raised\/50\b[^"]*\btext-\[13px\][^"]*\bfont-medium\b/);
+ expect(pill).toMatch(/aria-label="Switch server: Servers" aria-haspopup="menu" aria-expanded="false"[^>]*class="[^"]*\bh-8\b[^"]*\brounded-full\b[^"]*\btext-\[13px\][^"]*\bfont-medium\b[^"]*\btext-ink-secondary\b[^"]*\bhover:bg-ink\/\[0\.06\]/);
+ expect(pill).not.toContain("bg-raised/50");
expect(pill).toContain('<span class="min-w-0 truncate @max-[124px]/sidebar-top:hidden">Servers</span>');
expect(pill).toContain("lucide-chevron-down");
expect(pill).toContain('class="lucide lucide-laptop hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block"');
expect(pill).not.toContain("@max-[96px]");
const inline = renderToStaticMarkup(createElement(DesktopWorkspaceSwitcher, { inline: true }));
expect(inline).toContain("lucide-laptop");
- expect(inline).toMatch(/class="[^"]*\bh-7\b[^"]*\brounded-md\b[^"]*\btext-\[13px\]/);
- expect(inline).not.toContain("rounded-full");
+ expect(inline).toMatch(/class="[^"]*\bh-7\b[^"]*\brounded-full\b[^"]*\btext-\[13px\][^"]*\btext-ink-secondary\b[^"]*\bhover:bg-ink\/\[0\.06\]/);
+ expect(inline).not.toContain("hover:bg-control");
vi.stubGlobal("window", {});
const browser = renderToStaticMarkup(createElement(DesktopWorkspaceSwitcher, { inline: true, pill: true, cloudHome: true }));
diff --git a/src/components/DesktopWorkspaceSwitcher.tsx b/src/components/DesktopWorkspaceSwitcher.tsx
index a0fbb420d0..1415b91571 100644
--- a/src/components/DesktopWorkspaceSwitcher.tsx
+++ b/src/components/DesktopWorkspaceSwitcher.tsx
@@ -104,7 +104,7 @@ function Switcher({ compact = false, inline = false, pill = false, rail = false,
<Cloud size={18} aria-hidden="true" />
</div>;
if (inline) return <div data-cloud-home-indicator data-workspace-switcher="inline" title={label}
- className={pill ? "flex h-8 min-w-0 items-center gap-1 rounded-full bg-raised/50 px-3 text-[13px] font-medium text-ink" : "flex min-w-0 items-center gap-1.5 px-1.5 text-[13px] font-medium text-ink"}>
+ className={pill ? "flex h-8 min-w-0 items-center gap-1 rounded-full px-3 text-[13px] font-medium text-ink-secondary" : "flex min-w-0 items-center gap-1.5 px-2 text-[13px] font-medium text-ink-secondary"}>
<Cloud size={pill ? 15 : 14} aria-hidden="true" className={pill ? "hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block" : "shrink-0 text-ink-secondary"} />
<span className={pill ? "min-w-0 truncate @max-[124px]/sidebar-top:hidden" : "min-w-0 truncate"}>{cloudName}</span>
{(onLine || whose) && <span className="sr-only">{onLine ? ` · ${onLine}` : ""}{whose ? ` · ${whose}` : ""}</span>}
@@ -135,12 +135,12 @@ function Switcher({ compact = false, inline = false, pill = false, rail = false,
<button type="button" aria-label={label} aria-haspopup="menu" aria-expanded={open} data-cloud-home-indicator={cloudHome || undefined}
data-tour="server-switcher" title={title} onClick={openMenu}
className={pill
- ? "flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-full bg-raised/50 pl-2.5 pr-1.5 text-left text-[13px] font-medium text-ink hover:bg-raised aria-expanded:bg-raised focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus"
- : "flex h-7 min-w-0 max-w-full items-center gap-1.5 overflow-hidden rounded-md px-1.5 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus"}
+ ? "flex h-8 min-w-0 max-w-full items-center gap-1 overflow-hidden rounded-full pl-2.5 pr-1.5 text-left text-[13px] font-medium text-ink-secondary transition-colors duration-[120ms] hover:bg-ink/[0.06] hover:text-ink active:bg-ink/[0.08] aria-expanded:bg-ink/[0.06] aria-expanded:text-ink motion-reduce:transition-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus"
+ : "flex h-7 min-w-0 max-w-full items-center gap-1.5 overflow-hidden rounded-full px-2 text-left text-[13px] font-medium text-ink-secondary transition-colors duration-[120ms] hover:bg-ink/[0.06] hover:text-ink active:bg-ink/[0.08] aria-expanded:bg-ink/[0.06] aria-expanded:text-ink motion-reduce:transition-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus"}
style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}>
{cloudColor(current?.color) ? <CloudTile color={current?.color} size={16} /> : <Icon size={pill ? 15 : 14} aria-hidden="true" data-switcher-icon className={pill ? "hidden shrink-0 text-ink-secondary @max-[124px]/sidebar-top:block" : "shrink-0 text-ink-secondary"} />}
<span className={pill ? "min-w-0 truncate @max-[124px]/sidebar-top:hidden" : "min-w-0 truncate @max-[96px]/sidebar-top:hidden"}>{name}</span>
- <ChevronDown size={pill ? 12 : 11} aria-hidden="true" className={pill ? "shrink-0 text-ink-tertiary" : "shrink-0 text-ink-secondary"} />
+ <ChevronDown size={pill ? 12 : 11} aria-hidden="true" className="shrink-0 text-ink-tertiary" />
</button>
{error && <p role="alert" className="absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-danger shadow-lg">{error}</p>}
{waking && !error && <p role="status" data-cloud-waking className="absolute right-2 top-full z-40 mt-1 w-56 max-w-[calc(100%-1rem)] rounded-md bg-menu px-2 py-1 text-[11px] text-ink-secondary shadow-lg">{waking}</p>}
@@ -149,7 +149,7 @@ function Switcher({ compact = false, inline = false, pill = false, rail = false,
<button type="button" aria-label={label} aria-haspopup="menu" aria-expanded={open} data-cloud-home-indicator={cloudHome || undefined}
data-tour="server-switcher" title={title}
onClick={openMenu}
- className={cn("flex w-full items-center gap-2 rounded-lg py-2 text-left text-[13px] font-medium text-ink hover:bg-control focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", compact ? "justify-center px-1" : "px-2")}
+ className={cn("flex w-full items-center gap-2 rounded-xl py-2 text-left text-[13px] font-medium text-ink hover:bg-ink/[0.06] active:bg-ink/[0.08] aria-expanded:bg-ink/[0.06] focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus", compact ? "justify-center px-1" : "px-2")}
style={{ WebkitAppRegion: "no-drag" } as React.CSSProperties}>
{cloudColor(current?.color) ? <CloudTile color={current?.color} size={20} /> : <Icon size={16} className="shrink-0 text-ink-secondary" />}
{!compact && <><span className="min-w-0 flex-1 truncate">{name}{cloudHome && onLine && <PowerLine text={onLine} />}</span><ChevronDown size={13} className="shrink-0 text-ink-secondary" /></>}