Skip to content

The only tool you need to know what is happening and how to fix it.

fix: better alert/callouts

narrow-adventure0f739ad3344d
diff --git a/docs/public/dashboards/dashboards-apply.png b/docs/public/dashboards/dashboards-apply.png
index d0c5a79e..e1664486 100644
Binary files a/docs/public/dashboards/dashboards-apply.png and b/docs/public/dashboards/dashboards-apply.png differ
diff --git a/docs/public/dashboards/dashboards-edit-json.png b/docs/public/dashboards/dashboards-edit-json.png
index 01e60a3d..d3c773b6 100644
Binary files a/docs/public/dashboards/dashboards-edit-json.png and b/docs/public/dashboards/dashboards-edit-json.png differ
diff --git a/docs/public/dashboards/dashboards-grafana-import.png b/docs/public/dashboards/dashboards-grafana-import.png
index 5994f269..ed8cba64 100644
Binary files a/docs/public/dashboards/dashboards-grafana-import.png and b/docs/public/dashboards/dashboards-grafana-import.png differ
diff --git a/docs/public/dashboards/dashboards-grafana-warnings.png b/docs/public/dashboards/dashboards-grafana-warnings.png
index cf08f340..ff07d7bc 100644
Binary files a/docs/public/dashboards/dashboards-grafana-warnings.png and b/docs/public/dashboards/dashboards-grafana-warnings.png differ
diff --git a/docs/public/dashboards/dashboards-menu.png b/docs/public/dashboards/dashboards-menu.png
index aba90a38..98943957 100644
Binary files a/docs/public/dashboards/dashboards-menu.png and b/docs/public/dashboards/dashboards-menu.png differ
diff --git a/docs/public/dashboards/dashboards-new-widget.png b/docs/public/dashboards/dashboards-new-widget.png
index 9b189568..1b749824 100644
Binary files a/docs/public/dashboards/dashboards-new-widget.png and b/docs/public/dashboards/dashboards-new-widget.png differ
diff --git a/docs/public/dashboards/dashboards-page.png b/docs/public/dashboards/dashboards-page.png
index e7b0388a..16017a38 100644
Binary files a/docs/public/dashboards/dashboards-page.png and b/docs/public/dashboards/dashboards-page.png differ
diff --git a/docs/public/dashboards/dashboards-palette-templates.png b/docs/public/dashboards/dashboards-palette-templates.png
index 99dfa6c0..53d4f470 100644
Binary files a/docs/public/dashboards/dashboards-palette-templates.png and b/docs/public/dashboards/dashboards-palette-templates.png differ
diff --git a/docs/public/dashboards/dashboards-palette.png b/docs/public/dashboards/dashboards-palette.png
index 122d15f9..6b07509e 100644
Binary files a/docs/public/dashboards/dashboards-palette.png and b/docs/public/dashboards/dashboards-palette.png differ
diff --git a/frontend/src/lib/components/ui/warning-callout/index.ts b/frontend/src/lib/components/ui/warning-callout/index.ts
new file mode 100644
index 00000000..ca81b16e
--- /dev/null
+++ b/frontend/src/lib/components/ui/warning-callout/index.ts
@@ -0,0 +1 @@
+export { default as WarningCallout } from './warning-callout.svelte';
diff --git a/frontend/src/lib/components/ui/warning-callout/warning-callout.svelte b/frontend/src/lib/components/ui/warning-callout/warning-callout.svelte
new file mode 100644
index 00000000..308f6e89
--- /dev/null
+++ b/frontend/src/lib/components/ui/warning-callout/warning-callout.svelte
@@ -0,0 +1,61 @@
+<script lang="ts">
+ import type { Snippet } from 'svelte';
+ import { TriangleAlert, OctagonAlert } from 'lucide-svelte';
+ import { cn } from '$lib/utils.js';
+
+ let {
+ title,
+ variant = 'warning',
+ children,
+ action,
+ class: className
+ }: {
+ title?: string;
+ variant?: 'warning' | 'destructive';
+ children: Snippet;
+ action?: Snippet;
+ class?: string;
+ } = $props();
+
+ const destructive = $derived(variant === 'destructive');
+</script>
+
+<div
+ class={cn(
+ 'overflow-hidden rounded-md border bg-card',
+ destructive ? 'border-destructive' : 'border-[#ffab01]',
+ className
+ )}
+ role="alert"
+>
+ <div class="flex items-stretch">
+ <div
+ class="flex items-center justify-center px-3 text-white {destructive
+ ? 'bg-destructive'
+ : 'bg-[#ffab01]'}"
+ >
+ {#if destructive}
+ <OctagonAlert class="size-4" />
+ {:else}
+ <TriangleAlert class="size-4" />
+ {/if}
+ </div>
+ <div class="flex min-w-0 flex-1 items-center justify-between gap-3 p-3">
+ <div class="min-w-0 flex-1">
+ {#if title}
+ <div
+ class="font-black leading-tight {destructive ? 'text-destructive' : 'text-[#ffab01]'}"
+ >
+ {title}
+ </div>
+ {/if}
+ <div class="mt-0.5 text-sm text-muted-foreground">
+ {@render children()}
+ </div>
+ </div>
+ {#if action}
+ {@render action()}
+ {/if}
+ </div>
+ </div>
+</div>
diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte
index 35b16759..7a4b2a84 100644
--- a/frontend/src/routes/+layout.svelte
+++ b/frontend/src/routes/+layout.svelte
@@ -14,7 +14,8 @@
import FrameworkIcon from '$lib/components/framework-icon.svelte';
import * as Sidebar from '$lib/components/ui/sidebar';
import { Button } from '$lib/components/ui/button';
- import { Sun, Moon, LogOut, Plus, Check, Pencil, TriangleAlert } from '@lucide/svelte';
+ import { Sun, Moon, LogOut, Plus, Check, Pencil } from '@lucide/svelte';
+ import { WarningCallout } from '$lib/components/ui/warning-callout';
import { onMount } from 'svelte';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
import { ChevronDown } from 'lucide-svelte';
@@ -299,15 +300,13 @@
</header>
<main class="min-w-0 flex-1 p-4">
{#if timezoneMismatch}
- <div
- class="mb-4 flex items-start gap-2 rounded-md border border-orange-600/40 bg-orange-500/10 px-3 py-2 text-sm text-orange-700 dark:text-orange-400"
+ <WarningCallout
+ class="mb-4"
+ title="Your browser's timezone differs from the organization's"
>
- <TriangleAlert class="mt-0.5 h-4 w-4 shrink-0" />
- <span>
- Your browser's timezone ({zoneLabel(browserZone)}) differs from the organization's
- ({zoneLabel(orgZone)}). All times are shown in the organization's timezone.
- </span>
- </div>
+ All times are shown in the organization's timezone ({zoneLabel(orgZone)}). Your
+ browser is on {zoneLabel(browserZone)}.
+ </WarningCallout>
{/if}
{#if CrossSiteNotificationBanner && bannerOrganizationId !== null}
<div class="mb-4">
diff --git a/frontend/src/routes/dashboards/+page.svelte b/frontend/src/routes/dashboards/+page.svelte
index 7affc48f..1ea090b8 100644
--- a/frontend/src/routes/dashboards/+page.svelte
+++ b/frontend/src/routes/dashboards/+page.svelte
@@ -38,10 +38,9 @@
Upload,
Share2,
CircleMinus,
- TriangleAlert,
Search
} from 'lucide-svelte';
- import { Alert, AlertDescription, AlertTitle } from '$lib/components/ui/alert';
+ import { WarningCallout } from '$lib/components/ui/warning-callout';
import { ErrorAlert } from '$lib/components/ui/error-alert';
import { ErrorDisplay } from '$lib/components/ui/error-display';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
@@ -1325,16 +1324,12 @@
Choose which projects show "{activeDashboard?.name}" in their dashboard tabs.
</AlertDialog.Description>
</AlertDialog.Header>
- <Alert variant="destructive">
- <TriangleAlert class="h-4 w-4" />
- <AlertTitle>Shared across projects</AlertTitle>
- <AlertDescription>
- This is a single shared dashboard. Checking a project shows it in that project's tabs.
- Nothing is copied or overwritten, but edits made from any project apply to all of them.
- Unchecking a project removes the dashboard from its tabs, including any of its widgets
- starred on that project's homepage.
- </AlertDescription>
- </Alert>
+ <WarningCallout title="Shared across projects">
+ This is a single shared dashboard. Checking a project shows it in that project's tabs.
+ Nothing is copied or overwritten, but edits made from any project apply to all of them.
+ Unchecking a project removes the dashboard from its tabs, including any of its widgets
+ starred on that project's homepage.
+ </WarningCallout>
<ErrorAlert error={applyError} />
<div class="max-h-72 space-y-2 overflow-y-auto">
{#each orgProjects as project (project.id)}
@@ -1416,16 +1411,13 @@
</AlertDialog.Header>
<ErrorAlert error={grafanaError} />
{#if grafanaWarnings.length > 0}
- <div
- class="max-h-48 space-y-1 overflow-y-auto rounded-md border border-yellow-500/40 bg-yellow-500/5 p-3"
- >
- {#each grafanaWarnings as warning}
- <div class="flex items-start gap-2 text-xs text-muted-foreground">
- <TriangleAlert class="mt-0.5 h-3.5 w-3.5 shrink-0 text-yellow-500" />
- <span>{warning}</span>
- </div>
- {/each}
- </div>
+ <WarningCallout title="Imported with warnings">
+ <div class="max-h-48 space-y-1 overflow-y-auto">
+ {#each grafanaWarnings as warning}
+ <div class="text-xs">{warning}</div>
+ {/each}
+ </div>
+ </WarningCallout>
{:else}
<div class="space-y-2">
<textarea
diff --git a/frontend/src/routes/device/+page.svelte b/frontend/src/routes/device/+page.svelte
index 139f4bac..49665a80 100644
--- a/frontend/src/routes/device/+page.svelte
+++ b/frontend/src/routes/device/+page.svelte
@@ -7,6 +7,7 @@
import { Label } from '$lib/components/ui/label';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '$lib/components/ui/card';
import { Alert, AlertDescription, AlertTitle } from '$lib/components/ui/alert';
+ import { WarningCallout } from '$lib/components/ui/warning-callout';
import { ErrorAlert } from '$lib/components/ui/error-alert';
import { CircleAlert, Check, ShieldCheck } from '@lucide/svelte';
import { authState } from '$lib/state/auth.svelte';
@@ -214,21 +215,13 @@
<AlertDescription>The device login was denied. You can close this page.</AlertDescription>
</Alert>
{:else if status === 'notFound'}
- <Alert variant="destructive">
- <CircleAlert class="h-4 w-4" />
- <AlertTitle>Code not found</AlertTitle>
- <AlertDescription>
- We couldn't find that code. Start a new login from your terminal.
- </AlertDescription>
- </Alert>
+ <WarningCallout variant="destructive" title="Code not found">
+ We couldn't find that code. Start a new login from your terminal.
+ </WarningCallout>
{:else if status === 'expired'}
- <Alert variant="destructive">
- <CircleAlert class="h-4 w-4" />
- <AlertTitle>Code expired</AlertTitle>
- <AlertDescription>
- This login request has expired. Start a new login from your terminal.
- </AlertDescription>
- </Alert>
+ <WarningCallout variant="destructive" title="Code expired">
+ This login request has expired. Start a new login from your terminal.
+ </WarningCallout>
{:else if status === 'alreadyHandled'}
<Alert>
<CircleAlert class="h-4 w-4" />
diff --git a/website/public/images/dashboards-apply.png b/website/public/images/dashboards-apply.png
index d0c5a79e..e1664486 100644
Binary files a/website/public/images/dashboards-apply.png and b/website/public/images/dashboards-apply.png differ
diff --git a/website/public/images/dashboards-edit-json.png b/website/public/images/dashboards-edit-json.png
index 01e60a3d..d3c773b6 100644
Binary files a/website/public/images/dashboards-edit-json.png and b/website/public/images/dashboards-edit-json.png differ
diff --git a/website/public/images/dashboards-grafana-warnings.png b/website/public/images/dashboards-grafana-warnings.png
index cf08f340..ff07d7bc 100644
Binary files a/website/public/images/dashboards-grafana-warnings.png and b/website/public/images/dashboards-grafana-warnings.png differ
diff --git a/website/public/images/dashboards-page.png b/website/public/images/dashboards-page.png
index e7b0388a..16017a38 100644
Binary files a/website/public/images/dashboards-page.png and b/website/public/images/dashboards-page.png differ
diff --git a/website/public/images/dashboards-palette-templates.png b/website/public/images/dashboards-palette-templates.png
index 99dfa6c0..53d4f470 100644
Binary files a/website/public/images/dashboards-palette-templates.png and b/website/public/images/dashboards-palette-templates.png differ