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: add a New badge beside Audio in the sidebar (#12891)

Etherl0587140f4147
diff --git a/studio/frontend/src/components/app-sidebar.tsx b/studio/frontend/src/components/app-sidebar.tsx
index b5aa38db10d..92d6dcd3f4f 100644
--- a/studio/frontend/src/components/app-sidebar.tsx
+++ b/studio/frontend/src/components/app-sidebar.tsx
@@ -61,6 +61,7 @@ import {
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
+import { Badge } from "@/components/ui/badge";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
import { Spinner } from "@/components/ui/spinner";
@@ -71,7 +72,7 @@ import {
shouldUseCustomWindowTitlebar,
shouldUseNativeMacWindowTitlebar,
} from "@/components/tauri/window-titlebar";
-// Deep imports on purpose: the Images index re-exports ImagesPage, which would undo its code split.
+// deep imports avoid the Images index because its ImagesPage re-export would undo the code split.
/* eslint-disable no-restricted-imports */
import {
isWorkflowEnabled,
@@ -589,19 +590,6 @@ function preloadSilently(request: Promise<unknown>): void {
void request.catch(() => undefined);
}
-function NavBadge({ label, className }: { label: string; className?: string }) {
- return (
- <span
- className={cn(
- "nav-badge inline-flex shrink-0 items-center justify-center rounded-full border border-nav-beta-border px-[calc(5px*var(--ui-space-scale,1))] pt-[calc(3px*var(--ui-space-scale,1))] pb-[calc(2px*var(--ui-space-scale,1))] text-[calc(0.5rem*var(--ui-font-scale,1))] font-medium uppercase leading-none tracking-[0.04em] text-nav-fg-muted antialiased subpixel-antialiased shadow-[0_1px_2px_rgba(0,0,0,0.06)] dark:shadow-[0_1px_2px_var(--background)]",
- className,
- )}
- >
- {label}
- </span>
- );
-}
-
function NavItem({
icon,
label,
@@ -660,18 +648,16 @@ function NavItem({
<HugeiconsIcon icon={icon} strokeWidth={1.75} className="size-icon! shrink-0 translate-x-0.5 group-data-[collapsible=icon]:translate-x-0 group-hover/menu-button:animate-icon-pop" />
<span className="text-ui-14p5 leading-ui-19 tracking-nav">{label}</span>
{badge && (
- <NavBadge
- label={badge}
- className="ml-auto group-data-[collapsible=icon]:hidden"
- />
+ <Badge variant="secondary" className="group-data-[collapsible=icon]:hidden">
+ {badge}
+ </Badge>
)}
{spinner && (
- // mr-1.5 over the row's pr-2.5 = 16px, matching the chat rows' pr-4: one spinner column.
+ // mr-1.5 plus the row's pr-2.5 makes 16px, matching the chat row spinner column.
<Spinner className="ml-auto mr-1.5 size-3.5 shrink-0 text-muted-foreground group-data-[collapsible=icon]:hidden" />
)}
</SidebarMenuButton>
{spinner && (
- // Collapsed (icon-only) rail: small spinner badge over the icon corner.
<Spinner className="pointer-events-none absolute right-1 top-1 hidden size-2.5 text-muted-foreground group-data-[collapsible=icon]:block" />
)}
{overlay}
@@ -936,8 +922,7 @@ function MoreMenuItem({
return (
<DropdownMenuItem
disabled={disabled}
- // Whenever there is one: gated on `disabled` it dropped the tooltip of a row that is
- // still being measured, which is enabled and has something to say.
+ // keep the tooltip while capability measurement leaves the row enabled.
title={tooltip}
onSelect={onSelect}
onPointerEnter={disabled ? undefined : onIntent}
@@ -946,7 +931,7 @@ function MoreMenuItem({
>
<HugeiconsIcon icon={icon} strokeWidth={1.75} />
<span className="min-w-0 flex-1 truncate">{label}</span>
- {badge && <NavBadge label={badge} />}
+ {badge && <Badge variant="secondary">{badge}</Badge>}
{spinner && <Spinner className="size-3.5 shrink-0 text-muted-foreground" />}
</DropdownMenuItem>
);
@@ -987,7 +972,7 @@ function AudioMoreSubmenu({
title={tooltip}
onPointerEnter={disabled ? undefined : onIntent}
onFocus={disabled ? undefined : onIntent}
- // A click opens Audio itself; hover and the keyboard still open the workflows.
+ // click opens Audio; hover and keyboard still open the workflows.
onClick={(event) => {
if (disabled) return;
event.preventDefault();
@@ -997,7 +982,7 @@ function AudioMoreSubmenu({
>
<HugeiconsIcon icon={icon} strokeWidth={1.75} />
<span className="min-w-0 flex-1 truncate">{label}</span>
- {badge && <NavBadge label={badge} />}
+ {badge && <Badge variant="secondary">{badge}</Badge>}
{spinner && (
<Spinner className="size-3.5 shrink-0 text-muted-foreground" />
)}
@@ -2819,6 +2804,7 @@ export function AppSidebar() {
audio: {
icon: AudioWave01Icon,
label: t("shell.navigation.audio"),
+ badge: t("shell.navigation.newBadge"),
active: pathname === "/audio" || pathname.startsWith("/audio/"),
onClick: () => {
navigateFromRow({ to: "/audio" });
diff --git a/studio/frontend/tests/audio-sidebar-workflows.test.ts b/studio/frontend/tests/audio-sidebar-workflows.test.ts
index 905996175ba..7c5d70e223a 100644
--- a/studio/frontend/tests/audio-sidebar-workflows.test.ts
+++ b/studio/frontend/tests/audio-sidebar-workflows.test.ts
@@ -172,6 +172,26 @@ test("the Audio row stays lit while hovered, like Images", () => {
);
});
+test("a nav row's New pill sits beside its label, clear of the trailing disclosure", () => {
+ const item = block(
+ SIDEBAR,
+ "function NavItem(",
+ "const WORKFLOW_UNAVAILABLE",
+ );
+ // no ml-auto: a trailing pill would sit under the overlay's chevron.
+ assert.match(
+ item,
+ /<Badge\s+variant="secondary"\s+className="group-data-\[collapsible=icon\]:hidden"\s*>\s*\{badge\}/,
+ );
+ assert.match(item, /\{overlay\}/);
+ const more = block(
+ SIDEBAR,
+ "{overflowNavIds.map((id) => {",
+ "<DropdownMenuSeparator",
+ );
+ assert.equal(more.match(/badge=\{row\.badge\}/g)?.length, 2);
+});
+
test("Audio is still unpinned by default", () => {
const store = readSrc("features/settings/stores/appearance-custom-store.ts");
assert.match(