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: line sidebar section headers up with row content (#11996)

Michael Han725ea2b5d549
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index 1d0e5e13b0a..e2ca20a86e5 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -2209,15 +2209,11 @@ export function AppSidebar() {
// padding deliberately: its width is independent of whether the recent-chat list has a scrollbar.
const unrailedRowPadding = usesDesktopTitlebar ? "px-[calc(5px*var(--ui-space-scale,1))]" : "px-1.5";
- // Header actions end where a hovered row's "…" does: unrailedRowPadding + the
- // action's own pr-1.5. 12px normally (the pr-3 class default), 11px here.
- const headerRightPadding = usesDesktopTitlebar
+ // Headers follow unrailedRowPadding: the label starts where row content does, and the
+ // actions end where a hovered row's "…" does. 18px / 12px normally (the class defaults), 17px / 11px here.
+ const headerInset = usesDesktopTitlebar
? "sidebar-sticky-label-desktop"
: null;
- // Recents alone is nudged 2px right there, and carries its padding with it.
- const recentsHeaderRightPadding = usesDesktopTitlebar
- ? "sidebar-sticky-label-desktop-recents"
- : null;
// One definition per row, so pinned rows and the flyout can't drift apart.
const navRows: Record<SidebarNavItemId, NavRowDef> = {
@@ -4218,7 +4214,7 @@ export function AppSidebar() {
className={cn(
"group-data-[collapsible=icon]:px-0 shrink-0 transition-[padding]",
rowPadding,
- usesDesktopTitlebar ? "pt-[calc(11px*var(--ui-space-scale,1))]" : "pt-[calc(9px*var(--ui-space-scale,1))]",
+ usesDesktopTitlebar ? "pt-[calc(11px*var(--ui-space-scale,1))]" : "pt-[calc(7px*var(--ui-space-scale,1))]",
// Scrolled: New Chat is pinned, give a little gap below it.
scrolled ? "pb-[calc(5px*var(--ui-space-scale,1))]" : "pb-px",
)}
@@ -4485,7 +4481,7 @@ export function AppSidebar() {
<SidebarGroupLabel
className={cn(
"sidebar-sticky-label sidebar-sticky-label-following group/sidebar-header gap-1",
- headerRightPadding,
+ headerInset,
scrolled && "is-scrolled",
)}
{...dnd.dropZoneProps(
@@ -4578,7 +4574,7 @@ export function AppSidebar() {
<SidebarGroupLabel
className={cn(
"sidebar-sticky-label sidebar-sticky-label-following group/sidebar-header gap-1",
- headerRightPadding,
+ headerInset,
scrolled && "is-scrolled",
!projectsOpen &&
dnd.ringLit(sectionRingKey("projects")) &&
@@ -4683,9 +4679,8 @@ export function AppSidebar() {
<SidebarGroupLabel
className={cn(
"sidebar-sticky-label sidebar-sticky-label-following group/sidebar-header gap-1",
- recentsHeaderRightPadding,
+ headerInset,
scrolled && "is-scrolled",
- usesDesktopTitlebar && "translate-x-[2px]",
!chatOpen &&
dnd.ringLit(sectionRingKey("recents")) &&
DROP_INTO_HEADER_CUE,
@@ -4766,7 +4761,7 @@ export function AppSidebar() {
{showTrainingRecents && (
<Collapsible open={runsOpen} onOpenChange={setRunsOpen} asChild>
<SidebarGroup className="group/sb-section group-data-[collapsible=icon]:hidden px-0 py-0">
- <SidebarGroupLabel className={cn("sidebar-sticky-label sidebar-sticky-label-following", scrolled && "is-scrolled")} asChild>
+ <SidebarGroupLabel className={cn("sidebar-sticky-label sidebar-sticky-label-following", headerInset, scrolled && "is-scrolled")} asChild>
<CollapsibleTrigger className="cursor-pointer flex w-full items-center gap-1 group/sb-collap">
{t("shell.navigation.recents")}
<ChevronDown className="size-3.5 opacity-0 transition-[transform,opacity] duration-200 group-hover/sb-section:opacity-100 group-hover/sb-collap:opacity-100 group-focus-visible/sb-collap:opacity-100 data-[state=open]:rotate-0 [[data-state=closed]_&]:rotate-[-90deg] [[data-state=closed]_&]:opacity-100" />
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index e34de4b368a..227cd4327e1 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -1440,11 +1440,12 @@ html[data-chat-font] .aui-root {
color: #fff;
}
- /* pr-3, not pr-4: header actions end where a hovered row's "…" does (right-0
+ /* pl: the list's px-1.5 plus a row's pl-3 = 18px, so labels start where row content does.
+ pr-3, not pr-4: header actions end where a hovered row's "…" does (right-0
+ pr-1.5 inside a pill the list inset by px-1.5 = 12px). The desktop
titlebar insets by 5px, so those headers override this in app-sidebar.tsx. */
.sidebar-sticky-label {
- @apply rounded-none bg-sidebar pt-0 pb-[calc(8px*var(--ui-space-scale,1))] pl-[calc(16px*var(--ui-space-scale,1))] pr-3 text-ui-14! leading-ui-17 font-medium normal-case focus-visible:ring-0! focus-visible:outline-none transition-shadow duration-150;
+ @apply rounded-none bg-sidebar pt-0 pb-[calc(8px*var(--ui-space-scale,1))] pl-[calc(18px*var(--ui-space-scale,1))] pr-3 text-ui-14! leading-ui-17 font-medium normal-case focus-visible:ring-0! focus-visible:outline-none transition-shadow duration-150;
/* Muted section-header gray, matching Gemini's "Notebooks"/"Recents".
Lightened from #5f6368 so the label reads as a header, clearly
lighter than the near-black nav items. Follows the contrast slider. */
@@ -1455,11 +1456,9 @@ html[data-chat-font] .aui-root {
Tailwind emits utility classes before this components block, so putting
pr-[calc(11px*var(--ui-space-scale,1))]/pr-[calc(13px*var(--ui-space-scale,1))] on the element would lose the cascade. */
.sidebar-sticky-label.sidebar-sticky-label-desktop {
+ padding-left: calc(17px * var(--ui-space-scale, 1));
padding-right: calc(11px * var(--ui-space-scale, 1));
}
- .sidebar-sticky-label.sidebar-sticky-label-desktop-recents {
- padding-right: calc(13px * var(--ui-space-scale, 1));
- }
.sidebar-sticky-label-following {
@apply pt-[calc(21px*var(--ui-space-scale,1))];
}
diff --git a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts b/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
index 33a01e25990..05d29c7d6f4 100644
--- a/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
+++ b/studio/frontend/tests/on-device-dot-and-header-alignment.test.ts
@@ -619,16 +619,12 @@ test("list header actions end where a hovered row's action does", () => {
/\.sidebar-row-action \{\n\t\t@apply absolute top-0 bottom-0 right-0[^;]*pr-1\.5/,
);
const label = CSS.slice(CSS.indexOf(".sidebar-sticky-label {"));
- assert.match(label.slice(0, 400), /pl-\[16px\] pr-3 /);
+ // pl: unrailedRowPadding + a row's pl-3, so labels start where row content does.
+ assert.match(label.slice(0, 500), /pl-\[18px\] pr-3 /);
assert.ok(
CSS.includes(
- ".sidebar-sticky-label.sidebar-sticky-label-desktop {\n\t\tpadding-right: 11px;",
- ),
- );
- assert.ok(
- CSS.includes(
- ".sidebar-sticky-label.sidebar-sticky-label-desktop-recents {\n\t\tpadding-right: 13px;",
+ ".sidebar-sticky-label.sidebar-sticky-label-desktop {\n\t\tpadding-left: 17px;\n\t\tpadding-right: 11px;",
),
);
@@ -638,29 +634,19 @@ test("list header actions end where a hovered row's action does", () => {
);
assert.ok(
SIDEBAR.includes(
- 'const headerRightPadding = usesDesktopTitlebar\n ? "sidebar-sticky-label-desktop"\n : null;',
- ),
- );
- // Recents is nudged 2px right there and carries its padding with it.
- assert.ok(
- SIDEBAR.includes(
- 'const recentsHeaderRightPadding = usesDesktopTitlebar\n ? "sidebar-sticky-label-desktop-recents"\n : null;',
+ 'const headerInset = usesDesktopTitlebar\n ? "sidebar-sticky-label-desktop"\n : null;',
),
);
});
test("all three list headers take the same alignment", () => {
- // Pinned and Projects share one class string; Recents has its own because of
- // the translate. Two of the first, one of the second.
- // Both headers are drop zones now, so the class list is spread over lines.
+ // Pinned, Projects and Recents share one class string, and none is nudged on its own.
+ // They are drop zones, so the class list is spread over lines.
const shared = (
SIDEBAR.match(
- /"sidebar-sticky-label sidebar-sticky-label-following group\/sidebar-header gap-1",\n\s*headerRightPadding,/g,
+ /"sidebar-sticky-label sidebar-sticky-label-following group\/sidebar-header gap-1",\n\s*headerInset,/g,
) ?? []
).length;
- assert.equal(shared, 2, "Pinned and Projects");
- assert.ok(
- SIDEBAR.includes("recentsHeaderRightPadding,"),
- "and Recents applies its own",
- );
+ assert.equal(shared, 3, "Pinned, Projects and Recents");
+ assert.ok(!SIDEBAR.includes("translate-x-[2px]"));
});
diff --git a/studio/frontend/tests/sidebar-action-rows-inert.test.ts b/studio/frontend/tests/sidebar-action-rows-inert.test.ts
index 44369c61e56..3e6f30bf38a 100644
--- a/studio/frontend/tests/sidebar-action-rows-inert.test.ts
+++ b/studio/frontend/tests/sidebar-action-rows-inert.test.ts
@@ -53,7 +53,7 @@ test("desktop branding clears the titlebar actions", async () => {
test("desktop branding keeps an 11px gap above New chat", async () => {
const source = APP_SIDEBAR;
- assert.match(source, /usesDesktopTitlebar \? "pt-\[11px\]" : "pt-\[9px\]"/);
+ assert.match(source, /usesDesktopTitlebar \? "pt-\[11px\]" : "pt-\[7px\]"/);
});
test("footer profile sits 11px above the sidebar edge", async () => {
@@ -160,10 +160,8 @@ test("the sidebar list measures its scroll rail", async () => {
);
});
-test("Tauri chat Recents label keeps its 2px shift", async () => {
+test("Tauri chat Recents label takes the shared header inset, not a shift", async () => {
const source = APP_SIDEBAR;
- assert.match(
- source,
- /scrolled && "is-scrolled",\s*usesDesktopTitlebar && "translate-x-\[2px\]"/,
- );
+ assert.match(source, /headerInset,\s*scrolled && "is-scrolled",\s*!chatOpen/);
+ assert.doesNotMatch(source, /translate-x-\[2px\]/);
});