🎨 add subtle dashboard color accents
Browse files at this commit69e9aa535b9ff0d85f88a51782d1eb96c4598a7bParent: 20c2a2a- style
- 🎨 add subtle dashboard color accents
2 changed files +37 -11
src/components/ui/empty-state.tsxmodified+14 -6
| @@ -3,6 +3,14 @@ import { cn } from "@/lib/cn"; | |||
| 3 | 3 | ||
| 4 | export type EmptyStateKind = "default" | "notes" | "exams" | "events" | "courses"; | 4 | export type EmptyStateKind = "default" | "notes" | "exams" | "events" | "courses"; |
| 5 | 5 | ||
| 6 | +const KIND_TONE: Record<EmptyStateKind, string> = { | ||
| 7 | + default: "border-primary/20 bg-primary/10 text-primary", | ||
| 8 | + notes: "border-amber-500/20 bg-amber-500/10 text-amber-700 dark:text-amber-300", | ||
| 9 | + exams: "border-indigo-500/20 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300", | ||
| 10 | + events: "border-emerald-500/20 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300", | ||
| 11 | + courses: "border-sky-500/20 bg-sky-500/10 text-sky-700 dark:text-sky-300", | ||
| 12 | +}; | ||
| 13 | + | ||
| 6 | /** Clean dashed empty panel with animated vector illustrations. */ | 14 | /** Clean dashed empty panel with animated vector illustrations. */ |
| 7 | export function EmptyState(props: { | 15 | export function EmptyState(props: { |
| 8 | title: string; | 16 | title: string; |
| @@ -19,24 +27,24 @@ export function EmptyState(props: { | |||
| 19 | props.class, | 27 | props.class, |
| 20 | )} | 28 | )} |
| 21 | > | 29 | > |
| 22 | - <div class="relative flex h-16 w-16 items-center justify-center rounded-2xl border border-primary/20 bg-primary/10 text-primary shadow-inner"> | 30 | + <div class={cn("relative flex h-16 w-16 items-center justify-center rounded-2xl border shadow-inner", KIND_TONE[kind()])}> |
| 23 | <Show when={kind() === "notes"}> | 31 | <Show when={kind() === "notes"}> |
| 24 | - <svg class="h-8 w-8 text-primary" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"> | 32 | + <svg class="h-8 w-8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"> |
| 25 | <path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1-2.5-2.5Z" /> | 33 | <path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1-2.5-2.5Z" /> |
| 26 | <path d="M6 6h10" /> | 34 | <path d="M6 6h10" /> |
| 27 | <path d="M6 10h8" /> | 35 | <path d="M6 10h8" /> |
| 28 | - <circle cx="18" cy="18" r="2.5" class="fill-primary/20 stroke-primary" /> | 36 | + <circle cx="18" cy="18" r="2.5" class="fill-current opacity-30" /> |
| 29 | </svg> | 37 | </svg> |
| 30 | </Show> | 38 | </Show> |
| 31 | <Show when={kind() === "exams"}> | 39 | <Show when={kind() === "exams"}> |
| 32 | - <svg class="h-8 w-8 text-primary" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"> | 40 | + <svg class="h-8 w-8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"> |
| 33 | <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /> | 41 | <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" /> |
| 34 | <polyline points="14 2 14 8 20 8" /> | 42 | <polyline points="14 2 14 8 20 8" /> |
| 35 | <path d="m9 15 2 2 4-4" /> | 43 | <path d="m9 15 2 2 4-4" /> |
| 36 | </svg> | 44 | </svg> |
| 37 | </Show> | 45 | </Show> |
| 38 | <Show when={kind() === "events"}> | 46 | <Show when={kind() === "events"}> |
| 39 | - <svg class="h-8 w-8 text-primary" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"> | 47 | + <svg class="h-8 w-8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"> |
| 40 | <rect width="18" height="18" x="3" y="4" rx="2" ry="2" /> | 48 | <rect width="18" height="18" x="3" y="4" rx="2" ry="2" /> |
| 41 | <line x1="16" x2="16" y1="2" y2="6" /> | 49 | <line x1="16" x2="16" y1="2" y2="6" /> |
| 42 | <line x1="8" x2="8" y1="2" y2="6" /> | 50 | <line x1="8" x2="8" y1="2" y2="6" /> |
| @@ -45,7 +53,7 @@ export function EmptyState(props: { | |||
| 45 | </svg> | 53 | </svg> |
| 46 | </Show> | 54 | </Show> |
| 47 | <Show when={kind() === "default" || kind() === "courses"}> | 55 | <Show when={kind() === "default" || kind() === "courses"}> |
| 48 | - <svg class="h-8 w-8 text-primary" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"> | 56 | + <svg class="h-8 w-8" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"> |
| 49 | <path d="M22 10v6M2 10l10-5 10 5-10 5z" /> | 57 | <path d="M22 10v6M2 10l10-5 10 5-10 5z" /> |
| 50 | <path d="M6 12v5c3 3 9 3 12 0v-5" /> | 58 | <path d="M6 12v5c3 3 9 3 12 0v-5" /> |
| 51 | </svg> | 59 | </svg> |
src/pages/dashboard-page.tsxmodified+23 -5
| @@ -72,6 +72,24 @@ const ROLE_KEY: Record<Role, MessageKey> = { | |||
| 72 | admin: "role.admin", | 72 | admin: "role.admin", |
| 73 | }; | 73 | }; |
| 74 | 74 | ||
| 75 | +const ROLE_TONE: Record<Role, string> = { | ||
| 76 | + student: "border-sky-500/25 bg-sky-500/10 text-sky-700 dark:text-sky-300", | ||
| 77 | + parent: "border-violet-500/25 bg-violet-500/10 text-violet-700 dark:text-violet-300", | ||
| 78 | + teacher: "border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300", | ||
| 79 | + manager: "border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300", | ||
| 80 | + admin: "border-rose-500/25 bg-rose-500/10 text-rose-700 dark:text-rose-300", | ||
| 81 | +}; | ||
| 82 | + | ||
| 83 | +function portalTone(to: string) { | ||
| 84 | + if (to.includes("exam")) return "border-indigo-500/20 bg-indigo-500/10 text-indigo-700 group-hover:bg-indigo-500/15 dark:text-indigo-300"; | ||
| 85 | + if (to.includes("course") || to.includes("studies") || to.includes("clubs")) return "border-sky-500/20 bg-sky-500/10 text-sky-700 group-hover:bg-sky-500/15 dark:text-sky-300"; | ||
| 86 | + if (to.includes("event") || to.includes("calendar")) return "border-amber-500/20 bg-amber-500/10 text-amber-700 group-hover:bg-amber-500/15 dark:text-amber-300"; | ||
| 87 | + if (to.includes("mark") || to.includes("attendance")) return "border-emerald-500/20 bg-emerald-500/10 text-emerald-700 group-hover:bg-emerald-500/15 dark:text-emerald-300"; | ||
| 88 | + if (to.includes("message") || to.includes("student") || to.includes("users")) return "border-violet-500/20 bg-violet-500/10 text-violet-700 group-hover:bg-violet-500/15 dark:text-violet-300"; | ||
| 89 | + if (to.includes("work") || to.includes("settings")) return "border-slate-500/20 bg-slate-500/10 text-slate-700 group-hover:bg-slate-500/15 dark:text-slate-300"; | ||
| 90 | + return "border-primary/20 bg-primary/10 text-primary group-hover:bg-primary/15"; | ||
| 91 | +} | ||
| 92 | + | ||
| 75 | function examWindow(exam: Exam, now: number): AttentionKind | "upcoming" | "past" | "unscheduled" { | 93 | function examWindow(exam: Exam, now: number): AttentionKind | "upcoming" | "past" | "unscheduled" { |
| 76 | const status = examDisplayStatus(exam, now); | 94 | const status = examDisplayStatus(exam, now); |
| 77 | if (status === "active") return "active"; | 95 | if (status === "active") return "active"; |
| @@ -424,7 +442,7 @@ function DashboardContent() { | |||
| 424 | <p class="text-sm text-muted-foreground">{t("dashboard.observationOnly")}</p> | 442 | <p class="text-sm text-muted-foreground">{t("dashboard.observationOnly")}</p> |
| 425 | </div> | 443 | </div> |
| 426 | <div class="flex flex-wrap items-center gap-2 text-xs text-muted-foreground"> | 444 | <div class="flex flex-wrap items-center gap-2 text-xs text-muted-foreground"> |
| 427 | - <span class="rounded-full border border-border bg-background px-2.5 py-1 font-semibold text-foreground shadow-sm"> | 445 | + <span class={cn("rounded-full border px-2.5 py-1 font-semibold shadow-sm", ROLE_TONE[role()])}> |
| 428 | {t(ROLE_KEY[role()])} | 446 | {t(ROLE_KEY[role()])} |
| 429 | </span> | 447 | </span> |
| 430 | <span class="inline-flex items-center gap-2 rounded-full border border-border/70 bg-background/70 px-2.5 py-1 mono tabular-nums shadow-sm"> | 448 | <span class="inline-flex items-center gap-2 rounded-full border border-border/70 bg-background/70 px-2.5 py-1 mono tabular-nums shadow-sm"> |
| @@ -440,7 +458,7 @@ function DashboardContent() { | |||
| 440 | 458 | ||
| 441 | <Show when={!loading()} fallback={<div class="px-4 py-8"><PageSpinner /></div>}> | 459 | <Show when={!loading()} fallback={<div class="px-4 py-8"><PageSpinner /></div>}> |
| 442 | <div class="space-y-5 bg-muted/20 px-4 py-4 sm:px-5 sm:py-5"> | 460 | <div class="space-y-5 bg-muted/20 px-4 py-4 sm:px-5 sm:py-5"> |
| 443 | - <section class="space-y-2.5" aria-labelledby="dash-sections"> | 461 | + <section class="space-y-2.5 rounded-3xl border border-sky-500/10 bg-sky-500/[0.025] p-3 sm:p-4" aria-labelledby="dash-sections"> |
| 444 | <div class="flex items-center justify-between gap-3"> | 462 | <div class="flex items-center justify-between gap-3"> |
| 445 | <h2 id="dash-sections" class="text-sm font-semibold tracking-tight text-foreground"> | 463 | <h2 id="dash-sections" class="text-sm font-semibold tracking-tight text-foreground"> |
| 446 | {t("dashboard.roleLinks")} | 464 | {t("dashboard.roleLinks")} |
| @@ -495,7 +513,7 @@ function DashboardContent() { | |||
| 495 | 513 | ||
| 496 | <Show when={role() !== "parent"}> | 514 | <Show when={role() !== "parent"}> |
| 497 | <div class="grid items-stretch gap-5"> | 515 | <div class="grid items-stretch gap-5"> |
| 498 | - <section class="flex min-h-[17rem] flex-col space-y-2.5" aria-labelledby="dash-attention"> | 516 | + <section class="flex min-h-[17rem] flex-col space-y-2.5 rounded-3xl border border-amber-500/10 bg-amber-500/[0.025] p-3 sm:p-4" aria-labelledby="dash-attention"> |
| 499 | <div class="flex items-baseline justify-between gap-2"> | 517 | <div class="flex items-baseline justify-between gap-2"> |
| 500 | <h2 id="dash-attention" class="text-sm font-semibold tracking-tight text-foreground"> | 518 | <h2 id="dash-attention" class="text-sm font-semibold tracking-tight text-foreground"> |
| 501 | {t("dashboard.attention")} | 519 | {t("dashboard.attention")} |
| @@ -583,7 +601,7 @@ function PortalCard(props: { | |||
| 583 | 601 | ||
| 584 | const cardInner = () => ( | 602 | const cardInner = () => ( |
| 585 | <> | 603 | <> |
| 586 | - <span class="mt-0.5 flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border border-black/[0.05] bg-muted/30 text-muted-foreground transition-colors group-hover:border-border group-hover:bg-muted/50 group-hover:text-foreground dark:border-white/[0.08]"> | 604 | + <span class={cn("mt-0.5 flex h-11 w-11 shrink-0 items-center justify-center rounded-xl border transition-colors", portalTone(props.card.to))}> |
| 587 | <Icon class="h-5 w-5" /> | 605 | <Icon class="h-5 w-5" /> |
| 588 | </span> | 606 | </span> |
| 589 | <div class="min-w-0 flex-1 space-y-1"> | 607 | <div class="min-w-0 flex-1 space-y-1"> |
| @@ -593,7 +611,7 @@ function PortalCard(props: { | |||
| 593 | <span class="hidden text-muted-foreground/40 sm:inline" aria-hidden="true"> | 611 | <span class="hidden text-muted-foreground/40 sm:inline" aria-hidden="true"> |
| 594 | | | 612 | | |
| 595 | </span> | 613 | </span> |
| 596 | - <span class="mono shrink-0 text-sm font-semibold tabular-nums tracking-tight text-foreground sm:text-base"> | 614 | + <span class="mono shrink-0 rounded-full border border-black/[0.06] bg-background/80 px-2 py-0.5 text-xs font-semibold tabular-nums tracking-tight text-foreground shadow-sm dark:border-white/[0.08] sm:text-sm"> |
| 597 | {props.card.stat} | 615 | {props.card.stat} |
| 598 | </span> | 616 | </span> |
| 599 | </Show> | 617 | </Show> |