Skip to content

Modern Docker Management, Designed for Everyone

chore: clean up some ui elements

Kyle Mendell9282252e5998
diff --git a/frontend/jsrepo.json b/frontend/jsrepo.json
new file mode 100644
index 000000000..7676ff04a
--- /dev/null
+++ b/frontend/jsrepo.json
@@ -0,0 +1,16 @@
+{
+ "$schema": "https://unpkg.com/[email protected]/schemas/project-config.json",
+ "repos": ["@ieedan/shadcn-svelte-extras"],
+ "includeTests": false,
+ "includeDocs": false,
+ "watermark": true,
+ "formatter": "prettier",
+ "configFiles": {},
+ "paths": {
+ "*": "$lib/ui/extras",
+ "ui": "$lib/components/ui",
+ "actions": "$lib/actions",
+ "hooks": "$lib/hooks",
+ "utils": "$lib/utils"
+ }
+}
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index 1eec1d2a6..57be8056c 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -1,16 +1,15 @@
{
"name": "arcane",
- "version": "0.15.0",
+ "version": "0.15.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "arcane",
- "version": "0.15.0",
+ "version": "0.15.1",
"dependencies": {
"@codemirror/lang-yaml": "^6.1.2",
"@codemirror/legacy-modes": "^6.5.1",
- "@lucide/svelte": "^0.522.0",
"@sveltejs/adapter-static": "^3.0.8",
"@tanstack/table-core": "^8.21.3",
"axios": "^1.10.0",
@@ -27,6 +26,7 @@
"devDependencies": {
"@eslint/compat": "^1.3.0",
"@eslint/js": "^9.29.0",
+ "@lucide/svelte": "^0.522.0",
"@playwright/test": "^1.52.0",
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^5.1.0",
@@ -1040,6 +1040,7 @@
"version": "0.522.0",
"resolved": "https://registry.npmjs.org/@lucide/svelte/-/svelte-0.522.0.tgz",
"integrity": "sha512-Q10WkheTfb0sZ6y+EQVTqW4DN8nD2mym00gVpinbe3dJWRW3/R7SeTGF9pW+Ux4PrzkNV9dUdUTWcbO/AdKwQQ==",
+ "dev": true,
"license": "ISC",
"peerDependencies": {
"svelte": "^5"
diff --git a/frontend/package.json b/frontend/package.json
index 44bf661bd..7178a439e 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -24,7 +24,6 @@
"dependencies": {
"@codemirror/lang-yaml": "^6.1.2",
"@codemirror/legacy-modes": "^6.5.1",
- "@lucide/svelte": "^0.522.0",
"@sveltejs/adapter-static": "^3.0.8",
"@tanstack/table-core": "^8.21.3",
"axios": "^1.10.0",
@@ -41,6 +40,7 @@
"devDependencies": {
"@eslint/compat": "^1.3.0",
"@eslint/js": "^9.29.0",
+ "@lucide/svelte": "^0.522.0",
"@playwright/test": "^1.52.0",
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^5.1.0",
diff --git a/frontend/src/lib/components/ui/button/button.svelte b/frontend/src/lib/components/ui/button/button.svelte
index 6fa70709c..498144763 100644
--- a/frontend/src/lib/components/ui/button/button.svelte
+++ b/frontend/src/lib/components/ui/button/button.svelte
@@ -1,16 +1,22 @@
+<!--
+ Installed from @ieedan/shadcn-svelte-extras
+-->
+
<script lang="ts" module>
- import { cn, type WithElementRef } from '$lib/utils.js';
+ import type { WithChildren, WithoutChildren } from 'bits-ui';
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
import { type VariantProps, tv } from 'tailwind-variants';
export const buttonVariants = tv({
- base: "focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium outline-none transition-all focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",
+ base: "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 relative inline-flex shrink-0 items-center justify-center gap-2 overflow-hidden rounded-md text-sm font-medium whitespace-nowrap outline-hidden transition-all select-none focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
variants: {
variant: {
- default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
- destructive: 'bg-destructive shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60 text-white',
- outline: 'bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border',
- secondary: 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',
+ default: 'bg-primary text-primary-foreground hover:bg-primary/90 shadow-2xs',
+ destructive:
+ 'bg-destructive hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 text-white shadow-2xs',
+ outline:
+ 'bg-background hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50 border shadow-2xs',
+ secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-2xs',
ghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',
link: 'text-primary underline-offset-4 hover:underline'
},
@@ -30,23 +36,93 @@
export type ButtonVariant = VariantProps<typeof buttonVariants>['variant'];
export type ButtonSize = VariantProps<typeof buttonVariants>['size'];
- export type ButtonProps = WithElementRef<HTMLButtonAttributes> &
- WithElementRef<HTMLAnchorAttributes> & {
- variant?: ButtonVariant;
- size?: ButtonSize;
+ export type ButtonPropsWithoutHTML = WithChildren<{
+ ref?: HTMLElement | null;
+ variant?: ButtonVariant;
+ size?: ButtonSize;
+ loading?: boolean;
+ onClickPromise?: (
+ e: MouseEvent & {
+ currentTarget: EventTarget & HTMLButtonElement;
+ }
+ ) => Promise<void>;
+ }>;
+
+ export type AnchorElementProps = ButtonPropsWithoutHTML &
+ WithoutChildren<Omit<HTMLAnchorAttributes, 'href' | 'type'>> & {
+ href: HTMLAnchorAttributes['href'];
+ type?: never;
+ disabled?: HTMLButtonAttributes['disabled'];
};
+
+ export type ButtonElementProps = ButtonPropsWithoutHTML &
+ WithoutChildren<Omit<HTMLButtonAttributes, 'type' | 'href'>> & {
+ type?: HTMLButtonAttributes['type'];
+ href?: never;
+ disabled?: HTMLButtonAttributes['disabled'];
+ };
+
+ export type ButtonProps = AnchorElementProps | ButtonElementProps;
</script>
<script lang="ts">
- let { class: className, variant = 'default', size = 'default', ref = $bindable(null), href = undefined, type = 'button', disabled, children, ...restProps }: ButtonProps = $props();
+ import { cn } from '$lib/utils/utils.js';
+ import { LoaderCircleIcon } from '@lucide/svelte';
+
+ let {
+ ref = $bindable(null),
+ variant = 'default',
+ size = 'default',
+ href = undefined,
+ type = 'button',
+ loading = false,
+ disabled = false,
+ tabindex = 0,
+ onclick,
+ onClickPromise,
+ class: className,
+ children,
+ ...rest
+ }: ButtonProps = $props();
</script>
-{#if href}
- <a bind:this={ref} data-slot="button" class={cn(buttonVariants({ variant, size }), className)} href={disabled ? undefined : href} aria-disabled={disabled} role={disabled ? 'link' : undefined} tabindex={disabled ? -1 : undefined} {...restProps}>
- {@render children?.()}
- </a>
-{:else}
- <button bind:this={ref} data-slot="button" class={cn(buttonVariants({ variant, size }), className)} {type} {disabled} {...restProps}>
- {@render children?.()}
- </button>
-{/if}
+<!-- This approach to disabled links is inspired by bits-ui see: https://github.com/huntabyte/bits-ui/pull/1055 -->
+<svelte:element
+ this={href ? 'a' : 'button'}
+ {...rest}
+ data-slot="button"
+ type={href ? undefined : type}
+ href={href && !disabled ? href : undefined}
+ disabled={href ? undefined : disabled || loading}
+ aria-disabled={href ? disabled : undefined}
+ role={href && disabled ? 'link' : undefined}
+ tabindex={href && disabled ? -1 : tabindex}
+ class={cn(buttonVariants({ variant, size }), className)}
+ bind:this={ref}
+ onclick={async (
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ e: any
+ ) => {
+ onclick?.(e);
+
+ if (type === undefined) return;
+
+ if (onClickPromise) {
+ loading = true;
+
+ await onClickPromise(e);
+
+ loading = false;
+ }
+ }}
+>
+ {#if type !== undefined && loading}
+ <div class="absolute flex size-full place-items-center justify-center bg-inherit">
+ <div class="flex animate-spin place-items-center justify-center">
+ <LoaderCircleIcon class="size-4" />
+ </div>
+ </div>
+ <span class="sr-only">Loading</span>
+ {/if}
+ {@render children?.()}
+</svelte:element>
diff --git a/frontend/src/lib/components/ui/button/index.ts b/frontend/src/lib/components/ui/button/index.ts
index 3fd7e24ba..34c3e590c 100644
--- a/frontend/src/lib/components/ui/button/index.ts
+++ b/frontend/src/lib/components/ui/button/index.ts
@@ -1,4 +1,16 @@
-import Root, { type ButtonProps, type ButtonSize, type ButtonVariant, buttonVariants } from './button.svelte';
+/*
+ Installed from @ieedan/shadcn-svelte-extras
+*/
+
+import Root, {
+ type ButtonProps,
+ type ButtonSize,
+ type ButtonVariant,
+ type AnchorElementProps,
+ type ButtonElementProps,
+ type ButtonPropsWithoutHTML,
+ buttonVariants
+} from './button.svelte';
export {
Root,
@@ -8,5 +20,8 @@ export {
buttonVariants,
type ButtonProps,
type ButtonSize,
- type ButtonVariant
+ type ButtonVariant,
+ type AnchorElementProps,
+ type ButtonElementProps,
+ type ButtonPropsWithoutHTML
};
diff --git a/frontend/src/lib/components/ui/copy-button/copy-button.svelte b/frontend/src/lib/components/ui/copy-button/copy-button.svelte
new file mode 100644
index 000000000..04e5f7140
--- /dev/null
+++ b/frontend/src/lib/components/ui/copy-button/copy-button.svelte
@@ -0,0 +1,71 @@
+<!--
+ Installed from @ieedan/shadcn-svelte-extras
+-->
+
+<script lang="ts">
+ import { Button } from '$lib/components/ui/button';
+ import { UseClipboard } from '$lib/hooks/use-clipboard.svelte';
+ import { cn } from '$lib/utils/utils';
+ import { CheckIcon, CopyIcon, XIcon } from '@lucide/svelte';
+ import { scale } from 'svelte/transition';
+ import type { CopyButtonProps } from './types';
+
+ let {
+ ref = $bindable(null),
+ text,
+ icon,
+ animationDuration = 500,
+ variant = 'ghost',
+ size = 'icon',
+ onCopy,
+ class: className,
+ tabindex = -1,
+ children,
+ ...rest
+ }: CopyButtonProps = $props();
+
+ // this way if the user passes text then the button will be the default size
+ if (size === 'icon' && children) {
+ size = 'default';
+ }
+
+ const clipboard = new UseClipboard();
+</script>
+
+<Button
+ {...rest}
+ bind:ref
+ {variant}
+ {size}
+ {tabindex}
+ class={cn('flex items-center gap-2', className)}
+ type="button"
+ name="copy"
+ onclick={async () => {
+ const status = await clipboard.copy(text);
+
+ onCopy?.(status);
+ }}
+>
+ {#if clipboard.status === 'success'}
+ <div in:scale={{ duration: animationDuration, start: 0.85 }}>
+ <CheckIcon tabindex={-1} />
+ <span class="sr-only">Copied</span>
+ </div>
+ {:else if clipboard.status === 'failure'}
+ <div in:scale={{ duration: animationDuration, start: 0.85 }}>
+ <XIcon tabindex={-1} />
+ <span class="sr-only">Failed to copy</span>
+ </div>
+ {:else}
+ <div in:scale={{ duration: animationDuration, start: 0.85 }}>
+ {#if icon}
+ {@render icon()}
+ {:else}
+ <CopyIcon tabindex={-1} />
+ {/if}
+ <span class="sr-only">Copy</span>
+ </div>
+ {/if}
+ {@render children?.()}
+</Button>
diff --git a/frontend/src/lib/components/ui/copy-button/index.ts b/frontend/src/lib/components/ui/copy-button/index.ts
new file mode 100644
index 000000000..06ff7998d
--- /dev/null
+++ b/frontend/src/lib/components/ui/copy-button/index.ts
@@ -0,0 +1,7 @@
+/*
+ Installed from @ieedan/shadcn-svelte-extras
+*/
+
+import CopyButton from './copy-button.svelte';
+
+export { CopyButton };
diff --git a/frontend/src/lib/components/ui/copy-button/types.ts b/frontend/src/lib/components/ui/copy-button/types.ts
new file mode 100644
index 000000000..4b1e59328
--- /dev/null
+++ b/frontend/src/lib/components/ui/copy-button/types.ts
@@ -0,0 +1,22 @@
+/*
+ Installed from @ieedan/shadcn-svelte-extras
+*/
+
+import type { Snippet } from 'svelte';
+import type { ButtonPropsWithoutHTML } from '$lib/components/ui/button';
+import type { UseClipboard } from '$lib/hooks/use-clipboard.svelte';
+import type { HTMLAttributes } from 'svelte/elements';
+import type { WithChildren, WithoutChildren } from 'bits-ui';
+
+export type CopyButtonPropsWithoutHTML = WithChildren<
+ Pick<ButtonPropsWithoutHTML, 'size' | 'variant'> & {
+ ref?: HTMLButtonElement | null;
+ text: string;
+ icon?: Snippet<[]>;
+ animationDuration?: number;
+ onCopy?: (status: UseClipboard['status']) => void;
+ }
+>;
+
+export type CopyButtonProps = CopyButtonPropsWithoutHTML &
+ WithoutChildren<HTMLAttributes<HTMLButtonElement>>;
diff --git a/frontend/src/lib/components/ui/snippet/index.ts b/frontend/src/lib/components/ui/snippet/index.ts
new file mode 100644
index 000000000..a1f64875e
--- /dev/null
+++ b/frontend/src/lib/components/ui/snippet/index.ts
@@ -0,0 +1,7 @@
+/*
+ Installed from @ieedan/shadcn-svelte-extras
+*/
+
+import Snippet from './snippet.svelte';
+
+export { Snippet };
diff --git a/frontend/src/lib/components/ui/snippet/snippet.svelte b/frontend/src/lib/components/ui/snippet/snippet.svelte
new file mode 100644
index 000000000..9a2c0eec4
--- /dev/null
+++ b/frontend/src/lib/components/ui/snippet/snippet.svelte
@@ -0,0 +1,55 @@
+<!--
+ Installed from @ieedan/shadcn-svelte-extras
+-->
+
+<script lang="ts" module>
+ import { cn } from '$lib/utils/utils';
+ import { tv, type VariantProps } from 'tailwind-variants';
+ import { CopyButton } from '$lib/components/ui/copy-button';
+ import type { UseClipboard } from '$lib/hooks/use-clipboard.svelte';
+
+ const style = tv({
+ base: 'bg-background relative w-full max-w-full rounded-md border py-2.5 pr-12 pl-3',
+ variants: {
+ variant: {
+ default: 'border-border bg-card',
+ secondary: 'border-border bg-accent',
+ destructive: 'border-destructive bg-destructive',
+ primary: 'border-primary bg-primary text-primary-foreground'
+ }
+ }
+ });
+
+ type Variant = VariantProps<typeof style>['variant'];
+
+ export type SnippetProps = {
+ variant?: Variant;
+ text: string | string[];
+ class?: string;
+ onCopy?: (status: UseClipboard['status']) => void;
+ };
+</script>
+
+<script lang="ts">
+ let { text, variant = 'default', onCopy, class: className }: SnippetProps = $props();
+</script>
+
+<div class={cn(style({ variant, className: className }))}>
+ {#if typeof text == 'string'}
+ <pre class={cn('overflow-y-auto text-left font-mono text-sm font-light whitespace-nowrap')}>
+ {text}
+ </pre>
+ {:else}
+ {#each text as line, i (i)}
+ <pre class={cn('overflow-y-auto text-left font-mono text-sm font-light whitespace-nowrap')}>
+ {line}
+ </pre>
+ {/each}
+ {/if}
+
+ <CopyButton
+ class="hover:text-opacity-80 absolute top-1/2 right-2 size-7 -translate-y-1/2 transition-opacity ease-in-out hover:bg-transparent dark:hover:bg-transparent"
+ text={typeof text === 'string' ? text : text.join('\n')}
+ {onCopy}
+ />
+</div>
diff --git a/frontend/src/lib/hooks/use-clipboard.svelte.ts b/frontend/src/lib/hooks/use-clipboard.svelte.ts
new file mode 100644
index 000000000..01c12ead2
--- /dev/null
+++ b/frontend/src/lib/hooks/use-clipboard.svelte.ts
@@ -0,0 +1,87 @@
+/*
+ Installed from @ieedan/shadcn-svelte-extras
+*/
+
+type Options = {
+ /** The time before the copied status is reset. */
+ delay: number;
+};
+
+/** Use this hook to copy text to the clipboard and show a copied state.
+ *
+ * ## Usage
+ * ```svelte
+ * <script lang="ts">
+ * import { UseClipboard } from "$lib/hooks/use-clipboard.svelte";
+ *
+ * const clipboard = new UseClipboard();
+ * </script>
+ *
+ * <button onclick={clipboard.copy('Hello, World!')}>
+ * {#if clipboard.copied === 'success'}
+ * Copied!
+ * {:else if clipboard.copied === 'failure'}
+ * Failed to copy!
+ * {:else}
+ * Copy
+ * {/if}
+ * </button>
+ * ```
+ *
+ */
+export class UseClipboard {
+ #copiedStatus = $state<'success' | 'failure'>();
+ private delay: number;
+ private timeout: ReturnType<typeof setTimeout> | undefined = undefined;
+
+ constructor({ delay = 500 }: Partial<Options> = {}) {
+ this.delay = delay;
+ }
+
+ /** Copies the given text to the users clipboard.
+ *
+ * ## Usage
+ * ```ts
+ * clipboard.copy('Hello, World!');
+ * ```
+ *
+ * @param text
+ * @returns
+ */
+ async copy(text: string) {
+ if (this.timeout) {
+ this.#copiedStatus = undefined;
+ clearTimeout(this.timeout);
+ }
+
+ try {
+ await navigator.clipboard.writeText(text);
+
+ this.#copiedStatus = 'success';
+
+ this.timeout = setTimeout(() => {
+ this.#copiedStatus = undefined;
+ }, this.delay);
+ } catch {
+ // an error can occur when not in the browser or if the user hasn't given clipboard access
+ this.#copiedStatus = 'failure';
+
+ this.timeout = setTimeout(() => {
+ this.#copiedStatus = undefined;
+ }, this.delay);
+ }
+
+ return this.#copiedStatus;
+ }
+
+ /** true when the user has just copied to the clipboard. */
+ get copied() {
+ return this.#copiedStatus === 'success';
+ }
+
+ /** Indicates whether a copy has occurred
+ * and gives a status of either `success` or `failure`. */
+ get status() {
+ return this.#copiedStatus;
+ }
+}
diff --git a/frontend/src/lib/utils/utils.ts b/frontend/src/lib/utils/utils.ts
new file mode 100644
index 000000000..85bb32379
--- /dev/null
+++ b/frontend/src/lib/utils/utils.ts
@@ -0,0 +1,17 @@
+/*
+ Installed from @ieedan/shadcn-svelte-extras
+*/
+
+import { type ClassValue, clsx } from 'clsx';
+import { twMerge } from 'tailwind-merge';
+
+export function cn(...inputs: ClassValue[]) {
+ return twMerge(clsx(inputs));
+}
+
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export type WithoutChild<T> = T extends { child?: any } ? Omit<T, 'child'> : T;
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+export type WithoutChildren<T> = T extends { children?: any } ? Omit<T, 'children'> : T;
+export type WithoutChildrenOrChild<T> = WithoutChildren<WithoutChild<T>>;
+export type WithElementRef<T, U extends HTMLElement = HTMLElement> = T & { ref?: U | null };
diff --git a/frontend/src/routes/compose/+page.ts b/frontend/src/routes/compose/+page.ts
deleted file mode 100644
index ccf5d80ad..000000000
--- a/frontend/src/routes/compose/+page.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { environmentAPI } from '$lib/services/api';
-
-export const load = async () => {
- // try {
- // // Load managed stacks
- // const response = await environmentAPI.getStacks();
- // // Extract stacks from the API response structure
- // const stacks = response || [];
- // return {
- // stacks,
- // error: null
- // };
- // } catch (error) {
- // console.error('Failed to load compose page:', error);
- // return {
- // stacks: [],
- // error: error instanceof Error ? error.message : 'Failed to load Docker Compose stacks'
- // };
- // }
-};
diff --git a/frontend/src/routes/customize/templates/+page.svelte b/frontend/src/routes/customize/templates/+page.svelte
index a72a1b45d..6b10a6113 100644
--- a/frontend/src/routes/customize/templates/+page.svelte
+++ b/frontend/src/routes/customize/templates/+page.svelte
@@ -5,6 +5,7 @@
import * as Alert from '$lib/components/ui/alert/index.js';
import { Separator } from '$lib/components/ui/separator/index.js';
import { Switch } from '$lib/components/ui/switch/index.js';
+ import { Snippet } from '$lib/components/ui/snippet';
import {
Trash2,
Plus,
@@ -21,14 +22,13 @@
import { toast } from 'svelte-sonner';
import { invalidateAll } from '$app/navigation';
import AddTemplateRegistrySheet from '$lib/components/sheets/add-template-registry-sheet.svelte';
+ import StatCard from '$lib/components/stat-card.svelte';
let { data }: { data: PageData } = $props();
- // Reactive data
let templates = $state(data.templates || []);
let registries = $state(data.registries || []);
- // Loading states
let isLoading = $state({
addingRegistry: false,
removing: new Set<number>(),
@@ -37,11 +37,9 @@
let showAddRegistrySheet = $state(false);
- // Computed values
const localTemplateCount = $derived(templates.filter((t) => !t.isRemote).length);
const remoteTemplateCount = $derived(templates.filter((t) => t.isRemote).length);
- // Update registry
async function updateRegistry(id: number, updates: { enabled?: boolean }) {
if (isLoading.updating.has(id)) return;
isLoading.updating.add(id);
@@ -73,7 +71,6 @@
}
}
- // Remove registry
async function removeRegistry(id: number) {
if (isLoading.removing.has(id)) return;
isLoading.removing.add(id);
@@ -91,7 +88,6 @@
}
}
- // Refresh templates (reload all data)
async function refreshTemplates() {
try {
await invalidateAll();
@@ -169,33 +165,27 @@
<!-- Template Statistics -->
<div class="grid grid-cols-1 gap-4 md:grid-cols-3">
- <Card class="p-4">
- <div class="flex items-center gap-3">
- <FolderOpen class="size-8 text-blue-500" />
- <div>
- <p class="text-2xl font-bold">{localTemplateCount}</p>
- <p class="text-muted-foreground text-sm">Local Templates</p>
- </div>
- </div>
- </Card>
- <Card class="p-4">
- <div class="flex items-center gap-3">
- <Globe class="size-8 text-green-500" />
- <div>
- <p class="text-2xl font-bold">{remoteTemplateCount}</p>
- <p class="text-muted-foreground text-sm">Remote Templates</p>
- </div>
- </div>
- </Card>
- <Card class="p-4">
- <div class="flex items-center gap-3">
- <FileText class="size-8 text-purple-500" />
- <div>
- <p class="text-2xl font-bold">{registries.length}</p>
- <p class="text-muted-foreground text-sm">Registries</p>
- </div>
- </div>
- </Card>
+ <StatCard
+ title="Local Templates"
+ value={localTemplateCount}
+ icon={FolderOpen}
+ iconColor="text-blue-500"
+ class="border-l-4 border-l-blue-500"
+ />
+ <StatCard
+ title="Remote Templates"
+ value={remoteTemplateCount}
+ icon={Globe}
+ iconColor="text-green-500"
+ class="border-l-4 border-l-green-500"
+ />
+ <StatCard
+ title="Registries"
+ value={registries.length}
+ icon={FileText}
+ iconColor="text-purple-500"
+ class="border-l-4 border-l-purple-500"
+ />
</div>
<Separator />
@@ -209,37 +199,27 @@
Add Registry
</Button>
</div>
+ {#if registries.length == 0}
+ <Alert.Root>
+ <Globe class="size-4" />
+ <Alert.Title>Remote Registries</Alert.Title>
+ <Alert.Description
+ >Add remote template registries to access community templates. Registries should provide a
+ JSON manifest with template definitions and download URLs.</Alert.Description
+ >
+ </Alert.Root>
- <Alert.Root>
- <Globe class="size-4" />
- <Alert.Title>Remote Registries</Alert.Title>
- <Alert.Description
- >Add remote template registries to access community templates. Registries should provide a
- JSON manifest with template definitions and download URLs.</Alert.Description
- >
- </Alert.Root>
-
- <Alert.Root class="border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950">
- <Users class="size-4" />
- <Alert.Title>Community Registry</Alert.Title>
- <Alert.Description class="space-y-2">
- <p>Get started quickly with our community registry containing popular templates:</p>
- <div class="mt-2 flex items-center gap-2">
- <code class="rounded bg-white px-2 py-1 text-xs dark:bg-gray-800">
- https://templates.arcane.ofkm.dev/registry.json
- </code>
- <Button
- size="sm"
- variant="outline"
- onclick={() => copyToClipboard('https://templates.arcane.ofkm.dev/registry.json')}
- >
- <Copy class="mr-1 size-3" />
- Copy
- </Button>
- </div>
- </Alert.Description>
- </Alert.Root>
-
+ <Alert.Root class="border-blue-200 bg-blue-50 dark:border-blue-800 dark:bg-blue-950">
+ <Users class="size-4" />
+ <Alert.Title>Community Registry</Alert.Title>
+ <Alert.Description class="space-y-2">
+ <p>Get started quickly with our community registry containing popular templates:</p>
+ <div class="flex w-full max-w-[475px] flex-col gap-2">
+ <Snippet text="https://templates.arcane.ofkm.dev/registry.json" />
+ </div>
+ </Alert.Description>
+ </Alert.Root>
+ {/if}
<!-- Registry List -->
{#if registries.length > 0}
<div class="space-y-3">
diff --git a/frontend/src/routes/networks/+page.ts b/frontend/src/routes/networks/+page.ts
deleted file mode 100644
index 78075ea15..000000000
--- a/frontend/src/routes/networks/+page.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { environmentAPI } from '$lib/services/api';
-import type { PageLoad } from './$types';
-
-export const load: PageLoad = async () => {
- // try {
- // const networks = await environmentAPI.getNetworks();
- // return {
- // networks: networks || []
- // };
- // } catch (error) {
- // console.error('Error loading networks data:', error);
- // return {
- // networks: [],
- // error: error instanceof Error ? error.message : String(error)
- // };
- // }
-};