Skip to content

Modern Docker Management, Designed for Everyone

fix(ui): stop header actions overlapping badges and add per-device layout mode (#4121)

Kyle Mendell9454ce57db67
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index 17b6cd528..dfba01710 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -8,6 +8,13 @@
"accent_color_description": "Select an accent color to customize the appearance of Arcane",
"font_size": "Font size",
"font_size_description": "Adjust the size of text and the UI",
+ "layout_mode": "Layout",
+ "layout_mode_description": "How Arcane lays out the interface on this device. Automatic follows the screen width.",
+ "layout_mode_auto_description": "Mobile layout on narrow screens, desktop layout otherwise.",
+ "layout_mode_mobile": "Mobile",
+ "layout_mode_mobile_description": "Card lists and bottom navigation.",
+ "layout_mode_desktop": "Desktop",
+ "layout_mode_desktop_description": "Tables and sidebar navigation.",
"application_theme": "Application Theme",
"application_theme_description": "Choose the overall visual theme for Arcane. This setting is stored globally and previews immediately.",
"application_theme_default": "Default",
@@ -1117,6 +1124,7 @@
"swarm_service_rollback_failed": "Failed to rollback service \"{name}\"",
"swarm_service_logs_title": "Service Logs",
"swarm_service_scale": "Scale",
+ "swarm_service_scale_description": "Set the desired number of replicas for \"{name}\".",
"swarm_service_scale_success": "Scaled \"{name}\" to {replicas} replicas",
"swarm_tasks_subtitle_node_scoped": "Monitor Swarm tasks (node scoped)",
"cluster": "Cluster",
diff --git a/frontend/src/lib/components/action-buttons.svelte b/frontend/src/lib/components/action-buttons.svelte
index 7e97e8703..b6647da30 100644
--- a/frontend/src/lib/components/action-buttons.svelte
+++ b/frontend/src/lib/components/action-buttons.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { onMount } from 'svelte';
+ import { flushSync } from 'svelte';
import type { Snippet } from 'svelte';
import { openConfirmDialog } from './confirm-dialog';
import { goto, refreshAll } from '$app/navigation';
@@ -49,7 +49,6 @@
name,
type = 'container',
itemState = 'stopped',
- desktopVariant = 'labels',
loading = $bindable<LoadingStates>({}),
onActionComplete = $bindable<(status?: string) => void>(() => {}),
startLoading = $bindable(false),
@@ -63,6 +62,8 @@
disabled = false,
disabledReason,
onRefresh,
+ leadingActions,
+ leadingMenuItems,
beforeRemoveActions,
beforeRemoveMenuItems
}: {
@@ -70,7 +71,6 @@
name?: string;
type?: TargetType;
itemState?: string;
- desktopVariant?: 'labels' | 'adaptive';
loading?: LoadingStates;
onActionComplete?: (status?: string) => void;
startLoading?: boolean;
@@ -84,6 +84,8 @@
disabled?: boolean;
disabledReason?: string;
onRefresh?: () => void | Promise<void>;
+ leadingActions?: Snippet<[ArcaneButtonSize, boolean, boolean]>;
+ leadingMenuItems?: Snippet<[boolean]>;
beforeRemoveActions?: Snippet<[ArcaneButtonSize, boolean, boolean]>;
beforeRemoveMenuItems?: Snippet<[boolean]>;
} = $props();
@@ -238,30 +240,69 @@
return configuredProvider;
});
- // Tailwind xl breakpoint is 1280px. We use this to avoid mounting two desktop variants at once
- // (which would duplicate portaled popovers when the same `open` state is bound twice).
- let isXlUp = $state(true);
- let isLgUp = $state(true);
- const adaptiveIconOnly = $derived(!isXlUp);
+ // The header gives this component a spanning column whose width does not depend on
+ // its content (flex-1 basis-0). We measure the rendered row against that column and
+ // step labels -> icons -> menu until it fits, then probe back up when space returns.
+ // Measuring the real row (instead of an invisible mirror) keeps root font size and
+ // locale label widths in the equation and never mounts the actions twice.
+ type Tier = 'labels' | 'icons' | 'menu';
+ const TIERS: Tier[] = ['labels', 'icons', 'menu'];
+ let tier = $state<Tier>('labels');
+ let rootEl: HTMLElement | undefined;
+ let rowEl: HTMLElement | undefined;
+
+ function fits() {
+ // Commit the current `tier` to the DOM before reading layout.
+ flushSync();
+ if (!rootEl || !rowEl) return true;
+ return rowEl.getBoundingClientRect().width <= rootEl.getBoundingClientRect().width + 0.5;
+ }
- onMount(() => {
- const mqlXl = window.matchMedia('(min-width: 1280px)');
- const mqlLg = window.matchMedia('(min-width: 1024px)');
+ // Step down until the row fits, then probe upward while the larger tier still fits.
+ // `mayLeaveMenu` is false for row-content triggers (label or loading changes) so an
+ // open ellipsis menu is never unmounted underneath the user.
+ function resolveTier(mayLeaveMenu: boolean) {
+ let i = TIERS.indexOf(tier);
+ while (!fits() && i < TIERS.length - 1) {
+ i++;
+ tier = TIERS[i] ?? 'menu';
+ }
+ while (i > 0 && (tier !== 'menu' || mayLeaveMenu)) {
+ const larger = TIERS[i - 1] ?? 'labels';
+ tier = larger;
+ if (fits()) {
+ i--;
+ } else {
+ tier = TIERS[i] ?? 'menu';
+ break;
+ }
+ }
+ }
- const update = () => {
- isXlUp = mqlXl.matches;
- isLgUp = mqlLg.matches;
+ function observeRoot(node: HTMLElement) {
+ rootEl = node;
+ const ro = new ResizeObserver(() => resolveTier(true));
+ ro.observe(node);
+ // The floating header bubble is shrink-to-fit, so its column does not grow when the
+ // viewport does; listen to the window as well so we can probe back up.
+ const onResize = () => resolveTier(true);
+ window.addEventListener('resize', onResize);
+ return () => {
+ ro.disconnect();
+ window.removeEventListener('resize', onResize);
+ rootEl = undefined;
};
+ }
- update();
-
- mqlXl.addEventListener('change', update);
- mqlLg.addEventListener('change', update);
+ function observeRow(node: HTMLElement) {
+ rowEl = node;
+ const ro = new ResizeObserver(() => resolveTier(false));
+ ro.observe(node);
return () => {
- mqlXl.removeEventListener('change', update);
- mqlLg.removeEventListener('change', update);
+ ro.disconnect();
+ if (rowEl === node) rowEl = undefined;
};
- });
+ }
async function handleRefresh() {
if (!onRefresh) return;
@@ -606,6 +647,8 @@
{/snippet}
{#snippet DesktopActions(size: 'default' | 'icon', showLabel: boolean)}
+ {@render leadingActions?.(size, showLabel, isLifecycleActionPending)}
+
{#if !isRunning && canStart}
{#if type === 'container'}
<ArcaneButton
@@ -723,6 +766,7 @@
class="z-[var(--arcane-z-surface)] min-w-[180px] rounded-xl border bg-popover/20 p-1 shadow-lg backdrop-blur-md"
>
<DropdownMenu.Group>
+ {@render leadingMenuItems?.(isLifecycleActionPending)}
{#if !isRunning && canStart}
{#if type === 'container'}
<DropdownMenu.Item onclick={handleStart} disabled={disabled || uiLoading.start} title={disabledReason}>
@@ -793,27 +837,14 @@
</DropdownMenu.Root>
{/snippet}
-{#if desktopVariant === 'adaptive'}
- <div>
- <!-- On xl+ show labels; below xl use icon-only to avoid overflow in constrained headers (sidebar layouts) -->
- {#if isLgUp}
- <div class="flex items-center gap-2">
- {@render DesktopActions(adaptiveIconOnly ? 'icon' : 'default', !adaptiveIconOnly)}
- </div>
- {:else}
- <div class="flex items-center">
- {@render ActionsMenu()}
- </div>
- {/if}
- </div>
-{:else}
- <div>
- <div class="hidden items-center gap-2 lg:flex">
- {@render DesktopActions('default', true)}
- </div>
-
- <div class="flex items-center lg:hidden">
+<div class="flex min-w-0 flex-1 justify-end" {@attach observeRoot}>
+ {#if tier === 'menu'}
+ <div class="flex shrink-0 items-center" {@attach observeRow}>
{@render ActionsMenu()}
</div>
- </div>
-{/if}
+ {:else}
+ <div class="flex shrink-0 items-center gap-2" {@attach observeRow}>
+ {@render DesktopActions(tier === 'labels' ? 'default' : 'icon', tier === 'labels')}
+ </div>
+ {/if}
+</div>
diff --git a/frontend/src/lib/components/code-panel.svelte b/frontend/src/lib/components/code-panel.svelte
index 98d5c2403..c8ecdadf5 100644
--- a/frontend/src/lib/components/code-panel.svelte
+++ b/frontend/src/lib/components/code-panel.svelte
@@ -66,7 +66,8 @@
gitEditUrl?: string | null;
} = $props();
- const isMobile = new IsMobile();
+ // Physical viewport only: auto height is about screen space, not the layout preference.
+ const isMobile = new IsMobile({ honorLayoutMode: false });
const effectiveAutoHeight = $derived(autoHeight || isMobile.current);
const editUrl = $derived(readOnly && !(enableDiff && diffOpen) && gitEditUrl ? gitEditUrl : null);
diff --git a/frontend/src/lib/components/form/mobile-floating-form-actions.svelte b/frontend/src/lib/components/form/mobile-floating-form-actions.svelte
index c1f5b3d16..38e18973b 100644
--- a/frontend/src/lib/components/form/mobile-floating-form-actions.svelte
+++ b/frontend/src/lib/components/form/mobile-floating-form-actions.svelte
@@ -2,7 +2,6 @@
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { getMobileNavigation } from '#lib/utils/navigation.js';
import { IsMobile } from '#lib/hooks/is-mobile.svelte.js';
- import { IsTablet } from '#lib/hooks/is-tablet.svelte.js';
import { cn } from '#lib/utils.js';
interface Props {
@@ -15,16 +14,15 @@
let { hasChanges, isLoading, onSave, onReset }: Props = $props();
const isMobile = new IsMobile();
- const isTablet = new IsTablet();
const navigation = getMobileNavigation();
const navigationSettings = $derived(navigation.settings);
const navigationMode = $derived(navigationSettings.mode);
const scrollToHideEnabled = $derived(navigationSettings.scrollToHide);
</script>
-{#if isMobile.current || isTablet.current}
+{#if isMobile.current}
<div
- class="fixed right-4 z-[var(--arcane-z-app-chrome)] flex flex-col gap-3 transition-[bottom] duration-300 ease-out sm:hidden"
+ class="fixed right-4 z-[var(--arcane-z-app-chrome)] flex flex-col gap-3 transition-[bottom] duration-300 ease-out"
style="bottom: {scrollToHideEnabled && !navigation.visible
? '1rem'
: 'calc(var(--mobile-' +
diff --git a/frontend/src/lib/components/ui/responsive-dialog/responsive-dialog.svelte b/frontend/src/lib/components/ui/responsive-dialog/responsive-dialog.svelte
index d90dda2ed..dc8780878 100644
--- a/frontend/src/lib/components/ui/responsive-dialog/responsive-dialog.svelte
+++ b/frontend/src/lib/components/ui/responsive-dialog/responsive-dialog.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
// Close convention: the component that owns `open` must close it in the
// success path. Dialogs delegate closing to their parent and never self-close on submit.
- import { MediaQuery } from 'svelte/reactivity';
+ import { IsMobile } from '#lib/hooks/is-mobile.svelte.js';
import * as Dialog from '#lib/components/ui/dialog/index.js';
import * as Drawer from '#lib/components/ui/drawer/index.js';
import * as Sheet from '#lib/components/ui/sheet/index.js';
@@ -23,7 +23,8 @@
variant = 'dialog'
}: ResponsiveDialogProps = $props();
- const isDesktop = new MediaQuery('(min-width: 768px)');
+ const isMobile = new IsMobile();
+ const isDesktop = $derived(!isMobile.current);
function handleOpenChange(newOpen: boolean) {
if (!newOpen && !dismissible) return;
@@ -40,7 +41,7 @@
{/if}
{/snippet}
-{#if isDesktop.current}
+{#if isDesktop}
{#if variant === 'sheet'}
<Sheet.Root {open} onOpenChange={handleOpenChange}>
{#if trigger}
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-rail.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-rail.svelte
index 43cd195c7..79ffa3006 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-rail.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-rail.svelte
@@ -27,7 +27,7 @@
}}
title={sidebar.isTablet ? '' : 'Toggle Sidebar'}
class={cn(
- 'absolute inset-y-0 z-[var(--arcane-z-sticky)] hidden w-4 -translate-x-1/2 transition-transform ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex',
+ 'absolute inset-y-0 z-[var(--arcane-z-sticky)] hidden w-4 -translate-x-1/2 transition-transform ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] desktop-layout:flex',
// Only show hover and cursor effects when not in tablet mode
!sidebar.isTablet && [
'hover:after:bg-sidebar-border',
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar.svelte b/frontend/src/lib/components/ui/sidebar/sidebar.svelte
index dc3f8361c..cec1d4d1f 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar.svelte
@@ -31,7 +31,7 @@
{:else}
<div
bind:this={ref}
- class="group peer hidden text-sidebar-foreground md:block"
+ class="group peer hidden text-sidebar-foreground desktop-layout:block"
data-state={sidebar.state}
data-collapsible={sidebar.state === 'collapsed' ? collapsible : ''}
data-variant={variant}
@@ -54,7 +54,7 @@
<div
data-slot="sidebar-container"
class={cn(
- 'fixed inset-y-0 z-[var(--arcane-z-app-chrome)] hidden h-dvh w-(--sidebar-width) overflow-x-hidden transition-[left,right,width] duration-200 ease-out md:flex',
+ 'fixed inset-y-0 z-[var(--arcane-z-app-chrome)] hidden h-dvh w-(--sidebar-width) overflow-x-hidden transition-[left,right,width] duration-200 ease-out desktop-layout:flex',
side === 'left'
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
diff --git a/frontend/src/lib/hooks/is-mobile.svelte.ts b/frontend/src/lib/hooks/is-mobile.svelte.ts
index 0f1afe957..aaf10226a 100644
--- a/frontend/src/lib/hooks/is-mobile.svelte.ts
+++ b/frontend/src/lib/hooks/is-mobile.svelte.ts
@@ -1,9 +1,26 @@
import { MediaQuery } from 'svelte/reactivity';
+import { getLayoutMode } from '#lib/stores/layout-mode.store.svelte.js';
const MOBILE_BREAKPOINT = 768;
export class IsMobile extends MediaQuery {
- constructor() {
+ #honorLayoutMode: boolean;
+
+ /**
+ * @param honorLayoutMode When false, only the viewport width is consulted. Use
+ * this for decisions about physical space (e.g. editor heights), not layout.
+ */
+ constructor({ honorLayoutMode = true }: { honorLayoutMode?: boolean } = {}) {
super(`max-width: ${MOBILE_BREAKPOINT - 1}px`);
+ this.#honorLayoutMode = honorLayoutMode;
+ }
+
+ override get current(): boolean {
+ // Always read the media query first so its subscription stays registered
+ // regardless of the current mode.
+ const matches = super.current;
+ if (!this.#honorLayoutMode) return matches;
+ const mode = getLayoutMode();
+ return mode === 'auto' ? matches : mode === 'mobile';
}
}
diff --git a/frontend/src/lib/hooks/is-tablet.svelte.ts b/frontend/src/lib/hooks/is-tablet.svelte.ts
index dace7eba3..79dc8cc95 100644
--- a/frontend/src/lib/hooks/is-tablet.svelte.ts
+++ b/frontend/src/lib/hooks/is-tablet.svelte.ts
@@ -1,4 +1,5 @@
import { MediaQuery } from 'svelte/reactivity';
+import { getLayoutMode } from '#lib/stores/layout-mode.store.svelte.js';
// Breakpoint for tablet/small desktop where sidebar should auto-collapse
const TABLET_BREAKPOINT = 1024;
@@ -7,4 +8,12 @@ export class IsTablet extends MediaQuery {
constructor() {
super(`max-width: ${TABLET_BREAKPOINT - 1}px`);
}
+
+ override get current(): boolean {
+ // Always read the media query first so its subscription stays registered.
+ const matches = super.current;
+ // A forced desktop layout must behave like a desktop: the tablet lock would
+ // otherwise keep the sidebar collapsed with no way to expand or pin it.
+ return getLayoutMode() === 'desktop' ? false : matches;
+ }
}
diff --git a/frontend/src/lib/layouts/tabbed-page-layout.svelte b/frontend/src/lib/layouts/tabbed-page-layout.svelte
index 475e80179..8e6afd5a3 100644
--- a/frontend/src/lib/layouts/tabbed-page-layout.svelte
+++ b/frontend/src/lib/layouts/tabbed-page-layout.svelte
@@ -43,10 +43,11 @@
<div
class="sticky top-0 border-b transition-opacity duration-300"
style="opacity: {floatingHeaderVisible ? 0 : 1}; pointer-events: {floatingHeaderVisible ? 'none' : 'auto'};"
+ inert={floatingHeaderVisible || undefined}
>
<div class="max-w-full px-4 py-3">
- <div class="flex items-start justify-between gap-3">
- <div class="flex min-w-0 items-start gap-2">
+ <div class="flex items-start gap-3">
+ <div class="flex max-w-[70%] min-w-0 items-start gap-2">
{#if backUrl}
<ArcaneButton action="base" tone="ghost" size="sm" href={backUrl}>
<ArrowLeftIcon class="size-4" />
@@ -58,7 +59,11 @@
</div>
</div>
{#if headerActions}
- {@render headerActions()}
+ <!-- basis-0: the column's width never depends on its content, so the
+ self-measuring actions inside cannot feed back into their own space. -->
+ <div class="flex min-w-9 flex-1 basis-0 items-center justify-end gap-2">
+ {@render headerActions()}
+ </div>
{/if}
</div>
@@ -73,17 +78,21 @@
</div>
{#if floatingHeaderVisible}
- <div class="fixed top-4 left-1/2 z-[var(--arcane-z-page-floating)] -translate-x-1/2">
+ <!-- A full-width, click-through strip centres the bubble. Positioning the bubble itself at
+ left-1/2 would cap its shrink-to-fit width at half the viewport. -->
+ <div class="pointer-events-none fixed inset-x-4 top-4 z-[var(--arcane-z-page-floating)] flex justify-center">
<div
- class="bubble-shadow-lg rounded-lg border border-border/50 bg-popover/90 px-4 py-3 backdrop-blur-md supports-backdrop-filter:bg-popover/80"
+ class="bubble-shadow-lg pointer-events-auto max-w-full rounded-lg border border-border/50 bg-popover/90 px-4 py-3 backdrop-blur-md supports-backdrop-filter:bg-popover/80"
>
<div class="flex items-center gap-4">
<div class="min-w-0">
{@render headerInfo()}
</div>
{#if headerActions}
- <div class="h-4 w-px bg-border"></div>
- {@render headerActions()}
+ <div class="h-4 w-px shrink-0 bg-border"></div>
+ <div class="flex min-w-9 flex-1 basis-0 items-center justify-end gap-2">
+ {@render headerActions()}
+ </div>
{/if}
</div>
</div>
diff --git a/frontend/src/lib/stores/layout-mode.store.svelte.ts b/frontend/src/lib/stores/layout-mode.store.svelte.ts
new file mode 100644
index 000000000..1eacf78df
--- /dev/null
+++ b/frontend/src/lib/stores/layout-mode.store.svelte.ts
@@ -0,0 +1,20 @@
+import { PersistedState } from 'runed';
+
+/**
+ * Per-device layout override. Browsers' "Desktop site" toggles only change the
+ * user agent on Chromium tablets, leaving the layout viewport (and therefore
+ * every width media query) untouched, so users need an explicit switch. It is
+ * device-local on purpose: the same account may want desktop on a tablet and
+ * automatic on a phone.
+ */
+export type LayoutMode = 'auto' | 'mobile' | 'desktop';
+
+export const LAYOUT_MODE_STORAGE_KEY = 'arcane-layout-mode';
+
+export const layoutModeStore = new PersistedState<LayoutMode>(LAYOUT_MODE_STORAGE_KEY, 'auto');
+
+/** Read the stored mode, treating anything unexpected in localStorage as `auto`. */
+export function getLayoutMode(): LayoutMode {
+ const value = layoutModeStore.current;
+ return value === 'mobile' || value === 'desktop' ? value : 'auto';
+}
diff --git a/frontend/src/routes/(app)/account/account-preferences-panel.svelte b/frontend/src/routes/(app)/account/account-preferences-panel.svelte
index 8eb4e4235..955d6ed7e 100644
--- a/frontend/src/routes/(app)/account/account-preferences-panel.svelte
+++ b/frontend/src/routes/(app)/account/account-preferences-panel.svelte
@@ -18,6 +18,7 @@
import { m } from '#lib/paraglide/messages.js';
import { userService } from '#lib/services/user-service.js';
import userStore from '#lib/stores/user-store.svelte.js';
+ import { getLayoutMode, layoutModeStore, type LayoutMode } from '#lib/stores/layout-mode.store.svelte.js';
import type { ProjectEditorLayout, UserPreferences } from '#lib/types/auth.js';
import type { ApplicationTheme, IconCatalog } from '#lib/types/settings.js';
import { DockIcon, MonitorSpeakerIcon } from '#lib/icons/index.js';
@@ -56,6 +57,14 @@
{ value: 'classic', label: m.classic(), description: m.project_editor_layout_classic_description() },
{ value: 'tree', label: m.tree(), description: m.project_editor_layout_tree_description() }
]);
+ // Device-local (localStorage), not part of the account preferences: a user may want
+ // desktop layout on a tablet and automatic on a phone.
+ const layoutModeValue = $derived<LayoutMode>(getLayoutMode());
+ const layoutModeOptions = $derived([
+ { value: 'auto', label: m.automatic(), description: m.layout_mode_auto_description() },
+ { value: 'mobile', label: m.layout_mode_mobile(), description: m.layout_mode_mobile_description() },
+ { value: 'desktop', label: m.layout_mode_desktop(), description: m.layout_mode_desktop_description() }
+ ]);
const landingPageOptions = $derived(getLandingPageNavItems().map((item) => ({ value: item.url, label: item.title })));
const landingValue = $derived.by(() => {
const current = preferences.defaultLandingPage ?? DEFAULT_LANDING_PAGE;
@@ -133,6 +142,19 @@
<SettingsRow label={m.font_size()} description={m.font_size_description()} layout="inline">
<FontSizePicker />
</SettingsRow>
+ <SettingsRow label={m.layout_mode()} description={m.layout_mode_description()} layout="inline">
+ <div class="w-52">
+ <SelectWithLabel
+ id="account-layout-mode"
+ label={m.layout_mode()}
+ hideLabel
+ triggerSize="sm"
+ value={layoutModeValue}
+ options={layoutModeOptions}
+ onValueChange={(value) => (layoutModeStore.current = value as LayoutMode)}
+ />
+ </div>
+ </SettingsRow>
<SettingsRow label={m.icon_catalog()} description={m.icon_catalog_description()} layout="inline">
<div class="w-52">
<SelectWithLabel
diff --git a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
index 9bf9991db..7719fab7a 100644
--- a/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/(app)/containers/[containerId]/+page.svelte
@@ -336,7 +336,7 @@
</script>
{#snippet containerHeader(container: ContainerDetailsDto)}
- <div class="flex items-center gap-2">
+ <div class="flex flex-wrap items-center gap-x-2 gap-y-1">
<IconImage
src={containerIconUrl}
alt={containerDisplayName}
@@ -344,7 +344,10 @@
class="size-5"
containerClass="size-9"
/>
- <h1 class="max-w-75 truncate text-lg font-semibold" title={containerDisplayName}>
+ <h1
+ class="max-w-[10rem] min-w-0 truncate text-lg font-semibold sm:max-w-[14rem] md:max-w-[18rem] lg:max-w-[22rem]"
+ title={containerDisplayName}
+ >
{containerDisplayName}
</h1>
{#if container?.state}
@@ -602,24 +605,21 @@
{/snippet}
{#snippet headerActions()}
- <div class="container-detail-actions">
- <ActionButtons
- id={container.id}
- name={containerDisplayName}
- type="container"
- itemState={container.state?.running ? 'running' : 'stopped'}
- desktopVariant="adaptive"
- disableRedeploy={!!container.redeployDisabled}
- >
- {#snippet beforeRemoveActions(size, showLabel, actionButtonsLifecyclePending)}
- {@render containerLifecycleButtons(container, size, showLabel, actionButtonsLifecyclePending)}
- {/snippet}
-
- {#snippet beforeRemoveMenuItems(actionButtonsLifecyclePending)}
- {@render containerLifecycleMenu(container, actionButtonsLifecyclePending)}
- {/snippet}
- </ActionButtons>
- </div>
+ <ActionButtons
+ id={container.id}
+ name={containerDisplayName}
+ type="container"
+ itemState={container.state?.running ? 'running' : 'stopped'}
+ disableRedeploy={!!container.redeployDisabled}
+ >
+ {#snippet beforeRemoveActions(size, showLabel, actionButtonsLifecyclePending)}
+ {@render containerLifecycleButtons(container, size, showLabel, actionButtonsLifecyclePending)}
+ {/snippet}
+
+ {#snippet beforeRemoveMenuItems(actionButtonsLifecyclePending)}
+ {@render containerLifecycleMenu(container, actionButtonsLifecyclePending)}
+ {/snippet}
+ </ActionButtons>
{/snippet}
{#snippet tabContent(activeTab)}
@@ -646,14 +646,3 @@
{:else}
<ResourceNotFound resource={m.container()} resourceListTitle={m.containers()} backHref="/containers" onRetry={refreshData} />
{/if}
-
-<style>
- .container-detail-actions {
- display: flex;
- flex: 1 1 auto;
- min-width: 0;
- align-items: center;
- justify-content: flex-end;
- gap: 0.5rem;
- }
-</style>
diff --git a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
index 88b41d49e..54a624102 100644
--- a/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
+++ b/frontend/src/routes/(app)/projects/[projectId]/+page.svelte
@@ -4,6 +4,7 @@
import * as Tabs from '#lib/components/ui/tabs/index.js';
import * as Alert from '#lib/components/ui/alert/index.js';
import { ArcaneButton } from '#lib/components/arcane-button/index.js';
+ import * as DropdownMenu from '#lib/components/ui/dropdown-menu/index.js';
import {
ArrowLeftIcon,
ArrowDownIcon,
@@ -116,6 +117,7 @@
const envId = $derived(environmentStore.selected?.id || '0');
const canUpdateProject = $derived(hasPermission('projects:update', envId));
+ const canArchiveProject = $derived(hasPermission('projects:archive', envId));
const canViewProjectLogs = $derived(hasPermission('projects:logs', envId));
// Project lifecycle permissions are evaluated per-button inside
// <ActionButtons/> directly; no need to derive them here.
@@ -2193,48 +2195,72 @@
{/snippet}
{#snippet headerActions()}
- <div class="flex items-center gap-2">
- {#if hasChanges && canUpdateProject}
- <ArcaneButton
- action="save"
- loading={isLoading.saving}
- onclick={handleSaveChanges}
- disabled={!canSave}
- customLabel={m.common_save()}
- loadingLabel={m.common_saving()}
- />
- {/if}
- <IfPermitted perm="projects:archive">
- <ArcaneButton
- action="archive"
- loading={isLoading.archiving}
- onclick={handleArchiveToggle}
- disabled={archiveRequiresStopped}
- title={archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined}
- customLabel={project?.isArchived ? m.projects_unarchive() : m.projects_archive()}
- />
- </IfPermitted>
- <ActionButtons
- id={project.id}
- name={project.name}
- type="project"
- itemState={project.status}
- {hasBuildDirective}
- desktopVariant="adaptive"
- disableRedeploy={!!project.redeployDisabled}
- disabled={composeActionsBlocked}
- disabledReason={composeActionsBlocked ? m.env_file_unreadable_title() : undefined}
- bind:startLoading={isLoading.deploying}
- bind:stopLoading={isLoading.stopping}
- bind:restartLoading={isLoading.restarting}
- bind:removeLoading={isLoading.removing}
- bind:redeployLoading={isLoading.redeploying}
- onActionComplete={() => {
- void refreshProjectDetails();
- }}
- onRefresh={() => refreshProjectDetails()}
- />
- </div>
+ <ActionButtons
+ id={project.id}
+ name={project.name}
+ type="project"
+ itemState={project.status}
+ {hasBuildDirective}
+ disableRedeploy={!!project.redeployDisabled}
+ disabled={composeActionsBlocked}
+ disabledReason={composeActionsBlocked ? m.env_file_unreadable_title() : undefined}
+ bind:startLoading={isLoading.deploying}
+ bind:stopLoading={isLoading.stopping}
+ bind:restartLoading={isLoading.restarting}
+ bind:removeLoading={isLoading.removing}
+ bind:redeployLoading={isLoading.redeploying}
+ onActionComplete={() => {
+ void refreshProjectDetails();
+ }}
+ onRefresh={() => refreshProjectDetails()}
+ >
+ {#snippet leadingActions(size, showLabel)}
+ {#if hasChanges && canUpdateProject}
+ <ArcaneButton
+ action="save"
+ {size}
+ {showLabel}
+ loading={isLoading.saving}
+ onclick={handleSaveChanges}
+ disabled={!canSave}
+ customLabel={m.common_save()}
+ loadingLabel={m.common_saving()}
+ />
+ {/if}
+ <IfPermitted perm="projects:archive">
+ <ArcaneButton
+ action="archive"
+ {size}
+ {showLabel}
+ loading={isLoading.archiving}
+ onclick={handleArchiveToggle}
+ disabled={archiveRequiresStopped}
+ title={archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined}
+ customLabel={project?.isArchived ? m.projects_unarchive() : m.projects_archive()}
+ />
+ </IfPermitted>
+ {/snippet}
+
+ {#snippet leadingMenuItems()}
+ {#if hasChanges && canUpdateProject}
+ <DropdownMenu.Item onclick={handleSaveChanges} disabled={!canSave || isLoading.saving}>
+ {isLoading.saving ? m.common_saving() : m.common_save()}
+ </DropdownMenu.Item>
+ {/if}
+ {#if canArchiveProject}
+ <DropdownMenu.Item
+ onclick={handleArchiveToggle}
+ disabled={archiveRequiresStopped || isLoading.archiving}
+ title={archiveRequiresStopped ? m.projects_archive_requires_stopped() : undefined}
+ >
+ {project?.isArchived ? m.projects_unarchive() : m.projects_archive()}
+ </DropdownMenu.Item>
+ {/if}
+ {#if (hasChanges && canUpdateProject) || canArchiveProject}
+ <DropdownMenu.Separator />
+ {/if}
+ {/snippet}
+ </ActionButtons>
{/snippet}
{#snippet tabContent()}
diff --git a/frontend/src/routes/(app)/settings/+layout.svelte b/frontend/src/routes/(app)/settings/+layout.svelte
index af46d0d91..347f3b040 100644
--- a/frontend/src/routes/(app)/settings/+layout.svelte
+++ b/frontend/src/routes/(app)/settings/+layout.svelte
@@ -73,7 +73,7 @@
{#if isSubPage}
<div
class={cn(
- 'sticky top-4 z-[var(--arcane-z-sticky)] mx-4 mb-6 rounded-lg border shadow-lg md:hidden',
+ 'sticky top-4 z-[var(--arcane-z-sticky)] mx-4 mb-6 rounded-lg border shadow-lg desktop-layout:hidden',
'bg-background/95 backdrop-blur-md'
)}
>
diff --git a/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte b/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
index 613bc180c..72179558a 100644
--- a/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
+++ b/frontend/src/routes/(app)/swarm/services/[serviceId]/+page.svelte
@@ -1,9 +1,9 @@
<script lang="ts">
- import { ArcaneButton } from '#lib/components/arcane-button/index.js';
import { goto, refreshAll } from '$app/navigation';
import { Badge } from '#lib/components/ui/badge/index.js';
import { m } from '#lib/paraglide/messages.js';
import TabbedPageLayout from '#lib/layouts/tabbed-page-layout.svelte';
+ import { ActionButtonGroup, type ActionButton } from '#lib/components/action-button-group/index.js';
import { type TabItem } from '#lib/components/tab-bar/index.js';
import * as Tabs from '#lib/components/ui/tabs/index.js';
import { openConfirmDialog } from '#lib/components/confirm-dialog/index.js';
@@ -32,6 +32,9 @@
import ServiceNetwork from '../components/ServiceNetwork.svelte';
import ServiceStorage from '../components/ServiceStorage.svelte';
import { Input } from '#lib/components/ui/input/index.js';
+ import { Label } from '#lib/components/ui/label/index.js';
+ import * as ResponsiveDialog from '#lib/components/ui/responsive-dialog/index.js';
+ import SheetFooterActions from '#lib/components/sheets/sheet-footer-actions.svelte';
import ResourceNotFound from '#lib/components/resource-not-found.svelte';
import {
DockIcon,
@@ -41,6 +44,7 @@
NetworksIcon,
VolumesIcon,
EditIcon,
+ LayersIcon,
RedeployIcon,
TrashIcon
} from '#lib/icons/index.js';
@@ -57,6 +61,7 @@
let { data } = $props();
let service = $derived(data?.service as SwarmServiceInspect);
+ let scaleDialogOpen = $state(false);
let userScaleReplicas = $state<number | null>(null);
let userScaleReplicasServiceId = $state<string | null>(null);
let isLoading = $state({ update: false, rollback: false, remove: false, scale: false });
@@ -173,6 +178,47 @@
const envId = $derived(environmentStore.selected?.id || '0');
const canManageServices = $derived(hasPermission('swarm:services', envId));
const canScaleService = $derived(canManageServices && showsReplicas);
+
+ // Scaling lives behind a dialog so the header keeps a single measured action group;
+ // inline controls could not collapse and overflowed into the service info.
+ const serviceActions = $derived<ActionButton[]>([
+ ...(canScaleService
+ ? [
+ {
+ id: 'scale',
+ action: 'base' as const,
+ label: m.swarm_service_scale(),
+ icon: LayersIcon,
+ disabled: isLoading.scale,
+ onclick: () => (scaleDialogOpen = true)
+ }
+ ]
+ : []),
+ {
+ id: 'edit',
+ action: 'edit',
+ label: m.common_edit(),
+ icon: EditIcon,
+ disabled: isLoading.update,
+ onclick: openEdit
+ },
+ {
+ id: 'rollback',
+ action: 'redeploy',
+ label: m.swarm_service_rollback(),
+ icon: RedeployIcon,
+ disabled: isLoading.rollback,
+ onclick: handleRollback
+ },
+ {
+ id: 'delete',
+ action: 'remove',
+ label: m.common_delete(),
+ icon: TrashIcon,
+ disabled: isLoading.remove,
+ onclick: handleDelete
+ }
+ ]);
const canViewServiceLogs = $derived(hasPermission('swarm:services:logs', envId));
const tabItems = $derived<TabItem[]>([
@@ -283,6 +329,7 @@
setLoadingState: (v) => (isLoading.scale = v),
onSuccess: async () => {
toast.success(m.swarm_service_scale_success({ name: serviceName, replicas }));
+ scaleDialogOpen = false;
await refreshData();
}
});
@@ -292,11 +339,14 @@
{#if service}
<TabbedPageLayout backUrl="/swarm/services" backLabel={m.common_back()} {tabItems} {selectedTab} {onTabChange}>
{#snippet headerInfo()}
- <div class="flex items-center gap-2">
- <div class="flex size-9 items-center justify-center rounded-full bg-primary/10">
+ <div class="flex flex-wrap items-center gap-x-2 gap-y-1">
+ <div class="flex size-9 shrink-0 items-center justify-center rounded-full bg-primary/10">
<DockIcon class="size-5 text-primary" />
</div>
- <h1 class="max-w-[300px] truncate text-lg font-semibold" title={serviceName}>
+ <h1
+ class="max-w-[10rem] min-w-0 truncate text-lg font-semibold sm:max-w-[14rem] md:max-w-[18rem] lg:max-w-[22rem]"
+ title={serviceName}
+ >
{serviceName}
</h1>
<Badge variant={getSwarmServiceModeVariant(serviceMode)} minWidth="20">{getSwarmServiceModeLabel(serviceMode)}</Badge>
@@ -311,36 +361,7 @@
{#snippet headerActions()}
{#if canManageServices}
- <div class="flex items-center gap-2">
- {#if canScaleService}
- <div class="flex items-center gap-2">
- <Input
- type="number"
- min="0"
- step="1"
- value={scaleReplicas}
- oninput={onScaleReplicasInput}
- class="h-8 w-20"
- disabled={isLoading.scale}
- />
- <ArcaneButton action="base" tone="outline" size="sm" onclick={handleScale} disabled={isLoading.scale}>
- {m.swarm_service_scale()}
- </ArcaneButton>
- </div>
- {/if}
- <ArcaneButton action="base" tone="outline" size="sm" onclick={openEdit} disabled={isLoading.update}>
- <EditIcon class="size-4" />
- <span class="hidden sm:inline">{m.common_edit()}</span>
- </ArcaneButton>
- <ArcaneButton action="base" tone="outline" size="sm" onclick={handleRollback} disabled={isLoading.rollback}>
- <RedeployIcon class="size-4" />
- <span class="hidden sm:inline">{m.swarm_service_rollback()}</span>
- </ArcaneButton>
- <ArcaneButton action="base" tone="outline-destructive" size="sm" onclick={handleDelete} disabled={isLoading.remove}>
- <TrashIcon class="size-4" />
- <span class="hidden sm:inline">{m.common_delete()}</span>
- </ArcaneButton>
- </div>
+ <ActionButtonGroup size="sm" buttons={serviceActions} />
{/if}
{/snippet}
@@ -392,6 +413,46 @@
{/snippet}
</TabbedPageLayout>
+ {#if canScaleService}
+ <ResponsiveDialog.Root
+ bind:open={scaleDialogOpen}
+ title={m.swarm_service_scale()}
+ description={m.swarm_service_scale_description({ name: serviceName })}
+ >
+ {#snippet children()}
+ <form
+ class="grid gap-2 py-4"
+ onsubmit={(event) => {
+ event.preventDefault();
+ void handleScale();
+ }}
+ >
+ <Label for="swarm-service-scale-replicas">{m.swarm_replicas()}</Label>
+ <Input
+ id="swarm-service-scale-replicas"
+ type="number"
+ min="0"
+ step="1"
+ value={scaleReplicas}
+ oninput={onScaleReplicasInput}
+ disabled={isLoading.scale}
+ />
+ </form>
+ {/snippet}
+
+ {#snippet footer()}
+ <SheetFooterActions
+ onCancel={() => (scaleDialogOpen = false)}
+ submitAction="base"
+ submitLabel={m.swarm_service_scale()}
+ submitLoading={isLoading.scale}
+ submitDisabled={isLoading.scale}
+ onSubmit={() => void handleScale()}
+ />
+ {/snippet}
+ </ResponsiveDialog.Root>
+ {/if}
+
{#if editOpen}
<ServiceEditorDialog
bind:open={editOpen}
diff --git a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
index c0e181b2c..444b25d43 100644
--- a/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
+++ b/frontend/src/routes/(app)/volumes/[volumeName]/+page.svelte
@@ -28,6 +28,7 @@
import { volumeWorkspaceService } from '#lib/services/volume-workspace-service.js';
import { type DetailAction } from '#lib/layouts/index.js';
import TabbedPageLayout from '#lib/layouts/tabbed-page-layout.svelte';
+ import { ActionButtonGroup } from '#lib/components/action-button-group/index.js';
import BackupList from '../components/volume-backup-table.svelte';
import settingsStore from '#lib/stores/config-store.svelte.js';
import { environmentStore } from '#lib/stores/environment.store.svelte.js';
@@ -1054,17 +1055,7 @@
{/snippet}
{#snippet headerActions()}
- <div class="flex items-center gap-2">
- {#each actions as act (act.id)}
- <ArcaneButton
- action={act.action}
- customLabel={act.label}
- loading={act.loading}
- disabled={act.disabled}
- onclick={act.onclick}
- />
- {/each}
- </div>
+ <ActionButtonGroup buttons={actions} />
{/snippet}
{#snippet tabContent(tab)}
diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte
index d63899751..4013a3ea7 100644
--- a/frontend/src/routes/+layout.svelte
+++ b/frontend/src/routes/+layout.svelte
@@ -33,6 +33,13 @@
const isMobile = new IsMobile();
const isTablet = new IsTablet();
+
+ // Mirror the effective layout onto <html> so CSS (sidebar visibility, etc.) can follow the
+ // per-device layout preference instead of raw viewport breakpoints. `$effect.pre` runs
+ // before the first DOM commit, so the attribute is present at first paint.
+ $effect.pre(() => {
+ document.documentElement.setAttribute('data-layout', isMobile.current ? 'mobile' : 'desktop');
+ });
const isNavigating = $derived(navigating.type !== null);
const isAuthPage = $derived(
diff --git a/frontend/src/routes/layout.css b/frontend/src/routes/layout.css
index 169e39aef..07110ec48 100644
--- a/frontend/src/routes/layout.css
+++ b/frontend/src/routes/layout.css
@@ -6,6 +6,9 @@
@import './themes.css';
@custom-variant dark (&:is(.dark *));
+/* Effective layout, set on <html> by the root layout from IsMobile + the per-device layout preference. */
+@custom-variant desktop-layout (&:where([data-layout='desktop'], [data-layout='desktop'] *));
+@custom-variant mobile-layout (&:where([data-layout='mobile'], [data-layout='mobile'] *));
:root {
color-scheme: light;