Skip to content

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

Simple chat: run the transcript under the header with a 60px top fade (#7052)

Milind Soni84bf3c2b75fb
diff --git a/DESIGN.md b/DESIGN.md
index e335e8d90c..252b87eb05 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -193,6 +193,9 @@ element's job and never a pixel value:
the sidebar's width and its pinned bots exactly as they were. The chat makes
the room; under 920px, where the chat would get less than 320px, the panel
floats over the chat's edge instead.
+- **Simple's chat header floats over the transcript** (see [section 8](#8-surfaces-and-depth)):
+ the first message rests just below it at the top of the history, and only its
+ controls take clicks.
- **The chat header's model pill folds to its AI's mark** while a side panel
narrows the chat, in a round button the size of the header's others; its
label still names the model.
@@ -233,6 +236,11 @@ element's job and never a pixel value:
composer (`shadow-(--shadow-composer)`, through `ELEVATED_COMPOSER`). The
lift shows on light grounds only; in Daylight the composer drops its 0.5px
ring at rest and gets it back on hover and focus.
+- **Simple's chat header has no band.** The transcript runs up to the
+ window's top edge under the floating pill and buttons and fades in, in even
+ steps, over the header's 60px (a mask on the scroller, so any skin's ground
+ shows through). A solid band cut messages off at the header; the floating
+ controls already carry their own lift. Advanced keeps its band.
- **Borders are 1px `hairline`.** Panes meet on a 0.5px `edge`. An element in
the page gets a border or a tint, not both, and no shadow. Floating surfaces
take their surface class, which already balances all three. One exception:
diff --git a/src/components/ChatHeadPill.tsx b/src/components/ChatHeadPill.tsx
index 020bec3250..438df00b60 100644
--- a/src/components/ChatHeadPill.tsx
+++ b/src/components/ChatHeadPill.tsx
@@ -57,9 +57,9 @@ export function ChatHeadPill({ bot, avatar, privacy, onToggle }: {
aria-label={conversation ? `${label}, ${conversation}` : label}
aria-expanded={open}
aria-controls={open ? BOT_PANEL_ID : undefined}
- className={cn("group flex min-w-0 max-w-full items-center gap-2 rounded-full py-[7.5px] pl-[7.5px] pr-[13.5px] text-ink", ELEVATED_FLOAT, ELEVATED_HOVER)}
+ className={cn("group flex min-w-0 max-w-full items-center gap-2 rounded-full py-[5.5px] pl-[5.5px] pr-[13.5px] text-ink", ELEVATED_FLOAT, ELEVATED_HOVER)}
>
- <BotAvatar bot={bot} size={24} {...avatar} />
+ <BotAvatar bot={bot} size={28} {...avatar} />
<span dir="auto" className="min-w-0 truncate text-[14px] font-medium leading-5">{bot.name}</span>
{conversation && (
<>
diff --git a/src/components/ChatView.controls.test.ts b/src/components/ChatView.controls.test.ts
index dab7cfcd2f..0f54c790bc 100644
--- a/src/components/ChatView.controls.test.ts
+++ b/src/components/ChatView.controls.test.ts
@@ -154,7 +154,7 @@ describe("the Simple header", () => {
expect(identity.replace(pill[0], "").replace(/<span role="status"[^>]*>[^<]*<\/span>/, "")).not.toMatch(/<(button|a|span)[\s>]/);
expect(pill[1]).toContain(">Pepper</span>");
expect(pill[1]).toContain('data-chathead-elsewhere="true"');
- expect(pill[0].match(/class="([^"]*)"/)![1]!.split(" ")).toEqual(expect.arrayContaining(["rounded-full", "bg-composer", "ring-[0.5px]", "shadow-(--shadow-float)", "py-[7.5px]", "pr-[13.5px]"]));
+ expect(pill[0].match(/class="([^"]*)"/)![1]!.split(" ")).toEqual(expect.arrayContaining(["rounded-full", "bg-composer", "ring-[0.5px]", "shadow-(--shadow-float)", "py-[5.5px]", "pl-[5.5px]", "pr-[13.5px]"]));
// Away from the bot's main conversation, the pill names the one on screen.
expect(pill[1]).toContain("data-chathead-conversation");
for (const gone of ["data-chathead-role", "data-background-activity", "data-chathead-back", 'data-testid="chat-more"']) {
@@ -314,13 +314,19 @@ describe("glass header", () => {
it("fades the transcript into the canvas under the header in both modes", () => {
const bar = (markup: string) => markup.match(/<div data-glass-bar="top"[^>]*>/)?.[0] ?? "";
- expect(bar(renderToStaticMarkup(createElement(ChatView, { bot })))).toContain('data-glass-fade=""');
+ const advanced = renderToStaticMarkup(createElement(ChatView, { bot }));
+ expect(bar(advanced)).toContain('data-glass-fade=""');
+ // Advanced keeps its band: no floating header, no mask on the transcript.
+ expect(bar(advanced)).not.toContain("data-chathead-float");
+ expect(advanced).not.toContain("data-top-fade");
fixture.advanced = false;
try {
const markup = renderToStaticMarkup(createElement(ChatView, { bot }));
expect(bar(markup)).toContain('data-glass-fade=""');
expect(bar(markup)).not.toContain("before:hidden");
- expect(markup).toMatch(/class="glass-scroller [^"]*" style="scroll-padding-bottom:calc\(/);
+ // Simple has no band: its controls float, and the transcript runs to the top edge under them and fades in.
+ expect(bar(markup)).toContain('data-chathead-float=""');
+ expect(markup).toMatch(/class="glass-scroller [^"]*" data-top-fade="" style="scroll-padding-bottom:calc\(/);
} finally {
fixture.advanced = true;
}
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsx
index 677294dd9f..038e77c248 100644
--- a/src/components/ChatView.tsx
+++ b/src/components/ChatView.tsx
@@ -933,7 +933,7 @@ export const ChatView = memo(function ChatView({ bot: profile, inForkPanel = fal
<CallOverlay bot={bot} />
<GlassScrollFrame className="flex-1 [--glass-tint:var(--color-app)]">
{/* z-[25]: above the room set-up card (z-20), below the CallOverlay (z-30). */}
- <GlassBar edge="top" fade={!remoteClient} className="z-[25]">
+ <GlassBar edge="top" fade={!remoteClient} data-chathead-float={simpleHead ? "" : undefined} className="z-[25]">
<div
{...headerDragProps} data-look="chat-header"
className={cn(
@@ -1079,7 +1079,7 @@ export const ChatView = memo(function ChatView({ bot: profile, inForkPanel = fal
<div
ref={scrollRef}
- className="glass-scroller h-full overflow-x-hidden overflow-y-auto overscroll-y-contain px-4 [overflow-anchor:none]"
+ className="glass-scroller h-full overflow-x-hidden overflow-y-auto overscroll-y-contain px-4 [overflow-anchor:none]" data-top-fade={simpleHead ? "" : undefined}
// Simple mode's composer sits on plain canvas, so a row scrolled into view stops clear of it.
style={advanced ? undefined : { scrollPaddingBottom: composerDock.pad }}
{...scrollHandlers}
diff --git a/src/components/GlassScrollFrame.test.ts b/src/components/GlassScrollFrame.test.ts
index e3f32e27e5..7895abe181 100644
--- a/src/components/GlassScrollFrame.test.ts
+++ b/src/components/GlassScrollFrame.test.ts
@@ -150,3 +150,22 @@ describe("a fading bar", () => {
expect(rule('.glass-bar[data-glass-fade]')).toContain("--glass-fade: 60px");
});
});
+
+describe("Simple mode's floating chat header", () => {
+ const css = readFileSync("src/styles.css", "utf8");
+ const rule = (selector: string) => css.match(new RegExp(`(?:^|\\n)${selector.replace(/[[\]().:"]/g, "\\$&")} \\{[^}]*\\}`))?.[0] ?? "";
+
+ it("draws no band, and the transcript fades in linearly over the 60px above the bar's bottom edge", () => {
+ expect(rule(".glass-bar[data-chathead-float]::before")).toContain("content: none");
+ const fade = rule(".glass-scroller[data-top-fade]");
+ expect(fade).toContain("--top-fade: 60px");
+ const gradient = "linear-gradient(to bottom, transparent calc(var(--glass-top, 0px) - var(--top-fade)), #000 var(--glass-top, 0px))";
+ expect(fade).toContain(`-webkit-mask-image: ${gradient}`);
+ expect(fade).toContain(`\n mask-image: ${gradient}`);
+ });
+
+ it("lets clicks between its controls through to the transcript", () => {
+ expect(rule("[data-chathead-float]")).toContain("pointer-events: none");
+ expect(css).toContain('[data-chathead-float] > :not([data-look="chat-header"]),\n[data-chathead-float] :is([data-chathead-identity], [data-chathead-controls]) > * {\n pointer-events: auto;');
+ });
+});
diff --git a/src/styles.css b/src/styles.css
index ad077e726f..29fd45b1bd 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -2067,6 +2067,26 @@ body {
backdrop-filter: none;
mask-image: none;
}
+/* Simple mode's chat header has no band at all: the transcript runs up to the window's top edge under the floating pill
+ and buttons, and the scroller itself fades it in, in even steps, over the --top-fade just above the bar's bottom
+ edge, where the first row rests at the top of the history. A mask, not a fill, so whatever ground the skin paints
+ (Aurora's field included) shows through. A taller bar (find, a notice) keeps what lies above that stretch hidden.
+ Only the bar's controls take the pointer; between them, a click reaches the transcript. */
+.glass-bar[data-chathead-float]::before {
+ content: none;
+}
+.glass-scroller[data-top-fade] {
+ --top-fade: 60px;
+ -webkit-mask-image: linear-gradient(to bottom, transparent calc(var(--glass-top, 0px) - var(--top-fade)), #000 var(--glass-top, 0px));
+ mask-image: linear-gradient(to bottom, transparent calc(var(--glass-top, 0px) - var(--top-fade)), #000 var(--glass-top, 0px));
+}
+[data-chathead-float] {
+ pointer-events: none;
+}
+[data-chathead-float] > :not([data-look="chat-header"]),
+[data-chathead-float] :is([data-chathead-identity], [data-chathead-controls]) > * {
+ pointer-events: auto;
+}
/* The colour of the place on screen (PlaceTint), faint, from the very top of the sidebar to just below its head, under
everything there: the head's words and controls stay on what is still almost the plain panel. Dark skins take a
little more of it to show at all. Reduced transparency: a thin solid line at the top instead; forced colours: none. */