Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: put a working chat row's spinner back on the trailing column, and tighten the pin gap (#11408)

Michael Hanc9b79bb03dca
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index 569b98d28fb..d293d18de2c 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -3436,6 +3436,9 @@ export function AppSidebar() {
// A spinner glyph cannot truncate, and the pin and the kebab overlay that same edge, so a
// working row holds their room open whether or not it is hovered.
showWorkSpinner ? "pr-16" : hasUnreadActivity ? "pr-7" : undefined,
+ // Coarse pointers reveal the actions permanently, so the spinner drops back beside
+ // them (right-16, ending 78px in) and the title has to clear that, not just pr-16.
+ showWorkSpinner && "[@media(pointer:coarse)]:pr-[78px]",
variant === "project"
? showWorkSpinner
? undefined
@@ -3542,7 +3545,23 @@ export function AppSidebar() {
<span className="truncate">
{pendingRename?.id === item.id ? pendingRename.title : item.title}
</span>
- {showWorkSpinner && (
+ </SidebarMenuButton>
+ {showWorkSpinner ? (
+ // Anchored to the row, not laid out in it. As ml-auto the spinner rested on
+ // the button's padding-right, and a working row swaps pr-4 for pr-16 to hold
+ // room for the pin and kebab, pushing it 64px in. right-4 is the 16px trailing
+ // column the nav spinner keeps. Fades on hover like the unread dot below.
+ <span
+ className={cn(
+ "pointer-events-none absolute right-4 top-1/2 z-10 -translate-y-1/2 transition-opacity",
+ // Touch reveals the pin and kebab for good, so there is nothing to fade
+ // behind: sit left of them instead, where this used to be.
+ "[@media(pointer:coarse)]:right-16",
+ variant === "project"
+ ? "group-hover/project-chat-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/project-chat-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/project-chat-item:opacity-0"
+ : "group-hover/recent-item:opacity-0 group-has-[.sidebar-row-action[data-state=open]]/recent-item:opacity-0 group-has-[.sidebar-row-action:focus-visible]/recent-item:opacity-0",
+ )}
+ >
<Spinner
data-testid="chat-row-spinner"
// role="status" + label: announced, not motion-only.
@@ -3551,10 +3570,10 @@ export function AppSidebar() {
? translate("shell.navigation.chatGenerating")
: "Queued"
}
- className="ml-auto size-3.5 shrink-0 text-muted-foreground"
+ className="size-3.5 shrink-0 text-muted-foreground"
/>
- )}
- </SidebarMenuButton>
+ </span>
+ ) : null}
{hasUnreadActivity ? (
<span
className={cn(
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 574a71e800e..98728bef45d 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -1181,10 +1181,21 @@ html[data-chat-font] .aui-root {
.sidebar-row-action.is-disclosure-open {
@apply opacity-100 pointer-events-auto;
}
- /* Secondary row action (the pinned-chat unpin button) sits just left of
- the primary "…" options button. */
+ /* The pin sits just left of the "…" options button, and the 14px trough
+ between their ~16px icons is the two paddings that face each other: the
+ pin's pr-1.5 and the options button's pl-2. Drop those, and the pin's
+ right edge lands exactly on the options button's left edge (30px = its
+ pr-1.5 plus a size-6 glyph). Closing the gap by moving the pin instead
+ would slide it under that pl-2, and the options button, later in the DOM,
+ would take the clicks over the pin's own glyph. What is left of the pin's
+ own padding-right is the whole gap: the glyph boxes meet at 30px, so 2px
+ here is 2px between them and 10px between the drawn icons. */
.sidebar-row-action.is-unpin-action {
right: 1.875rem;
+ padding-right: 0.125rem;
+ }
+ .sidebar-row-action.is-unpin-action + .sidebar-row-action {
+ padding-left: 0;
}
/* Branch picker chevron buttons sit beside action bar icon buttons
diff --git a/studio/frontend/tests/sidebar-spinner-column.test.ts b/studio/frontend/tests/sidebar-spinner-column.test.ts
index 36a1041f241..ea767e9bc0b 100644
--- a/studio/frontend/tests/sidebar-spinner-column.test.ts
+++ b/studio/frontend/tests/sidebar-spinner-column.test.ts
@@ -8,9 +8,10 @@ import { readSrc } from "./helpers/kit.ts";
const APP_SIDEBAR = readSrc("components/app-sidebar.tsx");
-// Both spinners are ml-auto, so each one sits at its row's padding-right plus
-// its own margin-right. The two rows carry different padding, so the margins
-// have to make up the difference or the column visibly steps.
+// The nav spinner is ml-auto, so it sits at its row's padding-right plus its margin-right.
+// The chat spinner is anchored at right-N off the row's edge instead: in the flow a working
+// row swapped pr-4 for pr-16 and shoved it 64px in, which reading pr-4 off the base class
+// never saw. So measure the chat side from the edge it is anchored to.
const TAILWIND_UNIT = 4;
function inset(classes: string, prefix: string): number {
@@ -36,21 +37,15 @@ test("nav and Recents spinners land on one trailing column", async () => {
/<Spinner className="(ml-auto[^"]*group-data-\[collapsible=icon\]:hidden)"/,
"NavItem spinner",
);
- const chatRow = grab(
+ // The wrapper the chat spinner hangs off, anchored to the row rather than its text box.
+ const chatSpinnerAnchor = grab(
APP_SIDEBAR,
- // Row height is a density choice and moves independently of the trailing
- // column, so match any h-[Npx]; cursor-pointer is what makes this the chat row.
- /"(sidebar-nav-btn h-\[\d+px\] cursor-pointer rounded-full[^"]*)"/,
- "Recents chat row",
- );
- const chatSpinner = grab(
- APP_SIDEBAR,
- /data-testid="chat-row-spinner"[\s\S]{0,400}?className="(ml-auto[^"]*)"/,
- "Recents chat spinner",
+ /className=\{cn\(\s*"(pointer-events-none absolute right-[0-9.]+[^"]*)"[\s\S]{0,1200}?data-testid="chat-row-spinner"/,
+ "Recents chat spinner anchor",
);
const nav = inset(navRow, "pr") + inset(navSpinner, "mr");
- const chat = inset(chatRow, "pr") + inset(chatSpinner, "mr");
+ const chat = inset(chatSpinnerAnchor, "right");
assert.equal(
nav,
@@ -58,6 +53,12 @@ test("nav and Recents spinners land on one trailing column", async () => {
`nav spinner sits ${nav}px in, chat spinner ${chat}px`,
);
assert.equal(nav, 16);
+
+ // The row's padding must not hold the chat spinner out: that coupling is the bug.
+ assert.ok(
+ !/data-testid="chat-row-spinner"[\s\S]{0,400}?className="ml-auto/.test(APP_SIDEBAR),
+ "the chat spinner is back in the flow, where the row's padding-right moves it",
+ );
});
// The kebab overlays the row's right edge, so a spinner row must pad past it.
@@ -95,6 +96,51 @@ test("a working Recents row clears the kebab on hover", async () => {
}
});
+// The pin and the options button both float over that same right edge, so the padding around
+// one glyph can reach across the other. The options button is later in the DOM and would win
+// those clicks, taking the pin's own glyph with them.
+test("the pin and options buttons do not overlap", () => {
+ const css = readSrc("index.css");
+
+ const px = (value: string) =>
+ value.trim().endsWith("rem")
+ ? Number.parseFloat(value) * 16
+ : Number.parseFloat(value);
+ // Every metacharacter, backslash included: escaping only . and + leaves the rest to be
+ // read as syntax.
+ const quote = (value: string) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+ const decl = (selector: string, prop: string) => {
+ const block = new RegExp(`${quote(selector)} \\{([^}]*)\\}`).exec(css);
+ assert.ok(block, `could not find ${selector} in index.css`);
+ const m = new RegExp(`(?:^|;|\\n)\\s*${quote(prop)}:\\s*([^;]+)`).exec(
+ block[1],
+ );
+ assert.ok(m, `${selector} does not set ${prop}`);
+ return px(m[1]);
+ };
+
+ const base = grab(css, /\.sidebar-row-action \{\s*@apply ([^;]*);/, "row action");
+ const glyph = inset(
+ grab(css, /\.sidebar-row-action-glyph \{\s*@apply ([^;]*);/, "action glyph"),
+ "size",
+ );
+
+ // The options button is one glyph plus the padding either side of it, and a row with a pin
+ // zeroes the left one, so the button ends where its glyph does.
+ const optionsWidth =
+ decl(".sidebar-row-action.is-unpin-action + .sidebar-row-action", "padding-left") +
+ glyph +
+ inset(base, "pr");
+ const pinRight = decl(".sidebar-row-action.is-unpin-action", "right");
+
+ assert.ok(
+ pinRight >= optionsWidth,
+ `the pin starts ${pinRight}px in, ${optionsWidth - pinRight}px under the options button`,
+ );
+ // And it stays snug against it rather than reopening the trough.
+ assert.ok(pinRight - optionsWidth <= 4, `${pinRight - optionsWidth}px of dead space between them`);
+});
+
// That same column now carries a second meaning: a row whose capability has not been measured
// yet. On a Mac the platform store seeds chatOnly from the user agent, so Train and Video used
// to paint disabled (opacity-50, inert) from first load and only recover once /api/health