forge
Explore
Log in

Don't you dare go Hollow

✨ shared schedule status chips and more empty states

Browse files at this commit

33418ffd514077b199536a3ca16ea7cb7cf41d87Burak BoduroğluParent: 1a9c4b9
  • feat
    • ✨ shared schedule status chips and more empty states
Show full message
feat: ✨ shared schedule status chips and more empty states
- schedule-status helper for exam/event active/upcoming/finished tones
- wire exams list, exam card/detail, dashboard attention, event cards
- EmptyState on terms (with create CTA), marks, work log, staff work
- terms create/save/delete flash banners
src/components/events/event-card.tsxmodified+36 -8
@@ -1,7 +1,11 @@
1+import { Show } from "solid-js";
1 import { Link } from "@tanstack/solid-router";2 import { Link } from "@tanstack/solid-router";
2 import type { Event, EventAudience } from "@/api/types";3 import type { Event, EventAudience } from "@/api/types";
3 import type { MessageKey } from "@/i18n/messages";4 import type { MessageKey } from "@/i18n/messages";
5+import { Badge } from "@/components/ui/badge";
6+import { cn } from "@/lib/cn";
4 import { formatDateTime } from "@/lib/format";7 import { formatDateTime } from "@/lib/format";
8+import { scheduleStatusClass, scheduleStatusDotClass, type ScheduleStatus } from "@/lib/schedule-status";
5 import { usePreferences, useT } from "@/stores/preferences-context";9 import { usePreferences, useT } from "@/stores/preferences-context";
6 10
7 function audienceLabel(audience: EventAudience, t: ReturnType<typeof useT>): string {11 function audienceLabel(audience: EventAudience, t: ReturnType<typeof useT>): string {
@@ -11,17 +15,39 @@ function audienceLabel(audience: EventAudience, t: ReturnType<typeof useT>): str
11 return t("events.audience.school");15 return t("events.audience.school");
12 }16 }
13 17
18+function eventStatus(event: Event, now: number): ScheduleStatus {
19+ if (event.starts_at == null) return "unscheduled";
20+ if (event.ends_at != null && event.ends_at < now) return "finished";
21+ if (event.starts_at > now) return "upcoming";
22+ return "active";
23+}
24+
14 export function EventCard(props: { event: Event }) {25 export function EventCard(props: { event: Event }) {
15 const t = useT();26 const t = useT();
16 const { locale } = usePreferences();27 const { locale } = usePreferences();
28+ const status = () => eventStatus(props.event, Date.now());
29+ const statusLabel = () => {
30+ const s = status();
31+ if (s === "unscheduled") return t("exams.unscheduled");
32+ if (s === "finished") return t("events.past");
33+ if (s === "upcoming") return t("events.upcoming");
34+ return t("dashboard.activeNow");
35+ };
36+
17 return (37 return (
18 <Link to="/events/$id" params={{ id: props.event.id }} class="group block h-full">38 <Link to="/events/$id" params={{ id: props.event.id }} class="group block h-full">
19 <article class="data-shell flex h-full min-h-40 flex-col overflow-hidden transition-colors group-hover:border-primary/35">39 <article class="data-shell flex h-full min-h-40 flex-col overflow-hidden transition-colors group-hover:border-primary/35">
20 <div class="flex flex-1 flex-col p-3">40 <div class="flex flex-1 flex-col p-3">
21- <h3 class="line-clamp-2 font-display text-base font-semibold leading-snug group-hover:text-primary">41+ <div class="mb-2 flex items-start justify-between gap-2">
22- {props.event.title}42+ <h3 class="line-clamp-2 min-w-0 flex-1 font-display text-base font-semibold leading-snug group-hover:text-primary">
23- </h3>43+ {props.event.title}
24- <p class="mt-2 line-clamp-3 flex-1 text-[13px] leading-relaxed text-muted-foreground">44+ </h3>
45+ <Badge variant="outline" class={cn("shrink-0 rounded-sm capitalize", scheduleStatusClass(status()))}>
46+ <span class={cn("mr-1.5 inline-block h-1.5 w-1.5 rounded-full", scheduleStatusDotClass(status()))} />
47+ {statusLabel()}
48+ </Badge>
49+ </div>
50+ <p class="line-clamp-3 flex-1 text-[13px] leading-relaxed text-muted-foreground">
25 {props.event.description || "—"}51 {props.event.description || "—"}
26 </p>52 </p>
27 <p class="mt-3 text-xs font-medium text-muted-foreground">{audienceLabel(props.event.audience, t)}</p>53 <p class="mt-3 text-xs font-medium text-muted-foreground">{audienceLabel(props.event.audience, t)}</p>
@@ -32,10 +58,12 @@ export function EventCard(props: { event: Event }) {
32 <dt class="font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.starts")}</dt>58 <dt class="font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.starts")}</dt>
33 <dd class="mono mt-1 text-foreground">{formatDateTime(props.event.starts_at, locale())}</dd>59 <dd class="mono mt-1 text-foreground">{formatDateTime(props.event.starts_at, locale())}</dd>
34 </div>60 </div>
35- <div>61+ <Show when={props.event.ends_at != null}>
36- <dt class="font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.ends")}</dt>62+ <div>
37- <dd class="mono mt-1 text-foreground">{formatDateTime(props.event.ends_at, locale())}</dd>63+ <dt class="font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.ends")}</dt>
38- </div>64+ <dd class="mono mt-1 text-foreground">{formatDateTime(props.event.ends_at, locale())}</dd>
65+ </div>
66+ </Show>
39 </dl>67 </dl>
40 </div>68 </div>
41 </article>69 </article>
src/components/exams/exam-card.tsxmodified+3 -18
@@ -7,6 +7,7 @@ import { cn } from "@/lib/cn";
7 import { examKindLabel } from "@/lib/exam-labels";7 import { examKindLabel } from "@/lib/exam-labels";
8 import { examWeight } from "@/lib/exam-weight";8 import { examWeight } from "@/lib/exam-weight";
9 import { examDurationMs, formatDateTime, formatDurationMinutes } from "@/lib/format";9 import { examDurationMs, formatDateTime, formatDurationMinutes } from "@/lib/format";
10+import { scheduleStatusClass, scheduleStatusDotClass } from "@/lib/schedule-status";
10 import { usePreferences, useT } from "@/stores/preferences-context";11 import { usePreferences, useT } from "@/stores/preferences-context";
11 12
12 export function ExamCard(props: { exam: Exam; courseTitle?: string; now?: number }) {13 export function ExamCard(props: { exam: Exam; courseTitle?: string; now?: number }) {
@@ -37,22 +38,6 @@ export function ExamCard(props: { exam: Exam; courseTitle?: string; now?: number
37 return t("exams.active");38 return t("exams.active");
38 };39 };
39 40
40- const statusClass = () => {
41- const s = status();
42- if (s === "unscheduled") return "bg-muted text-muted-foreground border-muted";
43- if (s === "finished") return "bg-muted text-muted-foreground border-muted";
44- if (s === "upcoming") return "bg-amber-500/15 text-amber-600 border-amber-500/30";
45- return "bg-emerald-500/15 text-emerald-600 border-emerald-500/30";
46- };
47-
48- const statusDot = () => {
49- const s = status();
50- if (s === "unscheduled") return "bg-muted-foreground";
51- if (s === "finished") return "bg-muted-foreground";
52- if (s === "upcoming") return "bg-amber-600";
53- return "bg-emerald-600";
54- };
55-
56 return (41 return (
57 <ExamLink examId={props.exam.id} class="group block h-full">42 <ExamLink examId={props.exam.id} class="group block h-full">
58 <article class="data-shell flex h-full min-h-48 flex-col overflow-hidden transition-colors group-hover:border-primary/35">43 <article class="data-shell flex h-full min-h-48 flex-col overflow-hidden transition-colors group-hover:border-primary/35">
@@ -66,8 +51,8 @@ export function ExamCard(props: { exam: Exam; courseTitle?: string; now?: number
66 {props.exam.title}51 {props.exam.title}
67 </h3>52 </h3>
68 </div>53 </div>
69- <Badge variant="outline" class={cn("shrink-0 rounded-sm capitalize", statusClass())}>54+ <Badge variant="outline" class={cn("shrink-0 rounded-sm capitalize", scheduleStatusClass(status()))}>
70- <span class={cn("mr-1.5 inline-block h-1.5 w-1.5 rounded-full", statusDot())} />55+ <span class={cn("mr-1.5 inline-block h-1.5 w-1.5 rounded-full", scheduleStatusDotClass(status()))} />
71 {statusLabel()}56 {statusLabel()}
72 </Badge>57 </Badge>
73 </div>58 </div>
src/lib/schedule-status.tsadded+25 -0
@@ -0,0 +1,25 @@
1+/** Shared semantic colors for exam/event schedule chips (dashboard, lists, cards). */
2+export type ScheduleStatus =
3+ | "active"
4+ | "upcoming"
5+ | "today"
6+ | "soon"
7+ | "finished"
8+ | "past"
9+ | "unscheduled";
10+
11+export function scheduleStatusClass(status: ScheduleStatus | string): string {
12+ if (status === "active") {
13+ return "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300";
14+ }
15+ if (status === "today" || status === "upcoming" || status === "soon") {
16+ return "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300";
17+ }
18+ return "border-muted bg-muted/50 text-muted-foreground";
19+}
20+
21+export function scheduleStatusDotClass(status: ScheduleStatus | string): string {
22+ if (status === "active") return "bg-emerald-600";
23+ if (status === "today" || status === "upcoming" || status === "soon") return "bg-amber-600";
24+ return "bg-muted-foreground";
25+}
src/pages/dashboard-page.tsxmodified+3 -9
@@ -28,6 +28,7 @@ import { cn } from "@/lib/cn";
28 import { examKindLabel } from "@/lib/exam-labels";28 import { examKindLabel } from "@/lib/exam-labels";
29 import { formatDateTime } from "@/lib/format";29 import { formatDateTime } from "@/lib/format";
30 import { hasMinRole } from "@/lib/roles";30 import { hasMinRole } from "@/lib/roles";
31+import { scheduleStatusClass, scheduleStatusDotClass } from "@/lib/schedule-status";
31 import { useAuth } from "@/stores/auth-context";32 import { useAuth } from "@/stores/auth-context";
32 import { usePreferences, useT } from "@/stores/preferences-context";33 import { usePreferences, useT } from "@/stores/preferences-context";
33 34
@@ -478,12 +479,7 @@ function PortalCard(props: { card: PortalCardDef }) {
478 function StatusDot(props: { status: AttentionKind }) {479 function StatusDot(props: { status: AttentionKind }) {
479 return (480 return (
480 <span481 <span
481- class={cn(482+ class={cn("mt-0.5 h-2 w-2 shrink-0 rounded-full", scheduleStatusDotClass(props.status))}
482- "mt-0.5 h-2 w-2 shrink-0 rounded-full",
483- props.status === "active" && "bg-success",
484- props.status === "today" && "bg-warning",
485- props.status === "soon" && "bg-muted-foreground",
486- )}
487 aria-hidden="true"483 aria-hidden="true"
488 />484 />
489 );485 );
@@ -502,9 +498,7 @@ function StatusLabel(props: {
502 <span498 <span
503 class={cn(499 class={cn(
504 "inline-flex rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",500 "inline-flex rounded-md border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",
505- props.status === "active" && "border-success/30 bg-success/10 text-success",501+ scheduleStatusClass(props.status),
506- props.status === "today" && "border-warning/30 bg-warning/10 text-warning",
507- props.status === "soon" && "border-border bg-muted text-muted-foreground",
508 )}502 )}
509 >503 >
510 {label()}504 {label()}
src/pages/exam-detail-page.tsxmodified+30 -14
@@ -44,6 +44,7 @@ import { examWeight } from "@/lib/exam-weight";
44 import { examDurationMs, formatDateTime, formatDurationMinutes } from "@/lib/format";44 import { examDurationMs, formatDateTime, formatDurationMinutes } from "@/lib/format";
45 import { personId, personLabel, personLabelWithId } from "@/lib/person";45 import { personId, personLabel, personLabelWithId } from "@/lib/person";
46 import { cn } from "@/lib/cn";46 import { cn } from "@/lib/cn";
47+import { scheduleStatusClass, scheduleStatusDotClass } from "@/lib/schedule-status";
47 import { useAuth } from "@/stores/auth-context";48 import { useAuth } from "@/stores/auth-context";
48 import { usePreferences, useT } from "@/stores/preferences-context";49 import { usePreferences, useT } from "@/stores/preferences-context";
49 50
@@ -274,20 +275,35 @@ function ExamDetailContent() {
274 }275 }
275 >276 >
276 <div class="flex flex-wrap items-center gap-2 pt-1">277 <div class="flex flex-wrap items-center gap-2 pt-1">
277- <Badge variant="outline" class={cn(278+ <Badge
278- "rounded-sm capitalize",279+ variant="outline"
279- !isScheduled() && "bg-muted text-muted-foreground border-muted",280+ class={cn(
280- isFinished() && "bg-muted text-muted-foreground border-muted",281+ "rounded-sm capitalize",
281- isScheduled() && !isFinished() && !isUpcoming() && "bg-emerald-500/15 text-emerald-600 border-emerald-500/30",282+ scheduleStatusClass(
282- isUpcoming() && "bg-amber-500/15 text-amber-600 border-amber-500/30",283+ !isScheduled()
283- )}>284+ ? "unscheduled"
284- <span class={cn(285+ : isFinished()
285- "mr-1.5 inline-block h-1.5 w-1.5 rounded-full",286+ ? "finished"
286- !isScheduled() && "bg-muted-foreground",287+ : isUpcoming()
287- isFinished() && "bg-muted-foreground",288+ ? "upcoming"
288- isScheduled() && !isFinished() && !isUpcoming() && "bg-emerald-600",289+ : "active",
289- isUpcoming() && "bg-amber-600",290+ ),
290- )} />291+ )}
292+ >
293+ <span
294+ class={cn(
295+ "mr-1.5 inline-block h-1.5 w-1.5 rounded-full",
296+ scheduleStatusDotClass(
297+ !isScheduled()
298+ ? "unscheduled"
299+ : isFinished()
300+ ? "finished"
301+ : isUpcoming()
302+ ? "upcoming"
303+ : "active",
304+ ),
305+ )}
306+ />
291 {!isScheduled() ? t("exams.unscheduled") : isFinished() ? t("exams.finished") : isUpcoming() ? t("exams.upcoming") : t("exams.active")}307 {!isScheduled() ? t("exams.unscheduled") : isFinished() ? t("exams.finished") : isUpcoming() ? t("exams.upcoming") : t("exams.active")}
292 </Badge>308 </Badge>
293 <Badge variant="outline" class="rounded-sm capitalize">309 <Badge variant="outline" class="rounded-sm capitalize">
src/pages/exams-page.tsxmodified+2 -7
@@ -28,6 +28,7 @@ import { createFlash } from "@/lib/flash";
28 import { formatDateTime } from "@/lib/format";28 import { formatDateTime } from "@/lib/format";
29 import { loadListPage, totalPages as pagesOf } from "@/lib/list-page";29 import { loadListPage, totalPages as pagesOf } from "@/lib/list-page";
30 import { hasMinRole } from "@/lib/roles";30 import { hasMinRole } from "@/lib/roles";
31+import { scheduleStatusClass } from "@/lib/schedule-status";
31 import { cn } from "@/lib/cn";32 import { cn } from "@/lib/cn";
32 import { useAuth } from "@/stores/auth-context";33 import { useAuth } from "@/stores/auth-context";
33 import { usePreferences, useT } from "@/stores/preferences-context";34 import { usePreferences, useT } from "@/stores/preferences-context";
@@ -143,12 +144,6 @@ function ExamsContent() {
143 return t("exams.active");144 return t("exams.active");
144 };145 };
145 146
146- const statusTone = (status: ExamStatus) => {
147- if (status === "active") return "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300";
148- if (status === "upcoming") return "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300";
149- return "border-muted bg-muted/50 text-muted-foreground";
150- };
151-
152 const total = () => list()?.total ?? 0;147 const total = () => list()?.total ?? 0;
153 const pageItems = () => list()?.items ?? [];148 const pageItems = () => list()?.items ?? [];
154 const totalPages = createMemo(() => pagesOf(total(), EXAM_PAGE_SIZE));149 const totalPages = createMemo(() => pagesOf(total(), EXAM_PAGE_SIZE));
@@ -301,7 +296,7 @@ function ExamsContent() {
301 <TableCell class="truncate text-muted-foreground">{courseTitle(exam.course)}</TableCell>296 <TableCell class="truncate text-muted-foreground">{courseTitle(exam.course)}</TableCell>
302 <TableCell class="mono whitespace-nowrap text-muted-foreground">{formatDateTime(exam.starts_at, locale())}</TableCell>297 <TableCell class="mono whitespace-nowrap text-muted-foreground">{formatDateTime(exam.starts_at, locale())}</TableCell>
303 <TableCell class="text-center">298 <TableCell class="text-center">
304- <Badge variant="outline" class={cn("w-28 justify-center rounded-sm", statusTone(status()))}>299+ <Badge variant="outline" class={cn("w-28 justify-center rounded-sm", scheduleStatusClass(status()))}>
305 {statusLabel(status())}300 {statusLabel(status())}
306 </Badge>301 </Badge>
307 </TableCell>302 </TableCell>
src/pages/marks-page.tsxmodified+2 -8
@@ -5,6 +5,7 @@ import { Alert } from "@/components/ui/alert";
5 import { MarksReportView } from "@/components/marks/marks-report-view";5 import { MarksReportView } from "@/components/marks/marks-report-view";
6 import { RouteGuard } from "@/components/layout/route-guard";6 import { RouteGuard } from "@/components/layout/route-guard";
7 import { PageHeader } from "@/components/layout/page-header";7 import { PageHeader } from "@/components/layout/page-header";
8+import { EmptyState } from "@/components/ui/empty-state";
8 import { PageSpinner } from "@/components/ui/page-spinner";9 import { PageSpinner } from "@/components/ui/page-spinner";
9 import { useT } from "@/stores/preferences-context";10 import { useT } from "@/stores/preferences-context";
10 11
@@ -33,14 +34,7 @@ function MarksContent() {
33 <Show when={mine.error}>34 <Show when={mine.error}>
34 <Alert variant="destructive">{formatApiError(mine.error)}</Alert>35 <Alert variant="destructive">{formatApiError(mine.error)}</Alert>
35 </Show>36 </Show>
36- <Show37+ <Show when={mine()} fallback={<EmptyState title={t("marks.empty")} />}>
37- when={mine()}
38- fallback={
39- <div class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground">
40- {t("marks.empty")}
41- </div>
42- }
43- >
44 {(report) => <MarksReportView report={report()} />}38 {(report) => <MarksReportView report={report()} />}
45 </Show>39 </Show>
46 </Suspense>40 </Suspense>
src/pages/staff-work-page.tsxmodified+2 -1
@@ -14,6 +14,7 @@ import { Button } from "@/components/ui/button";
14 import { ConfirmDialog } from "@/components/ui/confirm-dialog";14 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
15 import { DataTableEmpty, DataTableFrame, DataTableSkeleton } from "@/components/ui/data-table";15 import { DataTableEmpty, DataTableFrame, DataTableSkeleton } from "@/components/ui/data-table";
16 import { DataToolbar } from "@/components/ui/data-toolbar";16 import { DataToolbar } from "@/components/ui/data-toolbar";
17+import { EmptyState } from "@/components/ui/empty-state";
17 import { DatePicker } from "@/components/ui/date-picker";18 import { DatePicker } from "@/components/ui/date-picker";
18 import { IconEdit, IconEye, IconTrash } from "@/components/ui/icons";19 import { IconEdit, IconEye, IconTrash } from "@/components/ui/icons";
19 import { Input } from "@/components/ui/input";20 import { Input } from "@/components/ui/input";
@@ -298,7 +299,7 @@ function StaffWorkContent() {
298 <Show when={!entries.loading} fallback={<DataTableSkeleton columns={5} rows={4} />}>299 <Show when={!entries.loading} fallback={<DataTableSkeleton columns={5} rows={4} />}>
299 <Show300 <Show
300 when={entryRows().length > 0}301 when={entryRows().length > 0}
301- fallback={<div class="rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground">{t("work.empty")}</div>}302+ fallback={<EmptyState title={t("work.empty")} />}
302 >303 >
303 <div class="space-y-3">304 <div class="space-y-3">
304 <DataTableFrame>305 <DataTableFrame>
src/pages/terms-page.tsxmodified+24 -2
@@ -10,7 +10,8 @@ import { PageHeader } from "@/components/layout/page-header";
10 import { Alert } from "@/components/ui/alert";10 import { Alert } from "@/components/ui/alert";
11 import { Button } from "@/components/ui/button";11 import { Button } from "@/components/ui/button";
12 import { ConfirmDialog } from "@/components/ui/confirm-dialog";12 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
13-import { DataTableEmpty, DataTableFrame, DataTableSkeleton } from "@/components/ui/data-table";13+import { DataTableFrame, DataTableSkeleton } from "@/components/ui/data-table";
14+import { EmptyState } from "@/components/ui/empty-state";
14 import { DatePicker } from "@/components/ui/date-picker";15 import { DatePicker } from "@/components/ui/date-picker";
15 import { ErrorAlert } from "@/components/ui/error-alert";16 import { ErrorAlert } from "@/components/ui/error-alert";
16 import { IconEdit, IconPlus, IconTrash } from "@/components/ui/icons";17 import { IconEdit, IconPlus, IconTrash } from "@/components/ui/icons";
@@ -20,6 +21,7 @@ import { PaginationControls } from "@/components/ui/pagination-controls";
20 import { SidePanel } from "@/components/ui/side-panel";21 import { SidePanel } from "@/components/ui/side-panel";
21 import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";22 import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
22 import { TableRowActions } from "@/components/ui/table-row-actions";23 import { TableRowActions } from "@/components/ui/table-row-actions";
24+import { createFlash } from "@/lib/flash";
23 import { formatDateTime } from "@/lib/format";25 import { formatDateTime } from "@/lib/format";
24 import { loadListPage, totalPages as pagesOf } from "@/lib/list-page";26 import { loadListPage, totalPages as pagesOf } from "@/lib/list-page";
25 import { usePreferences, useT } from "@/stores/preferences-context";27 import { usePreferences, useT } from "@/stores/preferences-context";
@@ -77,6 +79,7 @@ function TermsContent() {
77 const [editing, setEditing] = createSignal<Term | null>(null);79 const [editing, setEditing] = createSignal<Term | null>(null);
78 const [deleteTarget, setDeleteTarget] = createSignal<Term | null>(null);80 const [deleteTarget, setDeleteTarget] = createSignal<Term | null>(null);
79 const [error, setError] = createSignal("");81 const [error, setError] = createSignal("");
82+ const [flash, setFlash] = createFlash();
80 const [pending, setPending] = createSignal(false);83 const [pending, setPending] = createSignal(false);
81 84
82 const resetForm = () => {85 const resetForm = () => {
@@ -119,8 +122,10 @@ function TermsContent() {
119 const current = editing();122 const current = editing();
120 if (current) {123 if (current) {
121 await patchTermById(current.id, { name: name().trim(), starts_at, ends_at });124 await patchTermById(current.id, { name: name().trim(), starts_at, ends_at });
125+ setFlash(t("common.saved"));
122 } else {126 } else {
123 await postTerm({ name: name().trim(), starts_at, ends_at });127 await postTerm({ name: name().trim(), starts_at, ends_at });
128+ setFlash(t("common.created"));
124 }129 }
125 resetForm();130 resetForm();
126 setPanelOpen(false);131 setPanelOpen(false);
@@ -154,6 +159,9 @@ function TermsContent() {
154 />159 />
155 </div>160 </div>
156 161
162+ <Show when={flash()}>
163+ <Alert variant="success">{flash()}</Alert>
164+ </Show>
157 <Show when={error() && !panelOpen()}>165 <Show when={error() && !panelOpen()}>
158 <Alert variant="destructive">{error()}</Alert>166 <Alert variant="destructive">{error()}</Alert>
159 </Show>167 </Show>
@@ -163,7 +171,20 @@ function TermsContent() {
163 <Show when={list.error}>171 <Show when={list.error}>
164 <ErrorAlert message={formatApiError(list.error)} onRetry={() => void refetch()} />172 <ErrorAlert message={formatApiError(list.error)} onRetry={() => void refetch()} />
165 </Show>173 </Show>
166- <Show when={terms().length > 0} fallback={<DataTableEmpty>{t("terms.empty")}</DataTableEmpty>}>174+ <Show
175+ when={terms().length > 0}
176+ fallback={
177+ <EmptyState
178+ title={t("terms.empty")}
179+ action={
180+ <Button type="button" size="sm" class="rounded-lg" onClick={openCreate}>
181+ <IconPlus class="h-4 w-4" />
182+ {t("terms.create")}
183+ </Button>
184+ }
185+ />
186+ }
187+ >
167 <DataTableFrame>188 <DataTableFrame>
168 <Table class="data-table min-w-[40rem]">189 <Table class="data-table min-w-[40rem]">
169 <TableHeader>190 <TableHeader>
@@ -260,6 +281,7 @@ function TermsContent() {
260 try {281 try {
261 await deleteTermById(term.id);282 await deleteTermById(term.id);
262 await refetch();283 await refetch();
284+ setFlash(t("common.deleted"));
263 } catch (err) {285 } catch (err) {
264 setError(formatApiError(err));286 setError(formatApiError(err));
265 } finally {287 } finally {
src/pages/work-log-page.tsxmodified+2 -1
@@ -9,6 +9,7 @@ import { Alert } from "@/components/ui/alert";
9 import { Badge } from "@/components/ui/badge";9 import { Badge } from "@/components/ui/badge";
10 import { Button } from "@/components/ui/button";10 import { Button } from "@/components/ui/button";
11 import { DataTableFrame } from "@/components/ui/data-table";11 import { DataTableFrame } from "@/components/ui/data-table";
12+import { EmptyState } from "@/components/ui/empty-state";
12 import { ErrorAlert } from "@/components/ui/error-alert";13 import { ErrorAlert } from "@/components/ui/error-alert";
13 import { PageSpinner } from "@/components/ui/page-spinner";14 import { PageSpinner } from "@/components/ui/page-spinner";
14 import { PaginationControls } from "@/components/ui/pagination-controls";15 import { PaginationControls } from "@/components/ui/pagination-controls";
@@ -118,7 +119,7 @@ function WorkLogContent() {
118 </Show>119 </Show>
119 <Show120 <Show
120 when={pageItems().length > 0}121 when={pageItems().length > 0}
121- fallback={<div class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground">{t("work.empty")}</div>}122+ fallback={<EmptyState title={t("work.empty")} description={t("work.ready")} />}
122 >123 >
123 <DataTableFrame>124 <DataTableFrame>
124 <Table class="data-table">125 <Table class="data-table">