Skip to content

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

fix: ui consistency and sidebar

narrow-adventure59c1b4af7410
diff --git a/frontend/src/lib/components/traceway/empty-state.svelte b/frontend/src/lib/components/traceway/empty-state.svelte
new file mode 100644
index 00000000..d957f82e
--- /dev/null
+++ b/frontend/src/lib/components/traceway/empty-state.svelte
@@ -0,0 +1,24 @@
+<script lang="ts">
+ import { Button } from '$lib/components/ui/button';
+ import { Plus } from '@lucide/svelte';
+
+ interface Props {
+ message: string;
+ actionLabel?: string;
+ onAction?: () => void;
+ }
+
+ let { message, actionLabel, onAction }: Props = $props();
+</script>
+
+<div
+ class="flex flex-col items-center justify-center rounded-md bg-muted py-20 text-center text-muted-foreground"
+>
+ <p class={actionLabel && onAction ? 'mb-4' : ''}>{message}</p>
+ {#if actionLabel && onAction}
+ <Button variant="success" onclick={onAction}>
+ <Plus class="mr-1 h-4 w-4" />
+ {actionLabel}
+ </Button>
+ {/if}
+</div>
diff --git a/frontend/src/lib/components/traceway/info-callout.svelte b/frontend/src/lib/components/traceway/info-callout.svelte
new file mode 100644
index 00000000..dcf3fd09
--- /dev/null
+++ b/frontend/src/lib/components/traceway/info-callout.svelte
@@ -0,0 +1,25 @@
+<script lang="ts">
+ import type { Snippet } from 'svelte';
+ import * as Alert from '$lib/components/ui/alert';
+ import { Info } from '@lucide/svelte';
+ import { cn } from '$lib/utils';
+
+ interface Props {
+ class?: string;
+ children: Snippet;
+ }
+
+ let { class: className, children }: Props = $props();
+</script>
+
+<Alert.Root
+ class={cn(
+ 'border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950/50 dark:text-blue-200',
+ className
+ )}
+>
+ <Info class="text-blue-600 dark:text-blue-400" />
+ <Alert.Description class="text-blue-800 dark:text-blue-300">
+ {@render children()}
+ </Alert.Description>
+</Alert.Root>
diff --git a/frontend/src/lib/components/traceway/tabs-row.svelte b/frontend/src/lib/components/traceway/tabs-row.svelte
new file mode 100644
index 00000000..9be1f05a
--- /dev/null
+++ b/frontend/src/lib/components/traceway/tabs-row.svelte
@@ -0,0 +1,66 @@
+<script lang="ts">
+ import * as Tabs from '$lib/components/ui/tabs';
+ import * as Select from '$lib/components/ui/select';
+ import { Button } from '$lib/components/ui/button';
+ import { Plus } from '@lucide/svelte';
+
+ interface Tab {
+ value: string;
+ label: string;
+ }
+
+ interface Props {
+ tabs: Tab[];
+ activeTab: string;
+ onTabChange: (tab: string) => void;
+ actionLabel?: string;
+ onAction?: () => void;
+ }
+
+ let { tabs, activeTab, onTabChange, actionLabel, onAction }: Props = $props();
+
+ const activeLabel = $derived(
+ tabs.find((t) => t.value === activeTab)?.label ?? tabs[0]?.label ?? ''
+ );
+</script>
+
+<!-- Container query: the tab list collapses into a full-row dropdown (and the action
+ button wraps to its own full row) based on the content width, not the viewport,
+ so it accounts for the sidebar. -->
+<div class="@container">
+ <div class="flex flex-wrap items-center justify-between gap-x-2 gap-y-4">
+ <Tabs.Root
+ value={activeTab}
+ onValueChange={(v) => {
+ if (v) onTabChange(v);
+ }}
+ class="hidden @2xl:block"
+ >
+ <Tabs.List>
+ {#each tabs as tab (tab.value)}
+ <Tabs.Trigger value={tab.value}>{tab.label}</Tabs.Trigger>
+ {/each}
+ </Tabs.List>
+ </Tabs.Root>
+ <Select.Root
+ type="single"
+ value={activeTab}
+ onValueChange={(v) => {
+ if (v) onTabChange(v);
+ }}
+ >
+ <Select.Trigger class="w-full @2xl:hidden">{activeLabel}</Select.Trigger>
+ <Select.Content>
+ {#each tabs as tab (tab.value)}
+ <Select.Item value={tab.value}>{tab.label}</Select.Item>
+ {/each}
+ </Select.Content>
+ </Select.Root>
+ {#if actionLabel && onAction}
+ <Button size="sm" variant="success" class="w-full @2xl:w-auto" onclick={onAction}>
+ <Plus class="mr-1 h-4 w-4" />
+ {actionLabel}
+ </Button>
+ {/if}
+ </div>
+</div>
diff --git a/frontend/src/lib/components/ui/sheet/sheet-content.svelte b/frontend/src/lib/components/ui/sheet/sheet-content.svelte
index 065fe044..d99909ac 100644
--- a/frontend/src/lib/components/ui/sheet/sheet-content.svelte
+++ b/frontend/src/lib/components/ui/sheet/sheet-content.svelte
@@ -6,8 +6,8 @@
side: {
top: "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
bottom: "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
- left: "data-[state=closed]:slide-out-to-start data-[state=open]:slide-in-from-start inset-y-0 start-0 h-full w-3/4 border-e sm:max-w-sm",
- right: "data-[state=closed]:slide-out-to-end data-[state=open]:slide-in-from-end inset-y-0 end-0 h-full w-3/4 border-s sm:max-w-sm",
+ left: "data-[state=closed]:slide-out-to-start data-[state=open]:slide-in-from-start inset-y-0 start-0 h-dvh w-3/4 border-e sm:max-w-sm",
+ right: "data-[state=closed]:slide-out-to-end data-[state=open]:slide-in-from-end inset-y-0 end-0 h-dvh w-3/4 border-s sm:max-w-sm",
},
},
defaultVariants: {
@@ -51,7 +51,7 @@
>
{@render children?.()}
<SheetPrimitive.Close
- class="ring-offset-background focus-visible:ring-ring absolute end-4 top-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none"
+ class="ring-offset-background focus-visible:ring-ring hover:bg-muted absolute end-2 top-2 rounded-md p-2 opacity-70 transition-opacity hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none"
>
<XIcon class="size-4" />
<span class="sr-only">Close</span>
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-content.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-content.svelte
index f1218002..862dc6e8 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-content.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-content.svelte
@@ -15,7 +15,7 @@
data-slot="sidebar-content"
data-sidebar="content"
class={cn(
- "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
+ "flex min-h-0 flex-1 flex-col gap-2 overflow-x-hidden overflow-y-auto",
className
)}
{...restProps}
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte b/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
index 5b0d0aa2..b467587d 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar-provider.svelte
@@ -42,7 +42,7 @@
data-slot="sidebar-wrapper"
style="--sidebar-width: {SIDEBAR_WIDTH}; --sidebar-width-icon: {SIDEBAR_WIDTH_ICON}; {style}"
class={cn(
- "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
+ "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-dvh w-full",
className
)}
bind:this={ref}
diff --git a/frontend/src/lib/components/ui/sidebar/sidebar.svelte b/frontend/src/lib/components/ui/sidebar/sidebar.svelte
index f9e77e98..cb1c73d5 100644
--- a/frontend/src/lib/components/ui/sidebar/sidebar.svelte
+++ b/frontend/src/lib/components/ui/sidebar/sidebar.svelte
@@ -77,7 +77,7 @@
<div
data-slot="sidebar-container"
class={cn(
- 'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
+ 'fixed inset-y-0 z-10 hidden h-dvh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
side === 'left'
? 'start-0 group-data-[collapsible=offcanvas]:start-[calc(var(--sidebar-width)*-1)]'
: 'end-0 group-data-[collapsible=offcanvas]:end-[calc(var(--sidebar-width)*-1)]',
diff --git a/frontend/src/routes/layout.css b/frontend/src/routes/layout.css
index 39f62d17..0c0508ba 100644
--- a/frontend/src/routes/layout.css
+++ b/frontend/src/routes/layout.css
@@ -326,3 +326,28 @@
[data-sonner-toaster] [data-sonner-toast][data-type='warning'] [data-description] {
color: oklch(0.279 0.077 45.635 / 85%);
}
+
+/* Sidebar scrollbar: thin macOS-style overlay thumb instead of the platform default.
+ Chrome 121+ and Firefox use scrollbar-width/scrollbar-color (which disable the
+ -webkit-scrollbar rules); Safari and older Chromium use the -webkit rules. */
+[data-sidebar='content'] {
+ scrollbar-width: thin;
+ scrollbar-color: color-mix(in oklab, var(--sidebar-foreground) 25%, transparent) transparent;
+}
+
+[data-sidebar='content']::-webkit-scrollbar {
+ width: 6px;
+}
+
+[data-sidebar='content']::-webkit-scrollbar-track {
+ background: transparent;
+}
+
+[data-sidebar='content']::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: color-mix(in oklab, var(--sidebar-foreground) 25%, transparent);
+}
+
+[data-sidebar='content']::-webkit-scrollbar-thumb:hover {
+ background-color: color-mix(in oklab, var(--sidebar-foreground) 40%, transparent);
+}
diff --git a/frontend/src/routes/notifications/+page.svelte b/frontend/src/routes/notifications/+page.svelte
index 997c0d73..861e4ab7 100644
--- a/frontend/src/routes/notifications/+page.svelte
+++ b/frontend/src/routes/notifications/+page.svelte
@@ -12,10 +12,11 @@
import { PaginationFooter } from '$lib/components/ui/pagination-footer';
import { toast } from 'svelte-sonner';
import * as Table from '$lib/components/ui/table';
- import * as Tabs from '$lib/components/ui/tabs';
- import * as Alert from '$lib/components/ui/alert';
import * as AlertDialog from '$lib/components/ui/alert-dialog';
- import { Plus, Pencil, Trash2, Zap, ZapOff, Clock, Send, Info } from '@lucide/svelte';
+ import TabsRow from '$lib/components/traceway/tabs-row.svelte';
+ import InfoCallout from '$lib/components/traceway/info-callout.svelte';
+ import EmptyState from '$lib/components/traceway/empty-state.svelte';
+ import { Pencil, Trash2, Zap, ZapOff, Clock, Send } from '@lucide/svelte';
import { SearchBar } from '$lib/components/ui/search-bar';
import { TableEmptyState } from '$lib/components/ui/table-empty-state';
import { TimeRangePicker } from '$lib/components/ui/time-range-picker';
@@ -94,6 +95,12 @@
'A log of all notifications that have been sent, including their status and the rule that triggered them.'
};
+ const TABS = [
+ { value: 'channels', label: 'Channels' },
+ { value: 'rules', label: 'Rules' },
+ { value: 'history', label: 'History' }
+ ];
+
const activeTab = $derived(page.url.searchParams.get('tab') || 'channels');
function setTab(tab: string) {
@@ -384,6 +391,12 @@
ruleDialogOpen = true;
}
+ const newAction = $derived.by(() => {
+ if (activeTab === 'channels') return { label: 'New Channel', onclick: openNewChannel };
+ if (activeTab === 'rules') return { label: 'New Rule', onclick: openNewRule };
+ return null;
+ });
+
function formatDate(dateStr: string) {
const date = new Date(dateStr);
const now = new Date();
@@ -459,43 +472,25 @@
<h1 class="text-3xl font-semibold tracking-tight">Alerts</h1>
</div>
- <div class="flex items-center justify-between">
- <Tabs.Root value={activeTab} onValueChange={(v) => { if (v) setTab(v); }}>
- <Tabs.List>
- <Tabs.Trigger value="channels">Channels</Tabs.Trigger>
- <Tabs.Trigger value="rules">Rules</Tabs.Trigger>
- <Tabs.Trigger value="history">History</Tabs.Trigger>
- </Tabs.List>
- </Tabs.Root>
- {#if activeTab === 'channels'}
- <Button size="sm" variant="success" onclick={openNewChannel}>
- <Plus class="mr-1 h-4 w-4" /> New Channel
- </Button>
- {:else if activeTab === 'rules'}
- <Button size="sm" variant="success" onclick={openNewRule}>
- <Plus class="mr-1 h-4 w-4" /> New Rule
- </Button>
- {/if}
- </div>
+ <TabsRow
+ tabs={TABS}
+ {activeTab}
+ onTabChange={setTab}
+ actionLabel={newAction?.label}
+ onAction={newAction?.onclick}
+ />
- <Alert.Root class="bg-blue-50 border-blue-200 text-blue-900 dark:bg-blue-950/50 dark:border-blue-800 dark:text-blue-200">
- <Info class="text-blue-600 dark:text-blue-400" />
- <Alert.Description class="text-blue-800 dark:text-blue-300">{tabDescriptions[activeTab]}</Alert.Description>
- </Alert.Root>
+ <InfoCallout>{tabDescriptions[activeTab]}</InfoCallout>
{#if activeTab === 'channels'}
{#if channelsLoading}
<div class="flex justify-center py-12"><LoadingCircle size="xlg" /></div>
{:else if channels.length === 0}
- <div
- class="flex flex-col items-center justify-center rounded-md bg-muted py-20 text-center text-muted-foreground"
- >
- <p class="mb-4">No channels yet. Create one to get started.</p>
- <Button variant="success" onclick={openNewChannel}>
- <Plus class="mr-1 h-4 w-4" />
- Create your first Channel
- </Button>
- </div>
+ <EmptyState
+ message="No channels yet. Create one to get started."
+ actionLabel="Create your first Channel"
+ onAction={openNewChannel}
+ />
{:else}
<div class="overflow-hidden rounded-md border">
<Table.Root>
@@ -566,15 +561,11 @@
{#if rulesLoading}
<div class="flex justify-center py-12"><LoadingCircle size="xlg" /></div>
{:else if rules.length === 0}
- <div
- class="flex flex-col items-center justify-center rounded-md bg-muted py-20 text-center text-muted-foreground"
- >
- <p class="mb-4">No rules yet. Create one to get started.</p>
- <Button variant="success" onclick={openNewRule}>
- <Plus class="mr-1 h-4 w-4" />
- Create your first Rule
- </Button>
- </div>
+ <EmptyState
+ message="No rules yet. Create one to get started."
+ actionLabel="Create your first Rule"
+ onAction={openNewRule}
+ />
{:else}
<div class="overflow-hidden rounded-md border">
<Table.Root>
diff --git a/frontend/src/routes/on-call/+page.svelte b/frontend/src/routes/on-call/+page.svelte
index adf68029..3351d3f9 100644
--- a/frontend/src/routes/on-call/+page.svelte
+++ b/frontend/src/routes/on-call/+page.svelte
@@ -6,13 +6,41 @@
import { projectsState } from '$lib/state/projects.svelte';
import { oncallState } from '$lib/state/oncall.svelte';
import * as Select from '$lib/components/ui/select';
- import * as Tabs from '$lib/components/ui/tabs';
+ import TabsRow from '$lib/components/traceway/tabs-row.svelte';
+ import InfoCallout from '$lib/components/traceway/info-callout.svelte';
import OverviewTab from './overview-tab.svelte';
import TeamsTab from './teams-tab.svelte';
import SchedulesTab from './schedules-tab.svelte';
import PagesTab from './pages-tab.svelte';
import PoliciesTab from './policies-tab.svelte';
+ const TABS = [
+ { value: 'pages', label: 'Pages' },
+ { value: 'overview', label: 'Overview' },
+ { value: 'teams', label: 'Teams' },
+ { value: 'schedules', label: 'Schedules' },
+ { value: 'policies', label: 'Policies' }
+ ];
+
+ const TAB_DESCRIPTIONS: Record<string, string> = {
+ pages:
+ 'Pages are incidents opened when a rule fires through an escalation policy. Acknowledge a page to stop further escalation, and resolve it once the issue is fixed.',
+ overview:
+ 'A live view of who is on call right now for each team and schedule in the organization, and who takes over next.',
+ teams:
+ 'Teams group organization members and own projects. When a page is opened for a project, it is routed to the team that owns it. Schedules belong to teams.',
+ schedules:
+ 'Schedules define who is on call at any moment using rotation layers and one-off overrides. Exactly one person is on call per schedule at a time.',
+ policies:
+ 'Escalation policies define who gets paged and in what order. If a page is not acknowledged in time, it escalates to the next step. Attach a policy to an alert rule through an Escalation channel.'
+ };
+
+ const NEW_BUTTON_LABELS: Record<string, string> = {
+ teams: 'New Team',
+ schedules: 'New Schedule',
+ policies: 'New Policy'
+ };
+
const orgs = $derived(authState.organizations);
let selectedOrgId = $state<number | null>(null);
@@ -49,6 +77,18 @@
const activeTab = $derived(page.url.searchParams.get('tab') || 'pages');
+ const newButtonLabel = $derived(canManage ? NEW_BUTTON_LABELS[activeTab] : undefined);
+
+ let teamsTab = $state<TeamsTab>();
+ let schedulesTab = $state<SchedulesTab>();
+ let policiesTab = $state<PoliciesTab>();
+
+ function openNewForTab() {
+ if (activeTab === 'teams') teamsTab?.openNew();
+ else if (activeTab === 'schedules') schedulesTab?.openNew();
+ else if (activeTab === 'policies') policiesTab?.openNew();
+ }
+
function setTab(tab: string) {
const url = new URL(window.location.href);
url.searchParams.set('tab', tab);
@@ -74,7 +114,7 @@
</script>
<div class="space-y-4">
- <div class="flex items-center justify-between gap-4">
+ <div class="flex flex-wrap items-center justify-between gap-4">
<h1 class="text-3xl font-semibold tracking-tight">On-Call</h1>
{#if orgs.length > 1}
<div class="flex items-center gap-2">
@@ -99,20 +139,17 @@
{/if}
</div>
- <Tabs.Root
- value={activeTab}
- onValueChange={(v) => {
- if (v) setTab(v);
- }}
- >
- <Tabs.List>
- <Tabs.Trigger value="pages">Pages</Tabs.Trigger>
- <Tabs.Trigger value="overview">Overview</Tabs.Trigger>
- <Tabs.Trigger value="teams">Teams</Tabs.Trigger>
- <Tabs.Trigger value="schedules">Schedules</Tabs.Trigger>
- <Tabs.Trigger value="policies">Policies</Tabs.Trigger>
- </Tabs.List>
- </Tabs.Root>
+ <TabsRow
+ tabs={TABS}
+ {activeTab}
+ onTabChange={setTab}
+ actionLabel={newButtonLabel}
+ onAction={openNewForTab}
+ />
+
+ {#if TAB_DESCRIPTIONS[activeTab]}
+ <InfoCallout>{TAB_DESCRIPTIONS[activeTab]}</InfoCallout>
+ {/if}
{#if currentOrganizationId === null}
<div
@@ -125,10 +162,10 @@
{:else if activeTab === 'overview'}
<OverviewTab organizationId={currentOrganizationId} onGoToTeams={() => setTab('teams')} />
{:else if activeTab === 'teams'}
- <TeamsTab organizationId={currentOrganizationId} {canManage} />
+ <TeamsTab bind:this={teamsTab} organizationId={currentOrganizationId} {canManage} />
{:else if activeTab === 'schedules'}
- <SchedulesTab organizationId={currentOrganizationId} {canManage} />
+ <SchedulesTab bind:this={schedulesTab} organizationId={currentOrganizationId} {canManage} />
{:else if activeTab === 'policies'}
- <PoliciesTab organizationId={currentOrganizationId} {canManage} />
+ <PoliciesTab bind:this={policiesTab} organizationId={currentOrganizationId} {canManage} />
{/if}
</div>
diff --git a/frontend/src/routes/on-call/policies-tab.svelte b/frontend/src/routes/on-call/policies-tab.svelte
index 045f4389..687750e8 100644
--- a/frontend/src/routes/on-call/policies-tab.svelte
+++ b/frontend/src/routes/on-call/policies-tab.svelte
@@ -10,7 +10,8 @@
} from '$lib/components/ui/card';
import { ErrorAlert } from '$lib/components/ui/error-alert';
import { LoadingCircle } from '$lib/components/ui/loading-circle';
- import { Plus, Pencil, Trash2 } from '@lucide/svelte';
+ import EmptyState from '$lib/components/traceway/empty-state.svelte';
+ import { Pencil, Trash2 } from '@lucide/svelte';
import { toast } from 'svelte-sonner';
import { api } from '$lib/api';
import { projectsState } from '$lib/state/projects.svelte';
@@ -105,7 +106,7 @@
});
});
- function openNew() {
+ export function openNew() {
editingPolicy = null;
policyDialogOpen = true;
}
@@ -132,14 +133,6 @@
</script>
<div class="space-y-4">
- {#if canManage}
- <div class="flex justify-end">
- <Button size="sm" variant="success" onclick={openNew}>
- <Plus class="mr-1 h-4 w-4" /> New Policy
- </Button>
- </div>
- {/if}
-
{#if oncallState.policiesLoading}
<div class="flex justify-center py-12"><LoadingCircle size="xlg" /></div>
{:else if oncallState.policiesError}
@@ -152,17 +145,11 @@
</Button>
</div>
{:else if oncallState.policies.length === 0}
- <div
- class="flex flex-col items-center justify-center rounded-md bg-muted py-20 text-center text-muted-foreground"
- >
- <p class="mb-4">No escalation policies yet. Define who gets paged, and in what order.</p>
- {#if canManage}
- <Button variant="success" onclick={openNew}>
- <Plus class="mr-1 h-4 w-4" />
- Create your first Policy
- </Button>
- {/if}
- </div>
+ <EmptyState
+ message="No escalation policies yet. Define who gets paged, and in what order."
+ actionLabel={canManage ? 'Create your first Policy' : undefined}
+ onAction={openNew}
+ />
{:else}
<div class="space-y-3">
{#each oncallState.policies as policy (policy.id)}
diff --git a/frontend/src/routes/on-call/schedules-tab.svelte b/frontend/src/routes/on-call/schedules-tab.svelte
index 8f528cf6..4522b6e3 100644
--- a/frontend/src/routes/on-call/schedules-tab.svelte
+++ b/frontend/src/routes/on-call/schedules-tab.svelte
@@ -3,7 +3,7 @@
import { Badge } from '$lib/components/ui/badge';
import * as Table from '$lib/components/ui/table';
import { LoadingCircle } from '$lib/components/ui/loading-circle';
- import { Plus } from '@lucide/svelte';
+ import EmptyState from '$lib/components/traceway/empty-state.svelte';
import { oncallState, type Schedule } from '$lib/state/oncall.svelte';
import ScheduleDialog from './schedule-dialog.svelte';
import ScheduleDetail from './schedule-detail.svelte';
@@ -34,17 +34,13 @@
function selectSchedule(schedule: Schedule) {
selectedScheduleId = selectedScheduleId === schedule.id ? null : schedule.id;
}
+
+ export function openNew() {
+ scheduleDialogOpen = true;
+ }
</script>
<div class="space-y-4">
- {#if canManage}
- <div class="flex justify-end">
- <Button size="sm" variant="success" onclick={() => (scheduleDialogOpen = true)}>
- <Plus class="mr-1 h-4 w-4" /> New Schedule
- </Button>
- </div>
- {/if}
-
{#if oncallState.schedulesLoading}
<div class="flex justify-center py-12"><LoadingCircle size="xlg" /></div>
{:else if oncallState.schedulesError}
@@ -57,17 +53,11 @@
</Button>
</div>
{:else if schedules.length === 0}
- <div
- class="flex flex-col items-center justify-center rounded-md bg-muted py-20 text-center text-muted-foreground"
- >
- <p class="mb-4">No schedules yet. Create one to get started.</p>
- {#if canManage}
- <Button variant="success" onclick={() => (scheduleDialogOpen = true)}>
- <Plus class="mr-1 h-4 w-4" />
- Create your first Schedule
- </Button>
- {/if}
- </div>
+ <EmptyState
+ message="No schedules yet. Create one to get started."
+ actionLabel={canManage ? 'Create your first Schedule' : undefined}
+ onAction={openNew}
+ />
{:else}
<div class="overflow-hidden rounded-md border">
<Table.Root>
diff --git a/frontend/src/routes/on-call/teams-tab.svelte b/frontend/src/routes/on-call/teams-tab.svelte
index af68ae11..a1cffafe 100644
--- a/frontend/src/routes/on-call/teams-tab.svelte
+++ b/frontend/src/routes/on-call/teams-tab.svelte
@@ -5,7 +5,8 @@
import * as AlertDialog from '$lib/components/ui/alert-dialog';
import * as Avatar from '$lib/components/ui/avatar';
import { LoadingCircle } from '$lib/components/ui/loading-circle';
- import { Plus, Pencil, Trash2 } from '@lucide/svelte';
+ import EmptyState from '$lib/components/traceway/empty-state.svelte';
+ import { Pencil, Trash2 } from '@lucide/svelte';
import { toast } from 'svelte-sonner';
import { oncallState, type Team } from '$lib/state/oncall.svelte';
import TeamDialog from './team-dialog.svelte';
@@ -33,7 +34,7 @@
.join('');
}
- function openNewTeam() {
+ export function openNew() {
editingTeam = null;
teamDialogOpen = true;
}
@@ -60,14 +61,6 @@
</script>
<div class="space-y-4">
- {#if canManage}
- <div class="flex justify-end">
- <Button size="sm" variant="success" onclick={openNewTeam}>
- <Plus class="mr-1 h-4 w-4" /> New Team
- </Button>
- </div>
- {/if}
-
{#if oncallState.teamsLoading}
<div class="flex justify-center py-12"><LoadingCircle size="xlg" /></div>
{:else if oncallState.teamsError}
@@ -80,17 +73,11 @@
</Button>
</div>
{:else if teams.length === 0}
- <div
- class="flex flex-col items-center justify-center rounded-md bg-muted py-20 text-center text-muted-foreground"
- >
- <p class="mb-4">No teams yet. Create a team to get started.</p>
- {#if canManage}
- <Button variant="success" onclick={openNewTeam}>
- <Plus class="mr-1 h-4 w-4" />
- Create your first Team
- </Button>
- {/if}
- </div>
+ <EmptyState
+ message="No teams yet. Create a team to get started."
+ actionLabel={canManage ? 'Create your first Team' : undefined}
+ onAction={openNew}
+ />
{:else}
<div class="overflow-hidden rounded-md border">
<Table.Root>
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index f48fee4e..95cd27c2 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -71,7 +71,7 @@ export default defineConfig(({ mode }) => {
server: {
proxy: {
'/api': {
- target: 'http://localhost:8082',
+ target: env.TRACEWAY_API_PROXY || 'http://localhost:8082',
changeOrigin: true
// rewrite: (path) => path.replace(/^\/api/, '')
}