Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Bottom-left cards make room for the desktop rail instead of sliding under it (#4008)
Milind Soni8c663d2b7647
diff --git a/src/components/CloudSetup.tsx b/src/components/CloudSetup.tsxindex 159b660aa3..44e6cdf878 100644--- a/src/components/CloudSetup.tsx+++ b/src/components/CloudSetup.tsx@@ -33,7 +33,7 @@ function storeCollapsed(collapsed: boolean) {try { globalThis.localStorage?.setItem(COLLAPSED_KEY, collapsed ? "1" : "0"); } catch {}}-const CARD = "fixed bottom-4 left-4 z-40 max-h-[calc(100dvh-32px)] w-[300px] max-w-[calc(100vw-32px)] origin-bottom-left overflow-y-auto rounded-2xl border border-hairline/50 bg-menu text-ink shadow-[0_18px_48px_-16px_rgba(0,0,0,0.55),0_4px_12px_-6px_rgba(0,0,0,0.3)]";+const CARD = "fixed bottom-4 left-[calc(var(--rail-beside,0px)_+_1rem)] z-40 max-h-[calc(100dvh-32px)] w-[300px] max-w-[calc(100vw_-_var(--rail-beside,0px)_-_32px)] origin-bottom-left overflow-y-auto rounded-2xl border border-hairline/50 bg-menu text-ink shadow-[0_18px_48px_-16px_rgba(0,0,0,0.55),0_4px_12px_-6px_rgba(0,0,0,0.3)]";const PRIMARY = "ui-button ui-button-primary shrink-0 gap-1.5 text-[13px] transition-transform duration-150 ease-out active:scale-[0.97] motion-reduce:transition-none";function nextRunLabel(at: number | null, now = Date.now()): string | null {diff --git a/src/components/NoticeCard.tsx b/src/components/NoticeCard.tsxindex a01505c658..2978420206 100644--- a/src/components/NoticeCard.tsx+++ b/src/components/NoticeCard.tsx@@ -11,7 +11,7 @@ export function NoticeCard({ titleId, icon: Icon, title, onDismiss, dismissLabel}) {return <aside aria-labelledby={titleId} data-notice={notice} onKeyDown={event => {if (event.key === "Escape") { event.preventDefault(); event.stopPropagation(); onDismiss(); }- }} className="fixed bottom-4 left-4 z-40 max-h-[calc(100dvh-32px)] w-[300px] max-w-[calc(100vw-32px)] overflow-y-auto rounded-xl border border-hairline/40 bg-panel p-3.5 text-ink shadow-2xl shadow-black/20">+ }} className="fixed bottom-4 left-[calc(var(--rail-beside,0px)_+_1rem)] z-40 max-h-[calc(100dvh-32px)] w-[300px] max-w-[calc(100vw_-_var(--rail-beside,0px)_-_32px)] overflow-y-auto rounded-xl border border-hairline/40 bg-panel p-3.5 text-ink shadow-2xl shadow-black/20"><div className="flex items-start justify-between gap-3"><div className="flex items-start gap-2.5"><Icon size={16} className="mt-0.5 shrink-0 text-ink-secondary" aria-hidden="true" />@@ -48,5 +48,5 @@ export function NoticeToast({ text, onDone }: { text: string; onDone: () => voidconst timer = setTimeout(onDone, 5_000);return () => clearTimeout(timer);}, [text]);- return <p role="status" data-notice-toast className="fixed bottom-4 left-4 z-[60] w-[300px] max-w-[calc(100vw-32px)] rounded-xl border border-hairline/40 bg-panel px-3.5 py-2.5 text-[13px] text-ink shadow-2xl shadow-black/20">{text}</p>;+ return <p role="status" data-notice-toast className="fixed bottom-4 left-[calc(var(--rail-beside,0px)_+_1rem)] z-[60] w-[300px] max-w-[calc(100vw_-_var(--rail-beside,0px)_-_32px)] rounded-xl border border-hairline/40 bg-panel px-3.5 py-2.5 text-[13px] text-ink shadow-2xl shadow-black/20">{text}</p>;}diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex a2bbc263c6..a9c156fb74 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -1749,7 +1749,7 @@ export function Sidebar({ open, onClose, collapseToIcons = false }: {<divrole="status"className={cn(- "fixed bottom-4 left-4 z-[60] max-w-[300px] rounded-xl border px-3.5 py-2.5 text-[13px] shadow-xl",+ "fixed bottom-4 left-[calc(var(--rail-beside,0px)_+_1rem)] z-[60] max-w-[300px] rounded-xl border px-3.5 py-2.5 text-[13px] shadow-xl",teamFeedback.error? "border-danger/30 bg-card text-danger": "border-hairline/50 bg-card text-ink",diff --git a/src/components/UpdateBanner.tsx b/src/components/UpdateBanner.tsxindex 3177a3f5af..174b257f3e 100644--- a/src/components/UpdateBanner.tsx+++ b/src/components/UpdateBanner.tsx@@ -94,7 +94,7 @@ export function UpdateBanner({ sidebarIndicator = false }: UpdateBannerProps) {: friendlyError(s.message);return (- <div className="animate-panel-in fixed bottom-4 left-4 z-50 w-[300px] rounded-xl border border-hairline/40 bg-panel p-3.5 shadow-2xl shadow-black/50">+ <div className="animate-panel-in fixed bottom-4 left-[calc(var(--rail-beside,0px)_+_1rem)] z-50 w-[300px] rounded-xl border border-hairline/40 bg-panel p-3.5 shadow-2xl shadow-black/50"><div className="flex items-start gap-2.5"><span className="mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full bg-accent/15 text-accent"><Sparkles size={14} />diff --git a/src/components/onboarding/SharedWorkspaceHint.tsx b/src/components/onboarding/SharedWorkspaceHint.tsxindex 88e67e26eb..bfd317f796 100644--- a/src/components/onboarding/SharedWorkspaceHint.tsx+++ b/src/components/onboarding/SharedWorkspaceHint.tsx@@ -37,7 +37,7 @@ export function SharedWorkspaceHint({return (<asidearia-labelledby={titleId}- className="fixed inset-x-3 top-14 z-40 flex items-start gap-3 rounded-2xl border border-hairline/50 bg-panel p-3.5 shadow-[0_24px_60px_-20px_rgba(0,0,0,0.6)] sm:inset-x-auto sm:right-5 sm:top-16 sm:w-[360px]"+ className="fixed left-[calc(var(--rail-beside,0px)_+_0.75rem)] right-3 top-14 z-40 flex items-start gap-3 rounded-2xl border border-hairline/50 bg-panel p-3.5 shadow-[0_24px_60px_-20px_rgba(0,0,0,0.6)] sm:inset-x-auto sm:right-5 sm:top-16 sm:w-[360px]"><div className="shrink-0"><MausAvatar color="green" state="happy" size={36} trackPointer={false} />diff --git a/src/components/rail-safe-fixed.test.ts b/src/components/rail-safe-fixed.test.tsnew file mode 100644index 0000000000..48db81f1a1--- /dev/null+++ b/src/components/rail-safe-fixed.test.ts@@ -0,0 +1,33 @@+// The desktop rail of places is its own view over the window's left 36px. The page makes room with `padding-left` on+// <html> (electron/preload.cjs sets it and `--rail-beside`), which fixed elements ignore. So a card or toast pinned to+// the left edge must add `--rail-beside` itself, or the rail covers its left side.+import { readdirSync, readFileSync, statSync } from "node:fs";+import { join, relative } from "node:path";+import { fileURLToPath } from "node:url";+import { describe, expect, it } from "vitest";++const SRC = fileURLToPath(new URL("..", import.meta.url));++function* sources(dir: string): Generator<string> {+ for (const name of readdirSync(dir)) {+ const path = join(dir, name);+ if (statSync(path).isDirectory()) yield* sources(path);+ else if (name.endsWith(".tsx") && !/\.test\./.test(name)) yield path;+ }+}++/** A fixed element pinned to the left edge: `left-<n>`, `left-[…]` or `inset-x-<n>`, but not centred (`left-1/2`). */+const pinnedLeft = (classes: string) => /(^|\s)fixed(\s|$)/.test(classes)+ && /(^|\s)(left-(\d|\[)|inset-x-\d|start-\d)/.test(classes) && !/(^|\s)left-1\/2(\s|$)/.test(classes);++describe("fixed elements and the desktop rail", () => {+ it("make room for the rail when they are pinned to the left edge", () => {+ const offending: string[] = [];+ for (const path of sources(SRC)) {+ for (const [, classes] of readFileSync(path, "utf8").matchAll(/"([^"\n]*\bfixed\b[^"\n]*)"/g)) {+ if (pinnedLeft(classes) && !classes.includes("--rail-beside")) offending.push(`${relative(SRC, path)}: ${classes.slice(0, 80)}`);+ }+ }+ expect(offending).toEqual([]);+ });+});