Skip to content

Modern Docker Management, Designed for Everyone

fix: dashboard meters not using consistant styling in light/dark mode

Kyle Mendell21a93f528ff5
diff --git a/frontend/src/lib/components/meter-metric.svelte b/frontend/src/lib/components/meter-metric.svelte
index f0a8c49a4..ddacdd403 100644
--- a/frontend/src/lib/components/meter-metric.svelte
+++ b/frontend/src/lib/components/meter-metric.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import Meter from '$lib/components/ui/meter/meter.svelte';
+ import { Progress } from '$lib/components/ui/progress/index.js';
import type { Icon as IconType } from '@lucide/svelte';
import LoaderCircleIcon from '@lucide/svelte/icons/loader-circle';
import { m } from '$lib/paraglide/messages';
@@ -50,22 +50,21 @@
{/if}
</div>
<div class="min-w-0 flex-1">
- <div class="text-sm font-semibold text-gray-900 dark:text-gray-100">{title}</div>
+ <div class="text-foreground text-sm font-semibold">{title}</div>
{#if description}
- <div class="text-xs text-gray-700/80 dark:text-gray-300/80">{description}</div>
+ <div class="text-muted-foreground text-xs">{description}</div>
{/if}
</div>
</div>
</div>
- <!-- Content Section -->
- <div class="bg-white/90 p-4 dark:bg-gray-950/90">
+ <div class="bg-card/90 p-4">
<div class="space-y-3">
<div class="text-center">
{#if loading}
<div class="bg-muted mx-auto h-8 w-16 animate-pulse rounded"></div>
{:else}
- <div class="text-2xl font-bold text-gray-900 dark:text-gray-100">
+ <div class="text-foreground text-2xl font-bold">
{currentValue !== undefined ? formatValue(currentValue) : m.common_na()}
</div>
{/if}
@@ -76,7 +75,7 @@
{#if loading}
<div class="bg-muted h-2 w-full animate-pulse rounded"></div>
{:else}
- <Meter value={percentage} class="h-2 bg-gray-200 dark:bg-gray-800" />
+ <Progress value={percentage} max={100} class="h-2" />
{/if}
</div>
</div>
diff --git a/frontend/src/lib/components/ui/meter/meter.svelte b/frontend/src/lib/components/ui/meter/meter.svelte
deleted file mode 100644
index eded49553..000000000
--- a/frontend/src/lib/components/ui/meter/meter.svelte
+++ /dev/null
@@ -1,72 +0,0 @@
-<script lang="ts">
- import { Meter, useId } from 'bits-ui';
- import { cn } from '$lib/utils';
- import type { ComponentProps } from 'svelte';
-
- let {
- max = 100,
- value = 0,
- min = 0,
- label,
- valueLabel,
- showLabel = true,
- showValueLabel = true,
- variant = 'default',
- size = 'default',
- class: className = '',
- ...restProps
- }: ComponentProps<typeof Meter.Root> & {
- label?: string;
- valueLabel?: string;
- showLabel?: boolean;
- showValueLabel?: boolean;
- variant?: 'default' | 'success' | 'warning' | 'destructive';
- size?: 'sm' | 'default' | 'lg';
- class?: string;
- } = $props();
-
- const labelId = useId();
-
- const variantStyles = {
- default: 'bg-primary',
- success: 'bg-green-500',
- warning: 'bg-amber-500',
- destructive: 'bg-destructive'
- };
-
- const sizeStyles = {
- sm: 'h-1.5',
- default: 'h-2.5',
- lg: 'h-4'
- };
-
- const percentage = $derived(Math.round(((value - min) / (max - min)) * 100));
-</script>
-
-{#if showLabel && (label || valueLabel)}
- <div class="mb-2 flex items-center justify-between text-sm">
- {#if showLabel && label}
- <span id={labelId} class="text-foreground font-medium">{label}</span>
- {/if}
- {#if showValueLabel && valueLabel}
- <span class="text-muted-foreground">{valueLabel}</span>
- {/if}
- </div>
-{/if}
-
-<div class={cn('bg-secondary relative w-full overflow-hidden rounded-full', sizeStyles[size], className)}>
- <Meter.Root
- aria-labelledby={label ? labelId : undefined}
- aria-valuetext={valueLabel}
- {value}
- {min}
- {max}
- class="h-full w-full"
- {...restProps}
- >
- <div
- class={cn('h-full rounded-full transition-all duration-300 ease-in-out', variantStyles[variant])}
- style="width: {percentage}%"
- ></div>
- </Meter.Root>
-</div>
diff --git a/frontend/src/lib/components/ui/resizable/index.ts b/frontend/src/lib/components/ui/resizable/index.ts
deleted file mode 100644
index 39b8b59aa..000000000
--- a/frontend/src/lib/components/ui/resizable/index.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { Pane } from 'paneforge';
-import Handle from './resizable-handle.svelte';
-import PaneGroup from './resizable-pane-group.svelte';
-
-export {
- PaneGroup,
- Pane,
- Handle,
- //
- PaneGroup as ResizablePaneGroup,
- Pane as ResizablePane,
- Handle as ResizableHandle
-};
diff --git a/frontend/src/lib/components/ui/resizable/resizable-handle.svelte b/frontend/src/lib/components/ui/resizable/resizable-handle.svelte
deleted file mode 100644
index 3831438c6..000000000
--- a/frontend/src/lib/components/ui/resizable/resizable-handle.svelte
+++ /dev/null
@@ -1,30 +0,0 @@
-<script lang="ts">
- import GripVerticalIcon from '@lucide/svelte/icons/grip-vertical';
- import * as ResizablePrimitive from 'paneforge';
- import { cn, type WithoutChildrenOrChild } from '$lib/utils.js';
-
- let {
- ref = $bindable(null),
- class: className,
- withHandle = false,
- ...restProps
- }: WithoutChildrenOrChild<ResizablePrimitive.PaneResizerProps> & {
- withHandle?: boolean;
- } = $props();
-</script>
-
-<ResizablePrimitive.PaneResizer
- bind:ref
- data-slot="resizable-handle"
- class={cn(
- 'bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[direction=vertical]:h-px data-[direction=vertical]:w-full data-[direction=vertical]:after:left-0 data-[direction=vertical]:after:h-1 data-[direction=vertical]:after:w-full data-[direction=vertical]:after:translate-x-0 data-[direction=vertical]:after:-translate-y-1/2 [&[data-direction=vertical]>div]:rotate-90',
- className
- )}
- {...restProps}
->
- {#if withHandle}
- <div class="bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border">
- <GripVerticalIcon class="size-2.5" />
- </div>
- {/if}
-</ResizablePrimitive.PaneResizer>
diff --git a/frontend/src/lib/components/ui/resizable/resizable-pane-group.svelte b/frontend/src/lib/components/ui/resizable/resizable-pane-group.svelte
deleted file mode 100644
index c706d3299..000000000
--- a/frontend/src/lib/components/ui/resizable/resizable-pane-group.svelte
+++ /dev/null
@@ -1,20 +0,0 @@
-<script lang="ts">
- import * as ResizablePrimitive from 'paneforge';
- import { cn } from '$lib/utils.js';
-
- let {
- ref = $bindable(null),
- this: paneGroup = $bindable(),
- class: className,
- ...restProps
- }: ResizablePrimitive.PaneGroupProps & {
- this?: ResizablePrimitive.PaneGroup;
- } = $props();
-</script>
-
-<ResizablePrimitive.PaneGroup
- bind:this={paneGroup}
- data-slot="resizable-pane-group"
- class={cn('flex h-full w-full data-[direction=vertical]:flex-col', className)}
- {...restProps}
-/>
diff --git a/frontend/src/routes/containers/[containerId]/+page.svelte b/frontend/src/routes/containers/[containerId]/+page.svelte
index 4612f7060..0f3e67397 100644
--- a/frontend/src/routes/containers/[containerId]/+page.svelte
+++ b/frontend/src/routes/containers/[containerId]/+page.svelte
@@ -21,7 +21,7 @@
import StatusBadge from '$lib/components/badges/status-badge.svelte';
import { onDestroy } from 'svelte';
import LogViewer from '$lib/components/log-viewer.svelte';
- import Meter from '$lib/components/ui/meter/meter.svelte';
+ import { Progress } from '$lib/components/ui/progress/index.js';
import { browser } from '$app/environment';
import Separator from '$lib/components/ui/separator/separator.svelte';
import type { ContainerDetailsDto, NetworkSettingsDto } from '$lib/types/container.type';
@@ -497,23 +497,39 @@
{#if stats && container.state?.running}
<div class="grid grid-cols-1 gap-8 lg:grid-cols-2">
<div class="space-y-6">
- <Meter
- label={m.dashboard_meter_cpu()}
- valueLabel="{cpuUsagePercent.toFixed(2)}%"
- value={cpuUsagePercent}
- max={100}
- variant={cpuUsagePercent > 80 ? 'destructive' : cpuUsagePercent > 60 ? 'warning' : 'default'}
- size="lg"
- />
-
- <Meter
- label={m.dashboard_meter_memory()}
- valueLabel="{memoryUsageFormatted} / {memoryLimitFormatted} ({memoryUsagePercent.toFixed(1)}%)"
- value={memoryUsagePercent}
- max={100}
- variant={memoryUsagePercent > 80 ? 'destructive' : memoryUsagePercent > 60 ? 'warning' : 'default'}
- size="lg"
- />
+ <div class="space-y-2">
+ <div class="flex justify-between">
+ <span class="text-sm font-medium">{m.dashboard_meter_cpu()}</span>
+ <span class="text-muted-foreground text-sm">{cpuUsagePercent.toFixed(2)}%</span>
+ </div>
+ <Progress
+ value={cpuUsagePercent}
+ max={100}
+ class="h-2 {cpuUsagePercent > 80
+ ? '[&>div]:bg-destructive'
+ : cpuUsagePercent > 60
+ ? '[&>div]:bg-warning'
+ : ''}"
+ />
+ </div>
+
+ <div class="space-y-2">
+ <div class="flex justify-between">
+ <span class="text-sm font-medium">{m.dashboard_meter_memory()}</span>
+ <span class="text-muted-foreground text-sm"
+ >{memoryUsageFormatted} / {memoryLimitFormatted} ({memoryUsagePercent.toFixed(1)}%)</span
+ >
+ </div>
+ <Progress
+ value={memoryUsagePercent}
+ max={100}
+ class="h-2 {memoryUsagePercent > 80
+ ? '[&>div]:bg-destructive'
+ : memoryUsagePercent > 60
+ ? '[&>div]:bg-warning'
+ : ''}"
+ />
+ </div>
</div>
<div class="space-y-6">