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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Fix image page pane and header alignment (#8176)
Lee Jacksona1fc4d42ff87
diff --git a/studio/frontend/src/components/media-page-link.tsx b/studio/frontend/src/components/media-page-link.tsxindex 07643d250cd..6be5fd42b23 100644--- a/studio/frontend/src/components/media-page-link.tsx+++ b/studio/frontend/src/components/media-page-link.tsx@@ -11,6 +11,7 @@ import {TooltipContent,TooltipTrigger,} from "@/components/ui/tooltip";+import { cn } from "@/lib/utils";/** The link out to another page's workspace (Images, Video, image training). Kept out of the* page's mode strip, which switches modes within a page, and parked at the far right past a@@ -21,6 +22,8 @@ export function MediaPageLink({icon,tooltip,onNavigate,+ labelClassName,+ arrowClassName,}: {to: "/images" | "/video";label: string;@@ -29,6 +32,10 @@ export function MediaPageLink({tooltip?: string;/** Runs before the route change, for a destination whose mode lives in a store. */onNavigate?: () => void;+ /** Responsive callers can visually collapse the label while the button keeps its accessible name. */+ labelClassName?: string;+ /** Kept separate from the label because the outbound arrow is the first compact affordance to drop. */+ arrowClassName?: string;}) {const navigate = useNavigate();return (@@ -43,6 +50,7 @@ export function MediaPageLink({<TooltipTrigger asChild={true}><buttontype="button"+ aria-label={label}onClick={() => {onNavigate?.();navigate({ to });@@ -50,10 +58,10 @@ export function MediaPageLink({className="flex h-[34px] min-w-0 items-center gap-1.5 rounded-full pl-2.5 pr-2 text-ui-13 font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"><HugeiconsIcon icon={icon} className="size-4 shrink-0" />- <span className="min-w-0 truncate">{label}</span>+ <span className={cn("min-w-0 truncate", labelClassName)}>{label}</span><HugeiconsIconicon={ArrowRight02Icon}- className="size-3.5 shrink-0 opacity-60"+ className={cn("size-3.5 shrink-0 opacity-60", arrowClassName)}/></button></TooltipTrigger>diff --git a/studio/frontend/src/features/images/images-page.tsx b/studio/frontend/src/features/images/images-page.tsxindex d038658b255..79e95c6da60 100644--- a/studio/frontend/src/features/images/images-page.tsx+++ b/studio/frontend/src/features/images/images-page.tsx@@ -2990,14 +2990,14 @@ export function ImagesPage({ active = true }: { active?: boolean }) {return (// The chat-style layout gives this page no outer top inset, so clear the custom// titlebar here (34px on win/linux, 0 under macOS's native one) as chat does.- <div className="diffusion-surface flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]">- {/* Top: the model selector, sitting clear of the sidebar and level with the settings column below. Load progress shows in a toast. */}- {/* grid at every width, not an overlay below md: the absolute mode switch painted over the model selector and the Video link. */}- {/* @container, not md:/xl:, because the header is the viewport minus a sidebar the user can drag between 260px and 480px. */}- <div className="@container pointer-events-none relative z-40 grid h-[48px] shrink-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-start gap-2 pt-[var(--studio-chat-header-padding-top,11px)]">+ <div className="diffusion-surface @container flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden pt-[var(--studio-content-top-inset,0px)]">+ {/* Below 50rem, equal side tracks keep the mode switch centered without overlaying+ either action group. Above it, the 408px rail continues through the header and+ Create / Train centers over the preview pane. */}+ <div className="pointer-events-none relative z-40 grid h-[48px] shrink-0 grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] gap-2 @[50rem]:grid-cols-[408px_minmax(0,1fr)] @[50rem]:gap-0"><divclassName={cn(- "pointer-events-none flex min-w-0 items-center",+ "pointer-events-none flex h-full min-w-0 items-start overflow-hidden @[50rem]:border-r @[50rem]:border-border/60",isMobile? "pl-12": !pinned && isTauri@@ -3005,14 +3005,13 @@ export function ImagesPage({ active = true }: { active?: boolean }) {: "pl-[var(--studio-media-header-left-inset,1.5rem)]",)}>- <div className="pointer-events-auto flex min-w-0 max-w-full items-center gap-2">+ <div className="pointer-events-auto flex min-w-0 max-w-full items-center gap-2 overflow-hidden pt-[var(--studio-chat-header-padding-top,11px)]">{pageMode === "train" ? (<TrainBaseSelectorfamilies={trainFamilies}familyName={trainFamilyName}base={trainBaseChoice}onSelect={(family, repo) => {- // Set both together: the panel reseed effect keeps a base valid for the new family.setTrainFamilyName(family);setTrainBaseChoice(repo);}}@@ -3033,62 +3032,49 @@ export function ImagesPage({ active = true }: { active?: boolean }) {onOpenChange={(o) => setSelectorOpen(active && o)}/>)}- {/* The load's own cancel, beside the selector rather than inside it: the selector's eject needs a- resident model, so it is hidden for exactly the span a first load runs. A real button, not the- trigger's aria-hidden eject hit area, so it is reachable by keyboard and a screen reader. Says- "load", never "download": the download manager's own Cancel stops a staged pull, a different job. */}- {pageMode !== "train" && busy === "loading" && (- <Tooltip>- <TooltipTrigger asChild={true}>- <Button- type="button"- variant="outline"- size="sm"- aria-label="Cancel load"- className="!h-[34px] rounded-full text-xs"- onClick={() => void handleCancelLoad()}- >- Cancel load- </Button>- </TooltipTrigger>- <TooltipContent>Stop loading this model</TooltipContent>- </Tooltip>- )}+ {pageMode !== "train" && busy === "loading" && (+ <Tooltip>+ <TooltipTrigger asChild={true}>+ <Button+ type="button"+ variant="outline"+ size="sm"+ aria-label="Cancel load"+ className="!h-[34px] rounded-full text-xs"+ onClick={() => void handleCancelLoad()}+ >+ Cancel load+ </Button>+ </TooltipTrigger>+ <TooltipContent>Stop loading this model</TooltipContent>+ </Tooltip>+ )}</div></div>- {/* Create | Train page-mode switch, centred on the page rather than tied to the selector width. PillTabs is the app segmented control. */}- {/* No padding on the grid, so the equal side tracks centre the pill on the header itself; px-11 makes the pair 277px, so it waits for the room. */}- <PillTabs- ariaLabel="Page mode"- value={pageMode}- onValueChange={(v) => setPageMode(v as "create" | "train")}- fit={true}- className="pointer-events-auto h-[34px] justify-self-center [&>button]:h-[34px] [&>button]:px-3 @min-[560px]:[&>button]:px-11"- tabs={[- {- value: "create",- label: "Create",- icon: (- <HugeiconsIcon icon={SparklesIcon} className="size-3.5" />- ),- },- {- value: "train",- label: "Train",- icon: (- <HugeiconsIcon- icon={TestTubeOutlineIcon}- className="size-3.5"- />- ),- },- ]}- />- {/* pr-2 rides the wrapper, not the grid: on the grid it would shift the centred pill by half of it. */}- <div className="pointer-events-none flex min-w-0 items-center justify-end pr-2">- {/* Video is a separate page, so it sits out here rather than in the mode strip. */}- <div className="pointer-events-auto flex min-w-0 items-center gap-2">- <MediaPageLink to="/video" label="Video" icon={FlimSlateIcon} />+ <div className="contents @[50rem]:grid @[50rem]:h-full @[50rem]:min-w-0 @[50rem]:grid-cols-[1fr_auto_1fr]">+ <div className="pointer-events-auto justify-self-center pt-[var(--studio-chat-header-padding-top,11px)] @[50rem]:col-start-2">+ <PillTabs+ ariaLabel="Page mode"+ value={pageMode}+ onValueChange={(v) => setPageMode(v as "create" | "train")}+ fit={true}+ className="h-[34px] [&>button]:h-[34px] [&>button]:px-3 @[68rem]:[&>button]:px-11"+ tabs={[+ { value: "create", label: "Create", icon: <HugeiconsIcon icon={SparklesIcon} className="size-3.5" /> },+ { value: "train", label: "Train", icon: <HugeiconsIcon icon={TestTubeOutlineIcon} className="size-3.5" /> },+ ]}+ />+ </div>+ <div className="pointer-events-none flex min-w-0 items-start justify-end pr-2 pt-[var(--studio-chat-header-padding-top,11px)] @[50rem]:col-start-3">+ <div className="pointer-events-auto flex min-w-0 items-center gap-2">+ <MediaPageLink+ to="/video"+ label="Video"+ icon={FlimSlateIcon}+ labelClassName="hidden @[50rem]:inline"+ arrowClassName="hidden @[50rem]:block"+ />+ </div></div></div></div>@@ -3110,14 +3096,11 @@ export function ImagesPage({ active = true }: { active?: boolean }) {onFamiliesChange={setTrainFamilies}/>) : (- /* Settings column + preview canvas: both on the page background, split by a rule. Each pane pads its own content.- Full width, so the canvas grows with the window; the settings column stays fixed.- pl-8 puts its content 40px in, level with the model selector label above and- with pr-8 on the other side of the column.- overflow-x-hidden because an unset overflow-x computes to auto beside overflow-y-auto,- which would let a wide row pan the page sideways on a phone. */- <div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pl-2 pr-5 pt-9 sm:pr-8 md:flex-row md:overflow-hidden">- <div className="relative flex w-full shrink-0 flex-col border-b border-border/60 pl-8 md:w-[408px] md:overflow-hidden md:border-r md:border-b-0">+ /* Settings column + preview canvas. Structural borders stay edge-to-edge;+ spacing belongs inside each pane. The same 50rem page-container breakpoint+ drives this body and the header above, regardless of sidebar width. */+ <div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden @[50rem]:flex-row @[50rem]:overflow-hidden">+ <div className="relative flex w-full shrink-0 flex-col border-b border-border/60 @[50rem]:w-[408px] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0">{/* pl-0.5 keeps focus rings off the scroll container's edge. */}<divref={attachSettingsScroll}@@ -3126,7 +3109,7 @@ export function ImagesPage({ active = true }: { active?: boolean }) {// pb-20 at every width: the floating Generate button below is absolutely// positioned over this rail and stands 72px tall (h-11 + pb-7), so a smaller// phone padding puts it on top of the last control.- "hover-scrollbar panel-scroll-fade flex min-h-0 flex-1 flex-col gap-4 pb-20 pl-0.5 pr-8 md:overflow-y-auto",+ "hover-scrollbar panel-scroll-fade flex min-h-0 flex-1 flex-col gap-4 px-10 pt-9 pb-20 @[50rem]:overflow-y-auto",settingsFadeClass,)}>@@ -3666,7 +3649,7 @@ export function ImagesPage({ active = true }: { active?: boolean }) {</div>{/* Floats over the settings so it needs no bar of its own. */}- <div className="pointer-events-none absolute inset-x-0 bottom-0 flex justify-center pb-7 pl-8 pr-8">+ <div className="pointer-events-none absolute inset-x-0 bottom-0 flex justify-center px-10 pb-7">{busy === "generating" ? (/* Replaces Generate while a run is in flight, mirroring the video page. Every workflow(Create, Transform, Inpaint, Extend, Upscale, Reference, Edit) funnels through the@@ -3692,9 +3675,8 @@ export function ImagesPage({ active = true }: { active?: boolean }) {</div></div>- <div className="relative flex min-h-[60dvh] min-w-0 flex-1 flex-col overflow-hidden pl-2 md:min-h-0">- {/* With the pane's pl-2, the 40px gutter the settings column has off the page edge. */}- <div className="hover-scrollbar relative flex flex-1 items-center justify-center overflow-auto p-6 pl-8">+ <div className="relative flex min-h-[60dvh] min-w-0 flex-1 flex-col overflow-hidden @[50rem]:min-h-0">+ <div className="hover-scrollbar relative flex flex-1 items-center justify-center overflow-auto p-6 px-10 @[50rem]:pt-[60px]">{selected && selectedSrc ? (<><img@@ -3793,8 +3775,8 @@ export function ImagesPage({ active = true }: { active?: boolean }) {{(images.length > 0 || busy === "generating") && (<divref={stripRef}- // Same 40px gutter as the viewer above.- className="hover-scrollbar flex shrink-0 gap-2 overflow-x-auto border-t border-foreground/10 p-3 pl-8"+ // The rule spans the pane; only the thumbnail contents receive the 40px gutter.+ className="hover-scrollbar flex shrink-0 gap-2 overflow-x-auto border-t border-foreground/10 px-10 py-3"onScroll={(e) => {// Near the right edge: pull the next older page (infinite scroll).const el = e.currentTarget;diff --git a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx b/studio/frontend/src/features/images/train/diffusion-train-panel.tsxindex c5fd1f88438..4632a803d22 100644--- a/studio/frontend/src/features/images/train/diffusion-train-panel.tsx+++ b/studio/frontend/src/features/images/train/diffusion-train-panel.tsx@@ -1423,13 +1423,10 @@ export function DiffusionTrainPanel({// overflow-x-hidden: an unset overflow-x computes to auto beside overflow-y-auto,// letting a wide row pan the page sideways on a phone.return (- <div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pl-2 pr-5 pt-9 sm:pr-8 md:flex-row md:overflow-hidden">- {/* Left: configure. No cards: both panes sit on the page background, split by a full-height rule. */}- {/* Gutters match the Create tab: pl-8 puts the content 40px in, level with the model- selector above; pr-8 sets the gap to the rule. */}- <div className="relative flex w-full min-w-0 shrink-0 flex-col border-b border-border/60 pl-8 md:w-[416px] md:overflow-hidden md:border-r md:border-b-0">- {/* pl-0.5 keeps focus rings off the scroll container's edge. pt-1.5- matches the right pane's p-1.5, so both headings start on the same line. */}+ <div className="flex min-h-0 w-full min-w-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pr-5 sm:pr-8 @[50rem]:flex-row @[50rem]:overflow-hidden">+ {/* Left: configure. The 408px rail and container breakpoint match Create and the shared header. */}+ <div className="relative flex w-full min-w-0 shrink-0 flex-col border-b border-border/60 pl-10 @[50rem]:w-[408px] @[50rem]:overflow-hidden @[50rem]:border-r @[50rem]:border-b-0">+ {/* Keep the former row-level top inset inside the pane so the divider reaches the header. */}<divref={attachSettingsScroll}onScroll={onSettingsScroll}@@ -1437,7 +1434,7 @@ export function DiffusionTrainPanel({// pb-20 at every width: the floating Start training button below is absolutely// positioned over this rail and stands 72px tall (h-11 + pb-7), so a smaller// phone padding puts it on top of the Adapter name field.- "hover-scrollbar panel-scroll-fade flex min-h-0 flex-1 flex-col gap-5 overflow-x-hidden pb-20 pl-0.5 pr-8 pt-1.5 md:overflow-y-auto",+ "hover-scrollbar panel-scroll-fade flex min-h-0 flex-1 flex-col gap-5 overflow-x-hidden pb-20 pl-0.5 pr-8 pt-[42px] @[50rem]:overflow-y-auto",settingsFadeClass,)}>@@ -1786,8 +1783,8 @@ export function DiffusionTrainPanel({{/* Right: the run area. Before a run: training settings + previous-runs history; during/after: the live view. Selecting a previous run re-plots its logs read-only. */}{/* Sections carry no card of their own: spacing and a rule separate them. p-1.5 keeps the chart cards' outer ring from being clipped. */}{/* 40px off the rule, the gutter the settings column has off the page edge. */}- {/* @container: this pane is whatever is left beside the 416px rail, so sm: put four stat cells in ~266px against the 396px they need. */}- <div className="@container hover-scrollbar relative flex min-w-0 flex-1 flex-col gap-5 p-1.5 pb-7 pl-8 md:overflow-y-auto md:pl-10">+ {/* This pane remains a query container for its own stat and chart breakpoints. */}+ <div className="@container hover-scrollbar relative flex min-w-0 flex-1 flex-col gap-5 pb-7 pl-10 pr-1.5 pt-4 @[50rem]:overflow-y-auto @[50rem]:pt-[42px]">{viewRun && !hasRun ? (<><div className="flex flex-col gap-3">diff --git a/tests/studio/test_desktop_reliability_frontend_contract.py b/tests/studio/test_desktop_reliability_frontend_contract.pyindex e8c612d22ea..ccce7c3860d 100644--- a/tests/studio/test_desktop_reliability_frontend_contract.py+++ b/tests/studio/test_desktop_reliability_frontend_contract.py@@ -41,6 +41,9 @@ DESKTOP_UPDATE_POLICY = REPO / "studio/src-tauri/src/desktop_update_policy.rs"APP_PROVIDER = FRONTEND / "app/provider.tsx"ROOT_ROUTE = FRONTEND / "app/routes/__root.tsx"IMAGES_PAGE = FRONTEND / "features/images/images-page.tsx"++DIFFUSION_TRAIN_PANEL = FRONTEND / "features/images/train/diffusion-train-panel.tsx"+MEDIA_PAGE_LINK = FRONTEND / "components/media-page-link.tsx"VIDEO_PAGE = FRONTEND / "features/video/video-page.tsx"VIDEO_API = FRONTEND / "features/video/api.ts"RAG_API = FRONTEND / "features/rag/api/rag-api.ts"@@ -733,6 +736,41 @@ def test_media_pages_clear_the_custom_titlebar():assert "pt-[var(--studio-content-top-inset,0px)]" in shell, page.name+def test_image_page_structural_panes_share_the_container_breakpoint():+ source = IMAGES_PAGE.read_text(encoding = "utf-8")+ shell = source.split('className="diffusion-surface', 1)[1].split(">", 1)[0]+ section = source.split("Settings column + preview canvas", 1)[1]++ assert "@container" in shell+ assert "@[50rem]:flex-row @[50rem]:overflow-hidden" in section+ assert "@[50rem]:w-[408px]" in section+ assert "md:flex-row" not in section+ assert "gap-4 px-10 pt-9 pb-20 @[50rem]:overflow-y-auto" in section+ assert "p-6 px-10 @[50rem]:pt-[60px]" in section+ assert "border-t border-foreground/10 px-10 py-3" in section+++def test_image_train_rail_matches_create_and_header():+ source = DIFFUSION_TRAIN_PANEL.read_text(encoding = "utf-8")+ layout = source.split("overflow-x-hidden: an unset overflow-x", 1)[1]++ assert "@[50rem]:flex-row @[50rem]:overflow-hidden" in layout+ assert "pl-10 @[50rem]:w-[408px]" in layout+ assert "@[50rem]:border-r @[50rem]:border-b-0" in layout+ assert "@container hover-scrollbar" in layout+ assert "@[50rem]:pt-[42px]" in layout+ assert "md:w-[416px]" not in layout+++def test_compact_media_link_keeps_accessible_name_and_truncation():+ source = MEDIA_PAGE_LINK.read_text(encoding = "utf-8")+ button = source.split("<button", 1)[1].split("</button>", 1)[0]++ assert "aria-label={label}" in button+ assert 'cn("min-w-0 truncate", labelClassName)' in button+ assert "arrowClassName" in button++def test_media_page_headers_out_stack_the_mac_drag_region():"""macOS insets the media pages 0px, so their 48px header overlaps the navbar's 34px dragstrip: the band must out-stack it yet stay click-through (controls click, gaps drag)."""@@ -759,8 +797,7 @@ def test_media_page_headers_out_stack_the_mac_drag_region():assert "pointer-events-auto" in group, (page.name, group)-def test_images_header_clears_collapsed_tauri_titlebar_controls():- """Images clears collapsed controls without overlapping its narrow-desktop tabs."""+def test_images_header_tracks_preview_and_preserves_titlebar_controls():source = IMAGES_PAGE.read_text(encoding = "utf-8")before, marker, after = source.partition("h-[48px] shrink-0")assert marker@@ -768,25 +805,20 @@ def test_images_header_clears_collapsed_tauri_titlebar_controls():header = opening + after.split("{/* Train mode", 1)[0]assert "const { isMobile, pinned } = useSidebar();" in source- # The tracks carry the insets, so the grid stays unpadded and centres the pill on the header.assert "grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)]" in opening- assert not re.search(r"\bp[lrx]-", opening), opening- assert "isMobile" in header- assert "pl-12" in header+ assert "@[50rem]:grid-cols-[408px_minmax(0,1fr)]" in opening+ assert "@[50rem]:border-r" in header+ assert "isMobile" in header and "pl-12" in headerassert "!pinned && isTauri" in headerassert "pl-[var(--studio-collapsed-chat-controls-inset,0.75rem)]" in header- assert "pl-[var(--studio-media-header-left-inset,1.5rem)]" in header- left_controls = header.split("Create | Train page-mode switch", 1)[0]- assert '"pointer-events-none flex min-w-0 items-center"' in left_controls- assert '"pointer-events-auto flex min-w-0 max-w-full items-center gap-2"' in left_controls- assert 'className="!h-[34px] max-w-full overflow-hidden"' in left_controls-- # The pill is a grid item at every width, and its padding keys off the header's own width:- # md:/xl: are viewport queries, while the header is the viewport minus a resizable sidebar.- mode_switch = source.split("Create | Train page-mode switch", 1)[1].split("tabs={[", 1)[0]- assert "absolute" not in mode_switch- assert "justify-self-center" in mode_switch- assert "[&>button]:px-3 @min-[560px]:[&>button]:px-11" in mode_switch+ assert 'className="!h-[34px] max-w-full overflow-hidden"' in header+ assert "contents @[50rem]:grid" in header+ assert "@[50rem]:grid-cols-[1fr_auto_1fr]" in header+ assert "@[50rem]:col-start-2" in header+ assert "@[50rem]:col-start-3" in header+ assert 'labelClassName="hidden @[50rem]:inline"' in header+ assert 'arrowClassName="hidden @[50rem]:block"' in header+ assert "absolute" not in header.split("<PillTabs", 1)[0]def test_a_stopped_repair_update_is_recorded_as_canceled_not_failed():