Skip to content

Modern Docker Management, Designed for Everyone

refactor: update button styles (#196)

Kyle Mendell14a9f7890c89
diff --git a/src/app.css b/src/app.css
index 2eeeb7f63..130826412 100644
--- a/src/app.css
+++ b/src/app.css
@@ -150,3 +150,127 @@
transform: rotate(180deg);
opacity: 0.7;
}
+
+/* Button Styles - Minimalist design with purple accent */
+
+/* Common button styles for all arcane buttons */
+[class*='arcane-button-'] {
+ position: relative;
+ transition: all 0.2s ease;
+ border-radius: 0.5rem !important; /* Slightly smaller radius for a cleaner look */
+ overflow: visible !important;
+ z-index: 0;
+ font-weight: 500;
+ letter-spacing: 0.01em;
+ box-shadow: none !important; /* Remove default shadows */
+}
+
+/* Subtle hover effect */
+[class*='arcane-button-']:hover {
+ transform: translateY(-1px); /* Subtle lift effect */
+}
+
+/* Primary action buttons - solid purple */
+.arcane-button-start,
+.arcane-button-deploy,
+.arcane-button-confirm,
+.arcane-button-save,
+.arcane-button-create {
+ background-color: var(--primary) !important;
+ color: white !important;
+ border: none !important;
+}
+.arcane-button-start:hover,
+.arcane-button-deploy:hover,
+.arcane-button-confirm:hover,
+.arcane-button-save:hover,
+.arcane-button-create:hover {
+ background-color: hsl(262.1 83.3% 52%) !important;
+}
+
+/* Add specific styles for create button (slightly brighter accent) */
+.arcane-button-create {
+ background-color: hsl(262.1 83.3% 62%) !important;
+}
+.arcane-button-create:hover {
+ background-color: hsl(262.1 83.3% 57%) !important;
+}
+
+/* Destructive action buttons - outlined red (matching secondary button style) */
+.arcane-button-stop,
+.arcane-button-remove {
+ background-color: transparent !important;
+ color: var(--destructive) !important;
+ border: 1px solid var(--destructive) !important;
+}
+.arcane-button-stop:hover,
+.arcane-button-remove:hover {
+ background-color: hsla(0, 72.22%, 50.59%, 0.1) !important;
+}
+
+/* Dark mode overrides for destructive buttons */
+.dark .arcane-button-stop,
+.dark .arcane-button-remove {
+ color: hsl(0 72.22% 65%) !important;
+ border-color: hsl(0 72.22% 50%) !important;
+}
+.dark .arcane-button-stop:hover,
+.dark .arcane-button-remove:hover {
+ background-color: hsla(0, 72.22%, 50%, 0.15) !important;
+}
+
+/* Secondary action buttons - borderless with purple text */
+.arcane-button-restart,
+.arcane-button-pull,
+.arcane-button-redeploy,
+.arcane-button-edit {
+ background-color: transparent !important;
+ color: var(--primary) !important;
+ border: 1px solid var(--primary) !important;
+}
+.arcane-button-restart:hover,
+.arcane-button-pull:hover,
+.arcane-button-redeploy:hover,
+.arcane-button-edit:hover {
+ background-color: hsla(262.1, 83.3%, 50%, 0.1) !important;
+}
+
+/* Dark mode overrides for secondary buttons */
+.dark .arcane-button-restart,
+.dark .arcane-button-pull,
+.dark .arcane-button-redeploy,
+.dark .arcane-button-edit {
+ color: hsl(263.4 70% 80%) !important;
+ border-color: hsl(263.4 70% 60%) !important;
+}
+.dark .arcane-button-restart:hover,
+.dark .arcane-button-pull:hover,
+.dark .arcane-button-redeploy:hover,
+.dark .arcane-button-edit:hover {
+ background-color: hsla(263.4, 70%, 60%, 0.15) !important;
+}
+
+/* Subtle action buttons */
+.arcane-button-inspect,
+.arcane-button-logs,
+.arcane-button-cancel {
+ background-color: transparent !important;
+ color: var(--muted-foreground) !important;
+ border: 1px solid var(--muted) !important;
+}
+.arcane-button-inspect:hover,
+.arcane-button-logs:hover,
+.arcane-button-cancel:hover {
+ background-color: hsla(220, 14.3%, 50%, 0.1) !important;
+}
+.dark .arcane-button-inspect,
+.dark .arcane-button-logs,
+.dark .arcane-button-cancel {
+ color: hsl(217.9 10.6% 74.9%) !important;
+ border-color: hsl(215 27.9% 30%) !important;
+}
+.dark .arcane-button-inspect:hover,
+.dark .arcane-button-logs:hover,
+.dark .arcane-button-cancel:hover {
+ background-color: hsla(215, 27.9%, 40%, 0.15) !important;
+}
diff --git a/src/lib/components/action-buttons.svelte b/src/lib/components/action-buttons.svelte
index 8f64b40a6..a90db66ab 100644
--- a/src/lib/components/action-buttons.svelte
+++ b/src/lib/components/action-buttons.svelte
@@ -1,6 +1,4 @@
<script lang="ts">
- import { Play, StopCircle, RotateCcw, Download, Trash2, Loader2, RefreshCcwDot } from '@lucide/svelte';
- import { Button } from '$lib/components/ui/button/index.js';
import { openConfirmDialog } from './confirm-dialog';
import { goto, invalidateAll } from '$app/navigation';
import { toast } from 'svelte-sonner';
@@ -9,6 +7,7 @@
import StackAPIService from '$lib/services/api/stack-api-service';
import { tryCatch } from '$lib/utils/try-catch';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
+ import ArcaneButton from './arcane-button.svelte';
const containerApi = new ContainerAPIService();
const stackApi = new StackAPIService();
@@ -150,69 +149,17 @@
<div class="flex items-center gap-2">
{#if !isRunning}
- <Button type="button" variant="default" disabled={isLoading.start || loading.start} class="font-medium" onclick={() => handleStart()}>
- {#if isLoading.start || loading.start}
- <Loader2 class="mr-2 animate-spin size-4" />
- {:else}
- <Play class="mr-2 size-4" />
- {/if}
- {type === 'stack' ? 'Deploy' : 'Start'}
- </Button>
+ <ArcaneButton action={type === 'container' ? 'start' : 'deploy'} onClick={() => handleStart()} loading={isLoading.start} />
{:else}
- <Button type="button" variant="secondary" disabled={isLoading.stop || loading.stop} class="font-medium" onclick={() => handleStop()}>
- {#if isLoading.stop || loading.stop}
- <Loader2 class="animate-spin size-4" />
- {:else}
- <StopCircle class="size-4" />
- {/if}
- Stop
- </Button>
-
- <Button type="button" variant="outline" disabled={isLoading.restart || loading.restart} class="font-medium" onclick={() => handleRestart()}>
- {#if isLoading.restart || loading.restart}
- <Loader2 class="animate-spin size-4" />
- {:else}
- <RotateCcw class="size-4" />
- {/if}
- Restart
- </Button>
+ <ArcaneButton action="stop" onClick={() => handleStop()} loading={isLoading.stop} />
+ <ArcaneButton action="restart" onClick={() => handleRestart()} loading={isLoading.restart} />
{/if}
{#if type === 'container'}
- <Button type="button" variant="destructive" disabled={isLoading.remove || loading.remove} class="font-medium" onclick={() => confirmAction('remove')}>
- {#if isLoading.remove || loading.remove}
- <Loader2 class="animate-spin size-4" />
- {:else}
- <Trash2 class="size-4" />
- {/if}
- Remove
- </Button>
+ <ArcaneButton action="remove" onClick={() => confirmAction('remove')} loading={isLoading.remove} />
{:else}
- <Button type="button" variant="secondary" disabled={isLoading.redeploy || loading.redeploy} class="font-medium" onclick={() => confirmAction('redeploy')}>
- {#if isLoading.redeploy || loading.redeploy}
- <Loader2 class="animate-spin size-4" />
- {:else}
- <RefreshCcwDot class="size-4" />
- {/if}
- Redeploy
- </Button>
-
- <Button type="button" variant="outline" disabled={isLoading.pulling || loading.pull} class="font-medium" onclick={() => handlePull()}>
- {#if isLoading.pulling || loading.pull}
- <Loader2 class="animate-spin size-4" />
- {:else}
- <Download class="size-4" />
- {/if}
- Pull
- </Button>
-
- <Button type="button" variant="destructive" disabled={isLoading.remove || loading.remove} class="font-medium" onclick={() => confirmAction('remove')}>
- {#if isLoading.remove || loading.remove}
- <Loader2 class="animate-spin size-4" />
- {:else}
- <Trash2 class="size-4" />
- {/if}
- Remove
- </Button>
+ <ArcaneButton action="redeploy" onClick={() => confirmAction('redeploy')} loading={isLoading.redeploy} />
+ <ArcaneButton action="pull" onClick={() => confirmAction('pull')} loading={isLoading.pulling} />
+ <ArcaneButton action="remove" onClick={() => confirmAction('remove')} loading={isLoading.remove} />
{/if}
</div>
diff --git a/src/lib/components/arcane-button.svelte b/src/lib/components/arcane-button.svelte
new file mode 100644
index 000000000..4424f67df
--- /dev/null
+++ b/src/lib/components/arcane-button.svelte
@@ -0,0 +1,95 @@
+<script lang="ts">
+ import { Button, type Props as ButtonProps } from '$lib/components/ui/button/index.js';
+ import { Play, StopCircle, RotateCcw, Download, Trash2, Loader2, RefreshCcwDot, ScanSearch, FileText, EditIcon as Edit, Check, X, Save, PlusCircle, type Icon as IconType } from '@lucide/svelte';
+
+ type Action = 'start' | 'deploy' | 'stop' | 'restart' | 'remove' | 'pull' | 'redeploy' | 'inspect' | 'logs' | 'edit' | 'confirm' | 'cancel' | 'save' | 'create';
+
+ interface Props {
+ /** The type of action this button represents. Determines icon, default label, and variant. */
+ action: Action;
+ /** Function to call when the button is clicked. */
+ onClick?: (event: MouseEvent) => void;
+ /** If true, shows a loading spinner and disables the button. */
+ loading?: boolean;
+ /** If true, disables the button. */
+ disabled?: boolean;
+ /** Custom label for the button. Overrides the default label for the action. */
+ label?: string;
+ /** Custom loading label for the button. Overrides the default loading label for the action. */
+ loadingLabel?: string;
+ /** If true (default), shows the label text. If false, button will be icon-only. */
+ showLabel?: boolean;
+ /** Additional CSS classes to apply to the button. */
+ class?: string;
+ /** Button size. If 'icon', showLabel is effectively false for rendering purposes. */
+ size?: ButtonProps['size'];
+ /** Alias for label to maintain compatibility */
+ customLabel?: string;
+ }
+
+ let {
+ action,
+ onClick,
+ loading = false,
+ disabled = false,
+ label: propLabel = undefined,
+ customLabel = undefined, // Alternate name for label
+ loadingLabel: customLoadingLabel = undefined,
+ showLabel = true,
+ class: extraClass = '',
+ size: customSize = 'default'
+ }: Props = $props();
+
+ // Use customLabel as fallback for compatibility
+ const label = propLabel ?? customLabel;
+
+ type ActionConfig = {
+ defaultLabel: string;
+ IconComponent: typeof IconType;
+ variant: ButtonProps['variant'];
+ loadingLabel?: string;
+ customClass?: string;
+ };
+
+ const actionConfigs: Record<Action, ActionConfig> = {
+ start: { defaultLabel: 'Start', IconComponent: Play, variant: 'default', loadingLabel: 'Starting...', customClass: 'arcane-button-start' },
+ deploy: { defaultLabel: 'Deploy', IconComponent: Play, variant: 'default', loadingLabel: 'Deploying...', customClass: 'arcane-button-deploy' },
+ stop: { defaultLabel: 'Stop', IconComponent: StopCircle, variant: 'destructive', loadingLabel: 'Stopping...', customClass: 'arcane-button-stop' },
+ restart: { defaultLabel: 'Restart', IconComponent: RotateCcw, variant: 'secondary', loadingLabel: 'Restarting...', customClass: 'arcane-button-restart' },
+ remove: { defaultLabel: 'Remove', IconComponent: Trash2, variant: 'destructive', loadingLabel: 'Removing...', customClass: 'arcane-button-remove' },
+ pull: { defaultLabel: 'Pull', IconComponent: Download, variant: 'secondary', loadingLabel: 'Pulling...', customClass: 'arcane-button-pull' },
+ redeploy: { defaultLabel: 'Redeploy', IconComponent: RefreshCcwDot, variant: 'secondary', loadingLabel: 'Redeploying...', customClass: 'arcane-button-redeploy' },
+ inspect: { defaultLabel: 'Inspect', IconComponent: ScanSearch, variant: 'outline', loadingLabel: 'Inspecting...', customClass: 'arcane-button-inspect' },
+ logs: { defaultLabel: 'Logs', IconComponent: FileText, variant: 'ghost', loadingLabel: 'Fetching...', customClass: 'arcane-button-logs' },
+ edit: { defaultLabel: 'Edit', IconComponent: Edit, variant: 'secondary', loadingLabel: 'Saving...', customClass: 'arcane-button-edit' },
+ confirm: { defaultLabel: 'Confirm', IconComponent: Check, variant: 'default', loadingLabel: 'Confirming...', customClass: 'arcane-button-confirm' },
+ cancel: { defaultLabel: 'Cancel', IconComponent: X, variant: 'ghost', loadingLabel: 'Cancelling...', customClass: 'arcane-button-cancel' },
+ save: { defaultLabel: 'Save', IconComponent: Save, variant: 'default', loadingLabel: 'Saving...', customClass: 'arcane-button-save' },
+ create: { defaultLabel: 'Create', IconComponent: PlusCircle, variant: 'default', loadingLabel: 'Creating...', customClass: 'arcane-button-create' }
+ };
+
+ let config = $derived(actionConfigs[action]);
+ let displayLabel = $derived(label ?? config.defaultLabel);
+ // Use custom loading label if provided, otherwise use the config's default loading label
+ let displayLoadingLabel = $derived(customLoadingLabel ?? config.loadingLabel ?? 'Processing...');
+
+ // Determine if the button should render as an icon-only button
+ let isIconOnlyButton = $derived(customSize === 'icon' || !showLabel);
+
+ // Icon margin class - apply only if label is shown and it's not explicitly an icon-sized button
+ let iconMarginClass = $derived(!isIconOnlyButton ? 'mr-2' : '');
+</script>
+
+<Button variant={config.variant} size={customSize} class={`${extraClass} ${config.customClass || ''}`} disabled={disabled || loading} onclick={onClick} aria-label={isIconOnlyButton ? displayLabel : undefined}>
+ {#if loading}
+ <Loader2 class="animate-spin {iconMarginClass} size-4" />
+ {#if !isIconOnlyButton}
+ {displayLoadingLabel}
+ {/if}
+ {:else}
+ <config.IconComponent class="{iconMarginClass} size-4" />
+ {#if !isIconOnlyButton}
+ {displayLabel}
+ {/if}
+ {/if}
+</Button>
diff --git a/src/lib/components/confirm-dialog/confirm-dialog.svelte b/src/lib/components/confirm-dialog/confirm-dialog.svelte
index 6b6a9bf07..0f4c1c2bd 100644
--- a/src/lib/components/confirm-dialog/confirm-dialog.svelte
+++ b/src/lib/components/confirm-dialog/confirm-dialog.svelte
@@ -27,8 +27,9 @@
<Dialog.Footer class="mt-6">
<div class="flex justify-end gap-2">
- <Button variant="outline" onclick={() => ($confirmDialogStore.open = false)}>Cancel</Button>
+ <Button class="arcane-button-cancel" variant="outline" onclick={() => ($confirmDialogStore.open = false)}>Cancel</Button>
<Button
+ class="arcane-button-create"
variant={$confirmDialogStore.confirm.destructive ? 'destructive' : 'default'}
onclick={() => {
$confirmDialogStore.confirm.action();
diff --git a/src/lib/components/dialogs/prune-confirmation-dialog.svelte b/src/lib/components/dialogs/prune-confirmation-dialog.svelte
index b63fe90c1..abfdb04b7 100644
--- a/src/lib/components/dialogs/prune-confirmation-dialog.svelte
+++ b/src/lib/components/dialogs/prune-confirmation-dialog.svelte
@@ -93,8 +93,8 @@
</div>
<Dialog.Footer>
- <Button variant="outline" onclick={handleCancel} disabled={isPruning}>Cancel</Button>
- <Button variant="destructive" onclick={handleConfirm} disabled={selectedTypes.length === 0 || isPruning}>
+ <Button class="arcane-button-cancel" variant="outline" onclick={handleCancel} disabled={isPruning}>Cancel</Button>
+ <Button class="arcane-button-remove" variant="destructive" onclick={handleConfirm} disabled={selectedTypes.length === 0 || isPruning}>
{#if isPruning}
<Loader2 class="mr-2 animate-spin size-4" /> Pruning...
{:else}
diff --git a/src/lib/components/dialogs/registry-form-dialog.svelte b/src/lib/components/dialogs/registry-form-dialog.svelte
index b056272fa..1a751220f 100644
--- a/src/lib/components/dialogs/registry-form-dialog.svelte
+++ b/src/lib/components/dialogs/registry-form-dialog.svelte
@@ -68,8 +68,8 @@
</div>
<p class="text-xs text-muted-foreground col-span-full text-center px-4">For Docker Hub, if URL is empty or 'docker.io', it defaults to Docker Hub. For others like GHCR, provide the full URL.</p>
<Dialog.Footer>
- <Button type="button" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
- <Button type="submit" disabled={isLoading}>
+ <Button type="button" class="arcane-button-cancel" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button type="submit" class="arcane-button-create" disabled={isLoading}>
{#if isLoading}
<Loader2 class="mr-2 animate-spin size-4" />
{/if}
diff --git a/src/lib/components/dialogs/user-form-dialog.svelte b/src/lib/components/dialogs/user-form-dialog.svelte
index 1184f5925..3025ac6ac 100644
--- a/src/lib/components/dialogs/user-form-dialog.svelte
+++ b/src/lib/components/dialogs/user-form-dialog.svelte
@@ -124,13 +124,13 @@
{/if}
<Dialog.Footer>
- <Button type="button" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
- <Button type="submit" disabled={isLoading}>
+ <Button type="button" class="arcane-button-cancel" variant="outline" onclick={() => (open = false)} disabled={isLoading}>Cancel</Button>
+ <Button type="submit" class="arcane-button-create" disabled={isLoading}>
{#if isLoading}
- <Loader2 class="mr-2 animate-spin size-4" />
+ <Loader2 class="animate-spin size-4" />
Creating...
{:else}
- <SubmitIcon class="mr-2 size-4" />
+ <SubmitIcon class="size-4" />
{submitButtonText}
{/if}
</Button>
diff --git a/src/lib/services/docker/auto-update-service.ts b/src/lib/services/docker/auto-update-service.ts
index b997475ac..9659c5c56 100644
--- a/src/lib/services/docker/auto-update-service.ts
+++ b/src/lib/services/docker/auto-update-service.ts
@@ -1,6 +1,6 @@
import { listContainers, getContainer, recreateContainer } from './container-service';
import { listStacks, getStack, fullyRedeployStack } from './stack-service';
-import { pullImage, getImage, listImages } from './image-service';
+import { pullImage, getImage } from './image-service';
import { getSettings } from '../settings-service';
import yaml from 'js-yaml';
import type { Stack } from '$lib/types/docker/stack.type';
diff --git a/src/lib/services/docker/stack-service.ts b/src/lib/services/docker/stack-service.ts
index 8daba38b0..406b922cf 100644
--- a/src/lib/services/docker/stack-service.ts
+++ b/src/lib/services/docker/stack-service.ts
@@ -1,7 +1,6 @@
import { promises as fs } from 'node:fs';
import path, { join } from 'node:path';
import DockerodeCompose from 'dockerode-compose';
-import { readYamlEnvSync, readYamlEnv } from 'yaml-env-defaults';
import { load as yamlLoad, dump as yamlDump } from 'js-yaml';
import slugify from 'slugify';
import { directoryExists } from '$lib/utils/fs.utils';
@@ -1755,7 +1754,8 @@ function normalizeHealthcheckTest(composeContent: string, envGetter?: (key: stri
*/
function parseYamlContent(content: string, envGetter?: (key: string) => string | undefined): Record<string, any> | null {
try {
- let parsedYaml = yamlLoad(content); // Using js-yaml's load
+ // Use js-yaml directly without any potential CommonJS dependencies
+ const parsedYaml = yamlLoad(content);
if (!parsedYaml || typeof parsedYaml !== 'object') {
console.warn('Parsed YAML content is not an object or is null.');
@@ -1763,7 +1763,7 @@ function parseYamlContent(content: string, envGetter?: (key: string) => string |
}
if (envGetter) {
- parsedYaml = substituteVariablesInObject(parsedYaml, envGetter);
+ return substituteVariablesInObject(parsedYaml, envGetter);
}
return parsedYaml as Record<string, any>;
} catch (error) {
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 563c531c2..a135d3b17 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -101,7 +101,6 @@
async function handleStopAll() {
if (isLoading.stopping || !dashboardStates.dockerInfo || runningContainers === 0) return;
- isLoading.stopping = true;
openConfirmDialog({
title: 'Stop All Containers',
message: 'Are you sure you want to stop all running containers?',
@@ -180,7 +179,7 @@
<h1 class="text-3xl font-bold tracking-tight">Dashboard</h1>
<p class="text-sm text-muted-foreground mt-1">Overview of your Container Environment</p>
</div>
- <Button variant="outline" size="sm" class="h-9" onclick={refreshData} disabled={isLoading.refreshing || isLoading.starting || isLoading.stopping || isLoading.pruning}>
+ <Button variant="outline" size="sm" class="h-9 arcane-button-restart" onclick={refreshData} disabled={isLoading.refreshing || isLoading.starting || isLoading.stopping || isLoading.pruning}>
{#if isLoading.refreshing}
<Loader2 class="mr-2 animate-spin size-4" />
{:else}
@@ -345,7 +344,7 @@
<Card.Header class="px-6">
<div class="flex items-center justify-between">
<div>
- <Card.Title>Containers</Card.Title>
+ <Card.Title><a class="font-medium hover:underline" href="/containers">Containers</a></Card.Title>
<Card.Description class="pb-3">Recent containers</Card.Description>
</div>
<Button variant="ghost" size="sm" href="/containers" disabled={!dashboardStates.dockerInfo}>
@@ -410,7 +409,7 @@
<Card.Header class="px-6">
<div class="flex items-center justify-between">
<div>
- <Card.Title>Images</Card.Title>
+ <Card.Title><a class="font-medium hover:underline" href="/images">Images</a></Card.Title>
<Card.Description class="pb-3">Top 5 Largest Images</Card.Description>
</div>
<Button variant="ghost" size="sm" href="/images" disabled={!dashboardStates.dockerInfo}>
diff --git a/src/routes/api/containers/+server.ts b/src/routes/api/containers/+server.ts
index 9032777f1..42d47335d 100644
--- a/src/routes/api/containers/+server.ts
+++ b/src/routes/api/containers/+server.ts
@@ -18,7 +18,14 @@ export const POST: RequestHandler = async ({ request }) => {
return json(response, { status: 400 });
}
- const result = await tryCatch(createContainer(config));
+ // Use name from either property
+ const containerName = config.Name;
+ const containerConfig = {
+ ...config,
+ Name: containerName // Ensure Name is set correctly for downstream code
+ };
+
+ const result = await tryCatch(createContainer(containerConfig));
if (result.error) {
console.error('Error creating container:', result.error);
diff --git a/src/routes/auth/login/+page.svelte b/src/routes/auth/login/+page.svelte
index 0c178f15f..6a8a2506d 100644
--- a/src/routes/auth/login/+page.svelte
+++ b/src/routes/auth/login/+page.svelte
@@ -92,7 +92,7 @@
<!-- OIDC Login Button (when only OIDC is available) -->
{#if showOidcLoginButton && !showLocalLoginForm}
<div class="pt-2">
- <Button onclick={handleOidcLogin} variant="default" class="w-full py-6 text-base">
+ <Button onclick={handleOidcLogin} variant="default" class="w-full py-6 text-base arcane-button-restart">
<LogIn class="mr-3 size-5" />
Sign in with OIDC Provider
</Button>
@@ -146,7 +146,7 @@
<!-- Sign In Button -->
<div class="pt-2">
- <Button type="submit" class="w-full py-6 text-base" disabled={loading} aria-busy={loading}>
+ <Button type="submit" class="w-full py-6 text-base arcane-button-create" disabled={loading} aria-busy={loading}>
{#if loading}
<div class="mr-2 size-4 border-2 border-t-transparent rounded-full animate-spin"></div>
{/if}
@@ -169,7 +169,7 @@
<!-- OIDC Login Button (when both methods are available) -->
{#if showOidcLoginButton && showDivider}
- <Button onclick={handleOidcLogin} variant="outline" class="w-full py-5">
+ <Button onclick={handleOidcLogin} variant="outline" class="w-full py-5 arcane-button-restart">
<LogIn class="mr-2 size-4" />
Sign in with OIDC Provider
</Button>
diff --git a/src/routes/containers/+page.svelte b/src/routes/containers/+page.svelte
index 429ac0dec..7f4dd51ef 100644
--- a/src/routes/containers/+page.svelte
+++ b/src/routes/containers/+page.svelte
@@ -18,6 +18,7 @@
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import { shortId } from '$lib/utils/string.utils';
import type { PageData } from './$types';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
const containerApi = new ContainerAPIService();
@@ -184,10 +185,7 @@
<RefreshCw class="size-4" />
Refresh
</Button>
- <Button variant="secondary" onclick={openCreateDialog}>
- <Plus class="size-4" />
- Create Container
- </Button>
+ <ArcaneButton action="create" label="Create Container" onClick={openCreateDialog} />
</div>
</div>
{:else}
@@ -198,10 +196,7 @@
<Card.Title>Container List</Card.Title>
</div>
<div class="flex items-center gap-2">
- <Button variant="secondary" onclick={openCreateDialog}>
- <Plus class="size-4" />
- Create Container
- </Button>
+ <ArcaneButton action="create" label="Create Container" onClick={openCreateDialog} />
</div>
</div>
</Card.Header>
diff --git a/src/routes/containers/create-container-dialog.svelte b/src/routes/containers/create-container-dialog.svelte
index 52474ffb1..d6e16d601 100644
--- a/src/routes/containers/create-container-dialog.svelte
+++ b/src/routes/containers/create-container-dialog.svelte
@@ -15,6 +15,7 @@
import { tryCatch } from '$lib/utils/try-catch';
import ContainerAPIService from '$lib/services/api/container-api-service';
import type { ServiceImage } from '$lib/types/docker';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
interface Props {
open?: boolean;
@@ -160,7 +161,26 @@
const isUserDefinedNetworkSelected = $derived(networkMode && networkMode !== '' && networkMode !== 'host' && networkMode !== 'none' && networkMode !== 'bridge');
async function handleSubmit() {
- if (!selectedImage || !containerName.trim() || isCreating) return;
+ if (!selectedImage) {
+ toast.error('Image selection is required');
+ return;
+ }
+
+ if (!containerName.trim()) {
+ toast.error('Container name is required');
+ return;
+ }
+
+ if (isCreating) {
+ return; // Already processing
+ }
+
+ // Console log for debugging
+ console.log('Creating container with options:', {
+ Name: containerName.trim(),
+ Image: selectedImage
+ // log other important options
+ });
let hasInvalidPort = false;
ports.forEach((port) => {
@@ -652,14 +672,8 @@
</Tabs.Root>
<Dialog.Footer class="pt-4">
- <Button variant="outline" onclick={handleClose} disabled={isCreating} class="mr-2">Cancel</Button>
- <Button type="button" onclick={handleSubmit} disabled={isCreating || !containerName.trim() || !selectedImage}>
- {#if isCreating}
- <Loader2 class="mr-2 animate-spin size-4" /> Creating...
- {:else}
- Create Container
- {/if}
- </Button>
+ <ArcaneButton action="cancel" onClick={handleClose} disabled={isCreating} class="mr-2" />
+ <ArcaneButton action="create" loading={isCreating} onClick={handleSubmit} disabled={isCreating || !containerName.trim() || !selectedImage} />
</Dialog.Footer>
</Dialog.Content>
</Dialog.Root>
diff --git a/src/routes/images/+page.svelte b/src/routes/images/+page.svelte
index 90d22e6b0..d4fe5bb22 100644
--- a/src/routes/images/+page.svelte
+++ b/src/routes/images/+page.svelte
@@ -22,6 +22,7 @@
import MaturityItem from '$lib/components/maturity-item.svelte';
import { onMount, onDestroy } from 'svelte';
import { maturityStore } from '$lib/stores/maturity-store';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
let { data }: { data: PageData } = $props();
let images = $derived(data.images || []);
@@ -460,37 +461,11 @@
</DropdownMenu.Content>
</DropdownMenu.Root>
{#if selectedIds.length > 0}
- <Button variant="destructive" onclick={() => handleDeleteSelected()} disabled={isLoading.removing}>
- {#if isLoading.removing}
- <Loader2 class="mr-2 animate-spin size-4" />
- Processing...
- {:else}
- <Trash2 class="size-4" />
- Delete Selected
- {/if}
- </Button>
+ <ArcaneButton action="remove" onClick={() => handleDeleteSelected()} loading={isLoading.removing} disabled={isLoading.removing} />
{/if}
- <Button variant="secondary" onclick={() => (isConfirmPruneDialogOpen = true)} disabled={isLoading.pruning}>
- {#if isLoading.pruning}
- <Loader2 class="animate-spin size-4" /> Pruning...
- {:else}
- <CopyX class="size-4" /> Prune Unused
- {/if}
- </Button>
- <Button variant="secondary" onclick={() => (isPullDialogOpen = true)} disabled={isLoading.pulling}>
- {#if isLoading.pulling}
- <Loader2 class="animate-spin size-4" /> Pulling...
- {:else}
- <Download class="size-4" /> Pull Image
- {/if}
- </Button>
- <Button variant="outline" onclick={() => checkAllMaturity()} disabled={isLoading.checking}>
- {#if isLoading.checking}
- <Loader2 class="mr-2 animate-spin size-4" /> Checking...
- {:else}
- <ScanSearch class="mr-2 size-4" /> Check Updates
- {/if}
- </Button>
+ <ArcaneButton action="remove" label="Prune Unused" onClick={() => (isConfirmPruneDialogOpen = true)} loading={isLoading.pruning} loadingLabel="Pruning..." disabled={isLoading.pruning} />
+ <ArcaneButton action="pull" label="Pull Image" onClick={() => (isPullDialogOpen = true)} loading={isLoading.pulling} loadingLabel="Pulling..." disabled={isLoading.pulling} />
+ <ArcaneButton action="inspect" label="Check Updates" onClick={() => checkAllMaturity()} loading={isLoading.checking} loadingLabel="Checking..." disabled={isLoading.checking} />
</div>
</div>
</Card.Header>
diff --git a/src/routes/images/[imageId]/+page.svelte b/src/routes/images/[imageId]/+page.svelte
index 6ed2cd609..6f891601a 100644
--- a/src/routes/images/[imageId]/+page.svelte
+++ b/src/routes/images/[imageId]/+page.svelte
@@ -14,6 +14,7 @@
import { tryCatch } from '$lib/utils/try-catch';
import ImageAPIService from '$lib/services/api/image-api-service';
import { toast } from 'svelte-sonner';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
let { data }: { data: PageData } = $props();
let { image } = $derived(data);
@@ -75,13 +76,7 @@
</div>
<div class="flex gap-2 flex-wrap">
- <Button variant="destructive" size="sm" onclick={() => handleImageRemove(image.Id)} disabled={isLoading.removing}>
- {#if isLoading.removing}
- <Loader2 class="mr-2 animate-spin size-4" />
- {:else}
- <Trash2 class="mr-2 size-4" />
- {/if} Remove
- </Button>
+ <ArcaneButton action="remove" onClick={() => handleImageRemove(image.Id)} loading={isLoading.removing} disabled={isLoading.removing} size="sm" />
</div>
</div>
@@ -190,9 +185,7 @@
{:else}
<div class="text-center py-12">
<p class="text-lg font-medium text-muted-foreground">Image not found.</p>
- <Button href="/images" variant="outline" size="sm" class="mt-4">
- <ArrowLeft class="mr-2 size-4" /> Back to Images
- </Button>
+ <ArcaneButton action="cancel" customLabel="Back to Images" onClick={() => goto('/images')} size="sm" class="mt-4" />
</div>
{/if}
</div>
diff --git a/src/routes/networks/+page.svelte b/src/routes/networks/+page.svelte
index 927664117..d5d21246e 100644
--- a/src/routes/networks/+page.svelte
+++ b/src/routes/networks/+page.svelte
@@ -16,6 +16,7 @@
import { openConfirmDialog } from '$lib/components/confirm-dialog';
import NetworkAPIService from '$lib/services/api/network-api-service';
import { DEFAULT_NETWORK_NAMES } from '$lib/constants';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
let { data }: { data: PageData } = $props();
@@ -212,20 +213,9 @@
</div>
<div class="flex items-center gap-2">
{#if networkPageStates.selectedNetworks.length > 0}
- <Button variant="destructive" onclick={() => handleDeleteSelected()} disabled={isLoading.remove}>
- {#if isLoading.remove}
- <Loader2 class="mr-2 animate-spin size-4" />
- Processing...
- {:else}
- <Trash2 class="size-4" />
- Delete Selected ({networkPageStates.selectedNetworks.length})
- {/if}
- </Button>
+ <ArcaneButton action="remove" customLabel="Delete Selected ({networkPageStates.selectedNetworks.length})" onClick={() => handleDeleteSelected()} loading={isLoading.remove} loadingLabel="Processing..." disabled={isLoading.remove} />
{/if}
- <Button variant="secondary" data-testid="create-network-button" onclick={() => (networkPageStates.isCreateDialogOpen = true)} disabled={isLoading.create}>
- <Plus class="size-4" />
- Create Network
- </Button>
+ <ArcaneButton action="create" customLabel="Create Network" onClick={() => (networkPageStates.isCreateDialogOpen = true)} disabled={isLoading.create} />
</div>
</div>
</Card.Header>
@@ -295,10 +285,7 @@
<p class="text-lg font-medium">No networks found</p>
<p class="text-sm text-muted-foreground mt-1 max-w-md">Create a new network using the "Create Network" button above or use the Docker CLI</p>
<div class="flex gap-3 mt-4">
- <Button variant="outline" size="sm" onclick={() => (networkPageStates.isCreateDialogOpen = true)}>
- <Plus class="size-4" />
- Create Network
- </Button>
+ <ArcaneButton action="create" customLabel="Create Network" onClick={() => (networkPageStates.isCreateDialogOpen = true)} size="sm" />
</div>
</div>
{/if}
diff --git a/src/routes/networks/CreateNetworkDialog.svelte b/src/routes/networks/CreateNetworkDialog.svelte
index 04532bf38..ea95d023b 100644
--- a/src/routes/networks/CreateNetworkDialog.svelte
+++ b/src/routes/networks/CreateNetworkDialog.svelte
@@ -5,9 +5,10 @@
import { Label } from '$lib/components/ui/label/index.js';
import * as Select from '$lib/components/ui/select/index.js';
import { Checkbox } from '$lib/components/ui/checkbox/index.js';
- import { Loader2, Plus, X } from '@lucide/svelte';
+ import { X } from '@lucide/svelte';
import type { NetworkCreateOptions } from 'dockerode';
import { preventDefault } from '$lib/utils/form.utils';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
type Props = {
open: boolean;
@@ -142,9 +143,7 @@
</Button>
</div>
{/each}
- <Button type="button" variant="outline" size="sm" onclick={addLabel} disabled={isCreating}>
- <Plus class="mr-2 size-4" /> Add Label
- </Button>
+ <ArcaneButton action="create" customLabel="Add Label" onClick={addLabel} disabled={isCreating} size="sm" />
</div>
</div>
@@ -166,14 +165,8 @@
</div>
<Dialog.Footer>
- <Button type="button" variant="outline" onclick={() => (open = false)} disabled={isCreating}>Cancel</Button>
- <Button type="submit" disabled={isCreating || !name.trim()}>
- {#if isCreating}
- <Loader2 class="mr-2 animate-spin size-4" /> Creating...
- {:else}
- Create Network
- {/if}
- </Button>
+ <ArcaneButton action="cancel" onClick={() => (open = false)} disabled={isCreating} />
+ <ArcaneButton action="create" customLabel="Create Network" onClick={handleSubmit} loading={isCreating} loadingLabel="Creating..." disabled={isCreating || !name.trim()} />
</Dialog.Footer>
</form>
</Dialog.Content>
diff --git a/src/routes/networks/[networkId]/+page.server.ts b/src/routes/networks/[networkId]/+page.server.ts
index 75fedfbf4..264190081 100644
--- a/src/routes/networks/[networkId]/+page.server.ts
+++ b/src/routes/networks/[networkId]/+page.server.ts
@@ -24,19 +24,3 @@ export const load: PageServerLoad = async ({ params }) => {
}
}
};
-
-export const actions: Actions = {
- remove: async ({ params }) => {
- const networkId = params.networkId;
- try {
- await removeNetwork(networkId);
- redirect(303, '/networks');
- } catch (err: unknown) {
- console.error(`Failed to remove network ${networkId}:`, err);
- if (err instanceof NotFoundError || err instanceof ConflictError || err instanceof DockerApiError) {
- return fail('status' in err ? err.status : 500, { error: err.message });
- }
- return fail(500, { error: err instanceof Error ? err.message : 'An unexpected error occurred during removal.' });
- }
- }
-};
diff --git a/src/routes/networks/[networkId]/+page.svelte b/src/routes/networks/[networkId]/+page.svelte
index 9d36f2aa8..9e67e3156 100644
--- a/src/routes/networks/[networkId]/+page.svelte
+++ b/src/routes/networks/[networkId]/+page.svelte
@@ -1,21 +1,26 @@
<script lang="ts">
- import type { PageData, ActionData } from './$types';
+ import type { PageData } from './$types';
import * as Card from '$lib/components/ui/card/index.js';
- import { Button } from '$lib/components/ui/button/index.js';
- import { ArrowLeft, AlertCircle, HardDrive, Clock, Tag, Layers, Hash, Trash2, Loader2, Network, Globe, Settings, ListTree, Container } from '@lucide/svelte';
+ import { AlertCircle, HardDrive, Clock, Tag, Layers, Hash, Network, Globe, Settings, ListTree, Container } from '@lucide/svelte';
import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js';
- import { enhance } from '$app/forms';
import * as Alert from '$lib/components/ui/alert/index.js';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { formatDate } from '$lib/utils/string.utils';
import type { NetworkInspectInfo } from 'dockerode';
import { toast } from 'svelte-sonner';
import { openConfirmDialog } from '$lib/components/confirm-dialog';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
+ import { goto } from '$app/navigation';
+ import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
+ import { tryCatch } from '$lib/utils/try-catch';
+ import NetworkAPIService from '$lib/services/api/network-api-service';
- let { data, form }: { data: PageData; form: ActionData } = $props();
+ let { data }: { data: PageData } = $props();
let { network }: { network: NetworkInspectInfo | null | undefined } = $derived(data);
+ let errorMessage = $state('');
let isRemoving = $state(false);
+ const networkApi = new NetworkAPIService();
const shortId = $derived(network?.Id?.substring(0, 12) || 'N/A');
const createdDate = $derived(network?.Created ? formatDate(network.Created) : 'N/A');
@@ -29,15 +34,32 @@
console.warn('Cannot remove predefined network');
return;
}
+
+ if (!network?.Id) {
+ toast.error('Network ID is missing');
+ return;
+ }
+
openConfirmDialog({
title: 'Remove Network',
message: `Are you sure you want to remove the network "${network?.Name || shortId}"? This action cannot be undone.`,
confirm: {
label: 'Remove',
destructive: true,
- action: () => {
- const formElement = document.getElementById('remove-network-form') as HTMLFormElement | null;
- formElement?.requestSubmit();
+ action: async () => {
+ handleApiResultWithCallbacks({
+ result: await tryCatch(networkApi.remove(network.Id)),
+ message: 'Failed to remove network',
+ setLoadingState: (value) => (isRemoving = value),
+ onSuccess: async () => {
+ toast.success(`Network "${network.Name || shortId}" removed successfully`);
+ goto('/networks');
+ },
+ onError: (error) => {
+ errorMessage = error?.message || 'An error occurred while removing the network';
+ toast.error(errorMessage);
+ }
+ });
}
}
});
@@ -86,40 +108,16 @@
</div>
<div class="self-start">
- <Button variant="destructive" size="sm" onclick={triggerRemove} disabled={isRemoving || isPredefined} title={isPredefined ? 'Cannot remove predefined networks' : ''} class="w-full sm:w-auto">
- {#if isRemoving}
- <Loader2 class="mr-2 animate-spin size-4" />
- {:else}
- <Trash2 class="mr-2 size-4" />
- {/if}
- Remove Network
- </Button>
+ <ArcaneButton action="remove" customLabel="Remove Network" onClick={triggerRemove} loading={isRemoving} disabled={isRemoving || isPredefined} label={isPredefined ? 'Cannot remove predefined networks' : 'Delete Network'} />
</div>
-
- <form
- id="remove-network-form"
- method="POST"
- action="?/remove"
- use:enhance={() => {
- isRemoving = true;
- return async ({ update }) => {
- await update({ reset: false });
- isRemoving = false;
- };
- }}
- class="hidden"
- >
- <input type="hidden" name="networkId" value={network?.Id} />
- <button type="submit">Submit</button>
- </form>
</div>
</div>
- {#if form?.error}
+ {#if errorMessage}
<Alert.Root variant="destructive">
<AlertCircle class="mr-2 size-4" />
<Alert.Title>Action Failed</Alert.Title>
- <Alert.Description>{form.error}</Alert.Description>
+ <Alert.Description>{errorMessage}</Alert.Description>
</Alert.Root>
{/if}
@@ -397,9 +395,7 @@
</div>
<h2 class="text-xl font-medium mb-2">Network Not Found</h2>
<p class="text-muted-foreground mb-6">The requested network could not be found or is no longer available.</p>
- <Button href="/networks" variant="outline" size="sm">
- <ArrowLeft class="mr-2 size-4" /> Back to Networks
- </Button>
+ <ArcaneButton action="cancel" customLabel="Back to Networks" onClick={() => goto('/networks')} size="sm" />
</div>
{/if}
</div>
diff --git a/src/routes/onboarding/settings/+page.svelte b/src/routes/onboarding/settings/+page.svelte
index 31058bf1f..63466a2f4 100644
--- a/src/routes/onboarding/settings/+page.svelte
+++ b/src/routes/onboarding/settings/+page.svelte
@@ -116,7 +116,6 @@
<Input id="dockerHost" bind:value={dockerHost} placeholder="unix:///var/run/docker.sock" class="px-4 bg-muted/10 size-12" />
<p class="text-xs text-muted-foreground">
Examples: Unix: <code class="bg-muted/30 px-1 py-0.5 rounded">unix:///var/run/docker.sock</code>
- Windows: <code class="bg-muted/30 px-1 py-0.5 rounded">npipe:////./pipe/docker_engine</code>
</p>
</div>
</Card.Content>
diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte
index d7b463db9..ece1e55e1 100644
--- a/src/routes/settings/+page.svelte
+++ b/src/routes/settings/+page.svelte
@@ -62,7 +62,7 @@
<p class="text-sm text-muted-foreground mt-1">Configure Arcane's settings and permissions</p>
</div>
- <Button onclick={saveSettings} disabled={isLoading.saving} class="h-10">
+ <Button onclick={saveSettings} disabled={isLoading.saving} class="h-10 arcane-button-save">
{#if isLoading.saving}
<RefreshCw class="animate-spin size-4" />
Saving...
diff --git a/src/routes/settings/tabs/authentication.svelte b/src/routes/settings/tabs/authentication.svelte
index 6b4399bfe..865fdeb98 100644
--- a/src/routes/settings/tabs/authentication.svelte
+++ b/src/routes/settings/tabs/authentication.svelte
@@ -308,7 +308,7 @@
<div class="grid grid-cols-3 gap-2">
<Button
variant={($settingsStore.auth?.passwordPolicy || 'strong') === 'basic' ? 'default' : 'outline'}
- class="w-full"
+ class={($settingsStore.auth?.passwordPolicy || 'strong') === 'basic' ? 'w-full arcane-button-create' : 'w-full arcane-button-restart'}
onclick={() => {
settingsStore.update((current) => ({
...current,
@@ -321,7 +321,7 @@
>
<Button
variant={($settingsStore.auth?.passwordPolicy || 'strong') === 'standard' ? 'default' : 'outline'}
- class="w-full"
+ class={($settingsStore.auth?.passwordPolicy || 'strong') === 'standard' ? 'w-full arcane-button-create' : 'w-full arcane-button-restart'}
onclick={() => {
settingsStore.update((current) => ({
...current,
@@ -334,7 +334,7 @@
>
<Button
variant={($settingsStore.auth?.passwordPolicy || 'strong') === 'strong' ? 'default' : 'outline'}
- class="w-full"
+ class={($settingsStore.auth?.passwordPolicy || 'strong') === 'strong' ? 'w-full arcane-button-create' : 'w-full arcane-button-restart'}
onclick={() => {
settingsStore.update((current) => ({
...current,
diff --git a/src/routes/settings/tabs/docker-settings.svelte b/src/routes/settings/tabs/docker-settings.svelte
index 61d9fa740..4c44da725 100644
--- a/src/routes/settings/tabs/docker-settings.svelte
+++ b/src/routes/settings/tabs/docker-settings.svelte
@@ -145,8 +145,8 @@
<p class="text-sm text-muted-foreground">Configure access to private Docker registries</p>
</div>
</div>
- <Button size="sm" variant="outline" onclick={openCreateRegistryDialog}>
- <Plus class="mr-2 size-4" /> Add Registry
+ <Button onclick={openCreateRegistryDialog} class="arcane-button-save">
+ <Plus class="size-4" /> Add Registry
</Button>
</div>
diff --git a/src/routes/settings/tabs/user-management.svelte b/src/routes/settings/tabs/user-management.svelte
index 613797506..c45bbae4c 100644
--- a/src/routes/settings/tabs/user-management.svelte
+++ b/src/routes/settings/tabs/user-management.svelte
@@ -106,8 +106,8 @@
<Card.Description>Manage local user accounts</Card.Description>
</div>
</div>
- <Button size="sm" onclick={openCreateUserDialog}>
- <UserPlus class="mr-2 size-4" />
+ <Button class="arcane-button-save" onclick={openCreateUserDialog}>
+ <UserPlus class="size-4" />
Create User
</Button>
</Card.Header>
diff --git a/src/routes/stacks/+page.svelte b/src/routes/stacks/+page.svelte
index a22b769f5..abb879cd8 100644
--- a/src/routes/stacks/+page.svelte
+++ b/src/routes/stacks/+page.svelte
@@ -17,6 +17,7 @@
import StackAPIService from '$lib/services/api/stack-api-service';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import type { StackActions } from '$lib/types/actions.type';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
let { data }: { data: PageData } = $props();
let stacks = $derived(data.stacks);
@@ -205,10 +206,7 @@
<Card.Title>Stack List</Card.Title>
</div>
<div class="flex items-center gap-2">
- <Button variant="secondary" onclick={() => goto(`/stacks/new`)}>
- <Plus class="size-4" />
- Create Stack
- </Button>
+ <ArcaneButton action="create" customLabel="Create Stack" onClick={() => goto(`/stacks/new`)} />
</div>
</div>
</Card.Header>
@@ -257,14 +255,7 @@
<Table.Cell>{item.createdAt}</Table.Cell>
<Table.Cell>
{#if item.isExternal}
- <Button onclick={() => handleImportStack(item.id, item.name)} variant="outline" title="Import Stack to Arcane" disabled={isLoading.import} class="flex items-center">
- {#if isLoading.import}
- <Loader2 class="mr-2 animate-spin size-4" />
- {:else}
- <Import class="mr-2 size-4" />
- {/if}
- Import
- </Button>
+ <ArcaneButton action="pull" customLabel="Import" onClick={() => handleImportStack(item.id, item.name)} loading={isLoading.import} disabled={isLoading.import} />
{:else}
<DropdownMenu.Root>
<DropdownMenu.Trigger>
@@ -342,6 +333,9 @@
<FileStack class="text-muted-foreground mb-4 opacity-40 size-12" />
<p class="text-lg font-medium">No stacks found</p>
<p class="text-sm text-muted-foreground mt-1 max-w-md">Create a new stack using the "Create Stack" button above or import an existing compose file</p>
+ <div class="flex gap-3 mt-4">
+ <ArcaneButton action="create" customLabel="Create Stack" onClick={() => goto(`/stacks/new`)} size="sm" />
+ </div>
</div>
{/if}
</Card.Content>
diff --git a/src/routes/stacks/[stackId]/+page.svelte b/src/routes/stacks/[stackId]/+page.svelte
index 5d65a95b6..bd3c3805d 100644
--- a/src/routes/stacks/[stackId]/+page.svelte
+++ b/src/routes/stacks/[stackId]/+page.svelte
@@ -19,6 +19,7 @@
import { tryCatch } from '$lib/utils/try-catch';
import StackAPIService from '$lib/services/api/stack-api-service';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
const stackApi = new StackAPIService();
@@ -286,13 +287,7 @@
<!-- Save button positioned right -->
<div class="self-start">
- <Button type="button" variant={hasChanges ? 'default' : 'secondary'} onclick={handleSaveChanges} disabled={isLoading.saving || !hasChanges} class="min-w-[120px]">
- {#if isLoading.saving}
- <Loader2 class="mr-2 animate-spin size-4" /> Saving...
- {:else}
- <Save class="mr-2 size-4" /> Save Changes
- {/if}
- </Button>
+ <ArcaneButton action="save" disabled={!hasChanges} onClick={handleSaveChanges} loading={isLoading.saving} />
</div>
</div>
diff --git a/src/routes/stacks/new/+page.svelte b/src/routes/stacks/new/+page.svelte
index 469352629..8cead6a4d 100644
--- a/src/routes/stacks/new/+page.svelte
+++ b/src/routes/stacks/new/+page.svelte
@@ -14,6 +14,7 @@
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import EnvEditor from '$lib/components/env-editor.svelte';
import { defaultEnvTemplate, defaultComposeTemplate } from '$lib/constants';
+ import ArcaneButton from '$lib/components/arcane-button.svelte'; // Add this import
const stackApi = new StackAPIService();
let saving = $state(false);
@@ -62,14 +63,17 @@
<form class="space-y-6" onsubmit={preventDefault(handleSubmit)}>
<Card.Root class="border shadow-sm">
<Card.Header>
- <div class="flex items-center gap-3">
- <div class="bg-primary/10 p-2 rounded-full">
- <FileStack class="text-primary size-5" />
- </div>
- <div>
- <Card.Title>Stack Configuration</Card.Title>
- <Card.Description>Create a new Docker Compose stack with environment variables</Card.Description>
+ <div class="flex items-center justify-between w-full">
+ <div class="flex items-center gap-3">
+ <div class="bg-primary/10 p-2 rounded-full">
+ <FileStack class="text-primary size-5" />
+ </div>
+ <div>
+ <Card.Title>Stack Configuration</Card.Title>
+ <Card.Description>Create a new Docker Compose stack with environment variables</Card.Description>
+ </div>
</div>
+ <ArcaneButton action="create" onClick={handleSubmit} loading={saving} disabled={!name || !composeContent} />
</div>
</Card.Header>
<Card.Content>
@@ -104,14 +108,6 @@
<ArrowLeft class="mr-2 size-4" />
Cancel
</Button>
- <Button type="submit" variant="default" disabled={saving || !name || !composeContent}>
- {#if saving}
- <Loader2 class="mr-2 animate-spin size-4" />
- {:else}
- <Save class="mr-2 size-4" />
- {/if}
- Create Stack
- </Button>
</Card.Footer>
</Card.Root>
</form>
diff --git a/src/routes/volumes/+page.svelte b/src/routes/volumes/+page.svelte
index 1a98953cc..2640a9e3e 100644
--- a/src/routes/volumes/+page.svelte
+++ b/src/routes/volumes/+page.svelte
@@ -16,6 +16,7 @@
import VolumeAPIService from '$lib/services/api/volume-api-service';
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import type { VolumeCreateOptions, VolumeInspectInfo } from 'dockerode';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
let { data }: { data: PageData } = $props();
@@ -216,20 +217,9 @@
</DropdownMenu.Content>
</DropdownMenu.Root>
{#if volumePageStates.selectedIds.length > 0}
- <Button variant="destructive" onclick={() => handleDeleteSelected()} disabled={isLoading.remove}>
- {#if isLoading.remove}
- <Loader2 class="mr-2 animate-spin size-4" />
- Processing...
- {:else}
- <Trash2 class="size-4" />
- Delete Selected ({volumePageStates.selectedIds.length})
- {/if}
- </Button>
+ <ArcaneButton action="remove" customLabel="Delete Selected ({volumePageStates.selectedIds.length})" onClick={handleDeleteSelected} loading={isLoading.remove} loadingLabel="Processing..." disabled={isLoading.remove} />
{/if}
- <Button variant="secondary" onclick={() => (isDialogOpen.create = true)}>
- <Plus class="size-4" />
- Create Volume
- </Button>
+ <ArcaneButton action="create" customLabel="Create Volume" onClick={() => (isDialogOpen.create = true)} />
</div>
</div>
</Card.Header>
@@ -302,6 +292,9 @@
<Database class="text-muted-foreground mb-4 opacity-40 size-12" />
<p class="text-lg font-medium">No volumes found</p>
<p class="text-sm text-muted-foreground mt-1 max-w-md">Create a new volume using the "Create Volume" button above or use the Docker CLI</p>
+ <div class="flex gap-3 mt-4">
+ <ArcaneButton action="create" customLabel="Create Volume" onClick={() => (isDialogOpen.create = true)} size="sm" />
+ </div>
</div>
{/if}
</Card.Content>
diff --git a/src/routes/volumes/[volumeName]/+page.svelte b/src/routes/volumes/[volumeName]/+page.svelte
index 936f99721..ec439f923 100644
--- a/src/routes/volumes/[volumeName]/+page.svelte
+++ b/src/routes/volumes/[volumeName]/+page.svelte
@@ -13,6 +13,7 @@
import { tryCatch } from '$lib/utils/try-catch';
import { handleApiResultWithCallbacks } from '$lib/utils/api.util';
import VolumeAPIService from '$lib/services/api/volume-api-service';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
let { data, form }: { data: PageData; form: ActionData } = $props();
let { volume, inUse } = $derived(data);
@@ -92,15 +93,9 @@
</div>
</div>
- <!-- Action Buttons -->
+ <!-- Action Buttons - Replace with ArcaneButton -->
<div class="flex gap-2 self-start">
- <Button variant="destructive" size="sm" onclick={() => handleRemoveVolumeConfirm(volume?.Name)} disabled={isLoading.remove}>
- {#if isLoading.remove}
- <Loader2 class="animate-spin size-4" />
- {:else}
- <Trash2 class="size-4" />
- {/if} Remove Volume
- </Button>
+ <ArcaneButton action="remove" customLabel="Remove Volume" onClick={() => handleRemoveVolumeConfirm(volume?.Name)} loading={isLoading.remove} disabled={isLoading.remove} />
</div>
</div>
</div>
@@ -280,9 +275,8 @@
</div>
<h2 class="text-xl font-medium mb-2">Volume Not Found</h2>
<p class="text-muted-foreground mb-6">The requested volume could not be found or is no longer available.</p>
- <Button href="/volumes" variant="outline" size="sm">
- <ArrowLeft class="mr-2 size-4" /> Back to Volumes
- </Button>
+
+ <ArcaneButton action="cancel" customLabel="Back to Volumes" onClick={() => goto('/volumes')} size="sm" />
</div>
{/if}
</div>
diff --git a/src/routes/volumes/create-volume-dialog.svelte b/src/routes/volumes/create-volume-dialog.svelte
index 19d1aac73..3e9228418 100644
--- a/src/routes/volumes/create-volume-dialog.svelte
+++ b/src/routes/volumes/create-volume-dialog.svelte
@@ -9,6 +9,7 @@
import * as Accordion from '$lib/components/ui/accordion/index.js';
import * as Select from '$lib/components/ui/select/index.js';
import type { VolumeCreateOptions } from 'dockerode';
+ import ArcaneButton from '$lib/components/arcane-button.svelte';
interface Props {
open?: boolean;
@@ -125,14 +126,9 @@
</form>
<Dialog.Footer>
- <Button variant="outline" onclick={() => (open = false)} disabled={isCreating}>Cancel</Button>
- <Button type="submit" onclick={handleSubmit} disabled={isCreating || !volumeCreateStates.volumeName.trim()}>
- {#if isCreating}
- <Loader2 class="mr-2 animate-spin size-4" /> Creating...
- {:else}
- Create Volume
- {/if}
- </Button>
+ <ArcaneButton action="cancel" onClick={() => (open = false)} disabled={isCreating} />
+
+ <ArcaneButton action="create" customLabel="Create Volume" onClick={handleSubmit} loading={isCreating} loadingLabel="Creating..." disabled={isCreating || !volumeCreateStates.volumeName.trim()} />
</Dialog.Footer>
</Dialog.Content>
</Dialog.Root>