forge
Explore
Log in

Don't you dare go Hollow

✨ tighten dashboard layout and action CTAs

Browse files at this commit

63114ebed0fe2d29fe8eed799648534a71ca9628Burak BoduroğluParent: 4deb240
  • feat
    • ✨ tighten dashboard layout and action CTAs
Show full message
feat: ✨ tighten dashboard layout and action CTAs

- Compact greeting strip with guide button kept
- Four verb-style quick actions above KPIs (role-aware)
- KPI average instead of role; notes/events/exams summaries next
- Drop the redundant “how this home works” help block
src/components/layout/page-header.tsxmodified+26 -5
@@ -20,6 +20,8 @@ export function PageHeader(
20 accent?: PageAccent;20 accent?: PageAccent;
21 actions?: JSX.Element;21 actions?: JSX.Element;
22 class?: string;22 class?: string;
23+ /** Compact greeting strip (dashboard). */
24+ compact?: boolean;
23 }>,25 }>,
24 ) {26 ) {
25 return (27 return (
@@ -35,16 +37,35 @@ export function PageHeader(
35 ACCENT[props.accent ?? "mint"],37 ACCENT[props.accent ?? "mint"],
36 )}38 )}
37 />39 />
38- <div class="relative flex flex-col gap-4 p-6 sm:flex-row sm:items-end sm:justify-between sm:p-8">40+ <div
39- <div class="max-w-2xl space-y-1.5">41+ class={cn(
40- <Show when={props.eyebrow}>42+ "relative flex flex-col sm:flex-row sm:items-center sm:justify-between",
43+ props.compact
44+ ? "gap-3 px-4 py-3 sm:px-5 sm:py-3.5"
45+ : "gap-4 p-6 sm:items-end sm:p-8",
46+ )}
47+ >
48+ <div class={cn("min-w-0", props.compact ? "space-y-0.5" : "max-w-2xl space-y-1.5")}>
49+ <Show when={props.eyebrow && !props.compact}>
41 <p class="text-xs font-medium text-muted-foreground">{props.eyebrow}</p>50 <p class="text-xs font-medium text-muted-foreground">{props.eyebrow}</p>
42 </Show>51 </Show>
43- <h1 class="font-display text-2xl font-semibold tracking-tight sm:text-3xl">52+ <h1
53+ class={cn(
54+ "font-display font-semibold tracking-tight",
55+ props.compact ? "text-lg sm:text-xl" : "text-2xl sm:text-3xl",
56+ )}
57+ >
44 {props.title}58 {props.title}
45 </h1>59 </h1>
46 <Show when={props.description}>60 <Show when={props.description}>
47- <p class="text-sm text-muted-foreground sm:text-base">{props.description}</p>61+ <p
62+ class={cn(
63+ "text-muted-foreground",
64+ props.compact ? "text-xs sm:text-sm" : "text-sm sm:text-base",
65+ )}
66+ >
67+ {props.description}
68+ </p>
48 </Show>69 </Show>
49 {props.children}70 {props.children}
50 </div>71 </div>
src/i18n/messages.tsmodified+36 -0
@@ -81,6 +81,18 @@ export type MessageKey =
81 | "dashboard.subtitle"81 | "dashboard.subtitle"
82 | "dashboard.overview"82 | "dashboard.overview"
83 | "dashboard.quickActions"83 | "dashboard.quickActions"
84+ | "dashboard.action.note"
85+ | "dashboard.action.noteHint"
86+ | "dashboard.action.event"
87+ | "dashboard.action.eventHint"
88+ | "dashboard.action.course"
89+ | "dashboard.action.courseHint"
90+ | "dashboard.action.exam"
91+ | "dashboard.action.examHint"
92+ | "dashboard.action.attend"
93+ | "dashboard.action.attendHint"
94+ | "dashboard.action.marks"
95+ | "dashboard.action.marksHint"
84 | "dashboard.stats.notes"96 | "dashboard.stats.notes"
85 | "dashboard.stats.events"97 | "dashboard.stats.events"
86 | "dashboard.stats.exams"98 | "dashboard.stats.exams"
@@ -301,6 +313,18 @@ const en: Dict = {
301 "dashboard.subtitle": "Here’s what’s happening across your workspace.",313 "dashboard.subtitle": "Here’s what’s happening across your workspace.",
302 "dashboard.overview": "Overview",314 "dashboard.overview": "Overview",
303 "dashboard.quickActions": "Quick actions",315 "dashboard.quickActions": "Quick actions",
316+ "dashboard.action.note": "New note",
317+ "dashboard.action.noteHint": "Capture something quickly",
318+ "dashboard.action.event": "Create event",
319+ "dashboard.action.eventHint": "Schedule a session",
320+ "dashboard.action.course": "New course",
321+ "dashboard.action.courseHint": "Open a class",
322+ "dashboard.action.exam": "Add exam",
323+ "dashboard.action.examHint": "Under a course",
324+ "dashboard.action.attend": "Mark attendance",
325+ "dashboard.action.attendHint": "Open events list",
326+ "dashboard.action.marks": "My report card",
327+ "dashboard.action.marksHint": "See averages",
304 "dashboard.stats.notes": "Notes",328 "dashboard.stats.notes": "Notes",
305 "dashboard.stats.events": "Events",329 "dashboard.stats.events": "Events",
306 "dashboard.stats.exams": "Exams",330 "dashboard.stats.exams": "Exams",
@@ -534,6 +558,18 @@ const tr: Dict = {
534 "dashboard.subtitle": "Çalışma alanındaki güncel durum burada.",558 "dashboard.subtitle": "Çalışma alanındaki güncel durum burada.",
535 "dashboard.overview": "Özet",559 "dashboard.overview": "Özet",
536 "dashboard.quickActions": "Hızlı işlemler",560 "dashboard.quickActions": "Hızlı işlemler",
561+ "dashboard.action.note": "Yeni not",
562+ "dashboard.action.noteHint": "Hızlıca bir şey kaydet",
563+ "dashboard.action.event": "Etkinlik oluştur",
564+ "dashboard.action.eventHint": "Oturum planla",
565+ "dashboard.action.course": "Yeni ders",
566+ "dashboard.action.courseHint": "Sınıf aç",
567+ "dashboard.action.exam": "Sınav ekle",
568+ "dashboard.action.examHint": "Dersin içinden",
569+ "dashboard.action.attend": "Yoklama işaretle",
570+ "dashboard.action.attendHint": "Etkinlik listesine git",
571+ "dashboard.action.marks": "Karnem",
572+ "dashboard.action.marksHint": "Ortalamaları gör",
537 "dashboard.stats.notes": "Notlar",573 "dashboard.stats.notes": "Notlar",
538 "dashboard.stats.events": "Etkinlikler",574 "dashboard.stats.events": "Etkinlikler",
539 "dashboard.stats.exams": "Sınavlar",575 "dashboard.stats.exams": "Sınavlar",
src/pages/dashboard-page.tsxmodified+132 -48
@@ -7,7 +7,6 @@ import { getNotes } from "@/api/getNotes";
7 import type { Event, Exam, Note } from "@/api/types";7 import type { Event, Exam, Note } from "@/api/types";
8 import { RouteGuard } from "@/components/layout/route-guard";8 import { RouteGuard } from "@/components/layout/route-guard";
9 import { PageHeader } from "@/components/layout/page-header";9 import { PageHeader } from "@/components/layout/page-header";
10-import { CollapsibleHelp } from "@/components/ui/collapsible-help";
11 import { Badge } from "@/components/ui/badge";10 import { Badge } from "@/components/ui/badge";
12 import { Button } from "@/components/ui/button";11 import { Button } from "@/components/ui/button";
13 import {12 import {
@@ -58,24 +57,98 @@ function DashboardContent() {
58 const previewExams = createMemo(() => (exams() ?? []).slice(0, PREVIEW_LIMIT));57 const previewExams = createMemo(() => (exams() ?? []).slice(0, PREVIEW_LIMIT));
59 58
60 return (59 return (
61- <div class="space-y-8">60+ <div class="space-y-5">
61+ {/* Compact greeting + guide */}
62 <PageHeader62 <PageHeader
63+ compact
63 accent="mint"64 accent="mint"
64- eyebrow={t("dashboard.overview")}
65 title={t("dashboard.greeting", { name: user().username })}65 title={t("dashboard.greeting", { name: user().username })}
66 description={t("dashboard.subtitle")}66 description={t("dashboard.subtitle")}
67 actions={67 actions={
68 <Link to="/guide">68 <Link to="/guide">
69- <Button variant="outline">{t("dashboard.continueGuide")}</Button>69+ <Button variant="outline" size="sm">
70+ {t("dashboard.continueGuide")}
71+ </Button>
70 </Link>72 </Link>
71 }73 }
72 />74 />
73 75
74- <CollapsibleHelp title={t("dashboard.helpTitle")}>{t("dashboard.helpBody")}</CollapsibleHelp>76+ {/* Action CTAs — not sidebar mirrors; 4 verb-style shortcuts */}
77+ <section>
78+ <h2 class="mb-2.5 text-xs font-semibold uppercase tracking-wider text-muted-foreground">
79+ {t("dashboard.quickActions")}
80+ </h2>
81+ <div class="grid gap-3 sm:grid-cols-2 xl:grid-cols-4">
82+ <Show
83+ when={hasMinRole(user().role, "teacher")}
84+ fallback={
85+ <>
86+ <ActionCard
87+ to="/notes"
88+ title={t("dashboard.action.note")}
89+ hint={t("dashboard.action.noteHint")}
90+ icon="✎"
91+ tone="amber"
92+ />
93+ <ActionCard
94+ to="/events"
95+ title={t("dashboard.action.attend")}
96+ hint={t("dashboard.action.attendHint")}
97+ icon="◷"
98+ tone="sky"
99+ />
100+ <ActionCard
101+ to="/courses"
102+ title={t("nav.courses")}
103+ hint={t("courses.subtitle")}
104+ icon="▣"
105+ tone="violet"
106+ />
107+ <ActionCard
108+ to="/marks"
109+ title={t("dashboard.action.marks")}
110+ hint={t("dashboard.action.marksHint")}
111+ icon="▤"
112+ tone="mint"
113+ />
114+ </>
115+ }
116+ >
117+ <ActionCard
118+ to="/notes"
119+ title={t("dashboard.action.note")}
120+ hint={t("dashboard.action.noteHint")}
121+ icon="✎"
122+ tone="amber"
123+ />
124+ <ActionCard
125+ to="/events"
126+ title={t("dashboard.action.event")}
127+ hint={t("dashboard.action.eventHint")}
128+ icon="◷"
129+ tone="sky"
130+ />
131+ <ActionCard
132+ to="/courses"
133+ title={t("dashboard.action.course")}
134+ hint={t("dashboard.action.courseHint")}
135+ icon="▣"
136+ tone="violet"
137+ />
138+ <ActionCard
139+ to="/courses"
140+ title={t("dashboard.action.exam")}
141+ hint={t("dashboard.action.examHint")}
142+ icon="☰"
143+ tone="rose"
144+ />
145+ </Show>
146+ </div>
147+ </section>
75 148
76- {/* KPIs — full width, roomy tiles */}149+ {/* KPIs below actions */}
77 <Suspense fallback={<PageSpinner />}>150 <Suspense fallback={<PageSpinner />}>
78- <section class="grid gap-5 sm:grid-cols-2 xl:grid-cols-4">151+ <section class="grid gap-3 sm:grid-cols-2 xl:grid-cols-4">
79 <StatTile152 <StatTile
80 label={t("dashboard.stats.notes")}153 label={t("dashboard.stats.notes")}
81 value={String(noteCount())}154 value={String(noteCount())}
@@ -108,31 +181,11 @@ function DashboardContent() {
108 </section>181 </section>
109 </Suspense>182 </Suspense>
110 183
111- {/* Quick actions — own full-width row so list panels stay wide */}184+ {/* Summaries */}
112- <section class="surface-card p-5 sm:p-6">185+ <section class="grid items-stretch gap-4 lg:grid-cols-3">
113- <h2 class="mb-4 font-display text-lg font-semibold">{t("dashboard.quickActions")}</h2>186+ <div class="surface-card flex min-h-[18rem] flex-col p-4 sm:p-5">
114- <div class="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">187+ <div class="mb-3 flex items-center justify-between gap-2">
115- <QuickAction to="/courses" title={t("courses.title")} description={t("courses.subtitle")} icon="▣" />188+ <h2 class="font-display text-base font-semibold sm:text-lg">{t("dashboard.recentNotes")}</h2>
116- <QuickAction to="/marks" title={t("marks.title")} description={t("marks.subtitle")} icon="▤" />
117- <QuickAction to="/notes" title={t("notes.title")} description={t("notes.subtitle")} icon="✎" />
118- <QuickAction to="/events" title={t("events.title")} description={t("events.subtitle")} icon="◷" />
119- <QuickAction to="/exams" title={t("exams.title")} description={t("exams.subtitle")} icon="☰" />
120- <Show when={hasMinRole(user().role, "admin")}>
121- <QuickAction
122- to="/admin/users"
123- title={t("admin.title")}
124- description={t("admin.subtitle")}
125- icon="◎"
126- />
127- </Show>
128- </div>
129- </section>
130-
131- {/* Wide equal panels: notes · events · exams */}
132- <section class="grid items-stretch gap-5 lg:grid-cols-3">
133- <div class="surface-card flex min-h-[24rem] flex-col p-5 sm:p-6">
134- <div class="mb-4 flex items-center justify-between gap-2">
135- <h2 class="font-display text-lg font-semibold">{t("dashboard.recentNotes")}</h2>
136 <Link to="/notes" class="text-sm font-medium text-primary hover:underline">189 <Link to="/notes" class="text-sm font-medium text-primary hover:underline">
137 {t("dashboard.viewAll")}190 {t("dashboard.viewAll")}
138 </Link>191 </Link>
@@ -172,9 +225,9 @@ function DashboardContent() {
172 </Suspense>225 </Suspense>
173 </div>226 </div>
174 227
175- <div class="surface-card flex min-h-[24rem] flex-col p-5 sm:p-6">228+ <div class="surface-card flex min-h-[18rem] flex-col p-4 sm:p-5">
176- <div class="mb-4 flex items-center justify-between gap-2">229+ <div class="mb-3 flex items-center justify-between gap-2">
177- <h2 class="font-display text-lg font-semibold">{t("dashboard.upcomingEvents")}</h2>230+ <h2 class="font-display text-base font-semibold sm:text-lg">{t("dashboard.upcomingEvents")}</h2>
178 <Link to="/events" class="text-sm font-medium text-primary hover:underline">231 <Link to="/events" class="text-sm font-medium text-primary hover:underline">
179 {t("dashboard.viewAll")}232 {t("dashboard.viewAll")}
180 </Link>233 </Link>
@@ -223,9 +276,9 @@ function DashboardContent() {
223 </Suspense>276 </Suspense>
224 </div>277 </div>
225 278
226- <div class="surface-card flex min-h-[24rem] flex-col p-5 sm:p-6">279+ <div class="surface-card flex min-h-[18rem] flex-col p-4 sm:p-5">
227- <div class="mb-4 flex items-center justify-between gap-2">280+ <div class="mb-3 flex items-center justify-between gap-2">
228- <h2 class="font-display text-lg font-semibold">{t("dashboard.myExams")}</h2>281+ <h2 class="font-display text-base font-semibold sm:text-lg">{t("dashboard.myExams")}</h2>
229 <Link to="/exams" class="text-sm font-medium text-primary hover:underline">282 <Link to="/exams" class="text-sm font-medium text-primary hover:underline">
230 {t("dashboard.viewAll")}283 {t("dashboard.viewAll")}
231 </Link>284 </Link>
@@ -274,6 +327,7 @@ function DashboardContent() {
274 </Suspense>327 </Suspense>
275 </div>328 </div>
276 </section>329 </section>
330+
277 </div>331 </div>
278 );332 );
279 }333 }
@@ -350,15 +404,15 @@ function StatTile(props: {
350 };404 };
351 405
352 const inner = (406 const inner = (
353- <div class="stat-tile h-full min-h-[8.5rem] p-6">407+ <div class="stat-tile h-full min-h-[5.5rem] p-4">
354- <p class="text-xs font-semibold uppercase tracking-wider text-muted-foreground">{props.label}</p>408+ <p class="text-[11px] font-semibold uppercase tracking-wider text-muted-foreground">{props.label}</p>
355- <p class={cn("mt-3 font-display text-4xl font-semibold tracking-tight tabular-nums", tones[props.tone])}>409+ <p class={cn("mt-1.5 font-display text-2xl font-semibold tracking-tight tabular-nums sm:text-3xl", tones[props.tone])}>
356 {props.value}410 {props.value}
357 <Show when={props.suffix}>411 <Show when={props.suffix}>
358- <span class="text-lg font-medium text-muted-foreground"> {props.suffix}</span>412+ <span class="text-sm font-medium text-muted-foreground"> {props.suffix}</span>
359 </Show>413 </Show>
360 </p>414 </p>
361- <p class="mt-2 text-sm text-muted-foreground">{props.hint}</p>415+ <p class="mt-1 text-xs text-muted-foreground">{props.hint}</p>
362 </div>416 </div>
363 );417 );
364 418
@@ -372,18 +426,48 @@ function StatTile(props: {
372 return inner;426 return inner;
373 }427 }
374 428
375-function QuickAction(props: { to: string; title: string; description: string; icon: string }) {429+function ActionCard(props: {
430+ to: string;
431+ title: string;
432+ hint: string;
433+ icon: string;
434+ tone: "mint" | "sky" | "amber" | "violet" | "rose";
435+}) {
436+ const ring = {
437+ mint: "hover:border-emerald-500/40",
438+ sky: "hover:border-sky-500/40",
439+ amber: "hover:border-amber-500/40",
440+ violet: "hover:border-violet-500/40",
441+ rose: "hover:border-rose-500/40",
442+ };
443+ const iconBg = {
444+ mint: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
445+ sky: "bg-sky-500/10 text-sky-700 dark:text-sky-300",
446+ amber: "bg-amber-500/10 text-amber-700 dark:text-amber-300",
447+ violet: "bg-violet-500/10 text-violet-700 dark:text-violet-300",
448+ rose: "bg-rose-500/10 text-rose-700 dark:text-rose-300",
449+ };
450+
376 return (451 return (
377 <Link452 <Link
378 to={props.to}453 to={props.to}
379- class="flex flex-1 items-center gap-3 rounded-md border border-border/70 bg-background/60 px-3 py-3 transition-all hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-sm"454+ class={cn(
455+ "flex items-center gap-3 rounded-md border border-border bg-card px-3.5 py-3 shadow-sm transition-all",
456+ "hover:-translate-y-0.5 hover:shadow-md",
457+ ring[props.tone],
458+ )}
380 >459 >
381- <span class="flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-primary/10 text-lg text-primary">460+ <span
461+ class={cn(
462+ "flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-base",
463+ iconBg[props.tone],
464+ )}
465+ >
382 {props.icon}466 {props.icon}
383 </span>467 </span>
384 <span class="min-w-0">468 <span class="min-w-0">
385- <span class="block text-sm font-semibold">{props.title}</span>469+ <span class="block truncate text-sm font-semibold">{props.title}</span>
386- <span class="block truncate text-xs text-muted-foreground">{props.description}</span>470+ <span class="block truncate text-xs text-muted-foreground">{props.hint}</span>
387 </span>471 </span>
388 </Link>472 </Link>
389 );473 );