Skip to content

Modern Docker Management, Designed for Everyone

2.0 KB
Raw Blame
<script lang="ts">
	import { mode } from 'mode-watcher';
	import type { Snippet } from 'svelte';

	import { m } from '#lib/paraglide/messages.js';
	import userStore from '#lib/stores/user-store.svelte.js';
	import { usesDevelopmentBranding } from '#lib/utils/branding.js';
	import { getApplicationLogo } from '#lib/utils/docker.js';
	import { resolveLogoColor } from '#lib/utils/theme.svelte.js';

	interface Props {
		busy: boolean;
		busyTitle: string;
		busyDescription: string;
		error: string;
		children?: Snippet;
	}

	let { busy, busyTitle, busyDescription, error, children }: Props = $props();

	const logoColor = $derived(resolveLogoColor(mode.current === 'dark'));
	const animationsEnabled = $derived(userStore.current?.preferences?.animationsEnabled ?? true);
	const loaderLogoUrl = $derived(
		getApplicationLogo(false, logoColor, logoColor, {
			animated: animationsEnabled,
			loop: animationsEnabled,
			development: usesDevelopmentBranding()
		})
	);
</script>

<div class="flex min-h-screen items-center justify-center bg-background">
	<div class="w-full max-w-md space-y-8">
		<div class="flex flex-col items-center text-center">
			{#if busy}
				<img class="size-12" src={loaderLogoUrl} alt="" />
				<h2 class="mt-6 text-2xl font-semibold">{busyTitle}</h2>
				<p class="mt-2 text-sm text-muted-foreground">{busyDescription}</p>
			{:else if error}
				<div class="flex flex-col items-center text-destructive">
					<svg class="h-12 w-12" fill="none" viewBox="0 0 24 24" stroke="currentColor">
						<path
							stroke-linecap="round"
							stroke-linejoin="round"
							stroke-width="2"
							d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.341 16.5c-.77.833.192 2.5 1.732 2.5z"
						/>
					</svg>
					<h2 class="mt-6 text-2xl font-semibold">{m.auth_authentication_error_title()}</h2>
					<p class="mt-2 text-sm">{error}</p>
					<p class="mt-4 text-xs text-muted-foreground">{m.auth_redirecting_to_login()}</p>
				</div>
			{:else}
				{@render children?.()}
			{/if}
		</div>
	</div>
</div>