forge
Explore
Log in

Don't you dare go Hollow

🎨 Knowvio-style role-based dashboard, sidebar, and theme

Browse files at this commit

f9872a0e07169976401dce1a68b6d52be3033f49Burak BoduroğluParent: 4b79083
  • feat
    • 🎨 Knowvio-style role-based dashboard, sidebar, and theme
Show full message
feat: 🎨 Knowvio-style role-based dashboard, sidebar, and theme
- rebuild dashboard-page as a role-scoped board: Highlights stat cards
  with real-data sparklines, Progress overview (course averages / class
  sizes), attendance & workload split donuts, and an Upcoming Deadlines
  DataTable merging exams/events/homework/appointments
- restore chart-area-trend/bar/progress-ring, i18n their empty states,
  drop unused chart-metric-cards
- add role-aware fetches (admin/manager reach exams+homework), a
  bottom-center Refresh that refetches all resources, and a Soru Havuzu
  (question bank) quick panel
- simplify sidebar to the curated primary items + Messages unread badge;
  drop the guide card and in-sidebar theme toggle
- add a header back button; unify top-bar action buttons as bordered
- rebrand accent to Knowvio orange and adopt Space Grotesk + Inter fonts
- update dashboard-design skill + ui tokens to allow real-data charts

16 changed files +956 -1501

.claude/skills/dashboard-design/SKILL.mdmodified+18 -9
@@ -1,6 +1,6 @@
1 ---1 ---
2 name: dashboard-design2 name: dashboard-design
3-description: Rules for the hezarfen_frontend dashboard/homepage — a read-only status board (no mutations), monochrome palette with semantic-only status color, portal-card layout, grid, and role scoping. Load before editing src/pages/dashboard-page.tsx or the homepage.3+description: Rules for the hezarfen_frontend dashboard/homepage — a read-only board (no mutations), Knowvio-style stat cards + real-data charts + deadlines table, and role scoping. Load before editing src/pages/dashboard-page.tsx or the homepage.
4 ---4 ---
5 5
6 # Dashboard / homepage design6 # Dashboard / homepage design
@@ -8,13 +8,22 @@ description: Rules for the hezarfen_frontend dashboard/homepage — a read-only
8 Reference: `src/pages/dashboard-page.tsx`. The homepage is a **read-only status board**, not a marketing landing or action hub.8 Reference: `src/pages/dashboard-page.tsx`. The homepage is a **read-only status board**, not a marketing landing or action hub.
9 9
10 - **No mutations:** no create/edit/delete buttons, no primary CTAs that open forms. Links only navigate to existing list/detail routes.10 - **No mutations:** no create/edit/delete buttons, no primary CTAs that open forms. Links only navigate to existing list/detail routes.
11-- **Palette:** monochrome / grayscale surfaces (border, card, muted). No decorative color accents, gradients, activity charts, or multi-tone portal cards. **Semantic color only** for status (active / today / soon / danger).11+- **Charts are allowed, on real data only.** The homepage follows the Knowvio-style
12+ layout: a Highlights stat-card row, a Progress-overview chart, an Activity/attendance
13+ split, and an Upcoming-deadlines table. Charts use the `Chart*` components in
14+ `src/components/ui/` (accent = `hsl(var(--primary))`, semantic tints for status).
15+ **Every chart/stat must be backed by a live API field** — no fabricated trends,
16+ streak counters, or `+%` delta badges the backend can't produce. Hide a panel when
17+ its data source is empty for the current role rather than faking it.
12 - **Layout order (top → bottom):**18 - **Layout order (top → bottom):**
13 1. Compact header — greeting, role chip (neutral), date.19 1. Compact header — greeting, role chip (neutral), date.
14- 2. Role-scoped **workspace portal cards** (section links with optional counts).20+ 2. **Highlights** — role-scoped stat cards (icon + label + mono value).
15- 3. **Needs attention** + **Upcoming** side by side on `lg+`, stacked on mobile.21+ 3. **Progress overview** chart + **Activity split** on `lg+`.
16-- **Portal cards:** horizontal dense rows — icon | title + short desc | optional count. On desktop, title and count share one line as `Title | 12` (pipe separator, mono tabular count). No separate KPI strip repeating the same numbers.22+ 4. **Upcoming deadlines** `DataTable` (exams / events / homework / appointments).
17-- **Grid:** `1` col mobile → `2` sm → `3` lg → `4` xl. Equal-ish min height; avoid uneven multi-line stat stacks.23+ 5. Optional role-scoped workspace links / recent list.
18-- **Role scoping:** card set matches nav/role matrix (student personal tools; teacher teaching tools; manager+ management; admin gets staff-work + users, not personal `/work`). Optional min-role badge is muted/neutral, not rainbow.24+- **Grid:** stat row `1 → 2 sm → 4 lg`; charts `lg:grid-cols-3` (progress spans 2).
19-- **Attention list:** active / today / soon exams and events only; rows navigate to detail. Empty state is plain text, not a create CTA.25+- **Role scoping:** stat/chart set matches nav/role matrix (student personal tools +
20-- Do not reintroduce guide marketing blocks, vanity charts, or redundant bottom KPI tiles.26+ marks/attendance; teacher teaching tools; manager+ management; parent children/meals).
27+ Show only panels whose data exists for the role.
28+- **Deadlines table:** active / today / soon items only, semantic status badge, rows
29+ navigate to detail. Empty state is plain text, not a create CTA.
.codex/skills/dashboard-design/SKILL.mdmodified+18 -9
@@ -1,6 +1,6 @@
1 ---1 ---
2 name: dashboard-design2 name: dashboard-design
3-description: Rules for the hezarfen_frontend dashboard/homepage — a read-only status board (no mutations), monochrome palette with semantic-only status color, portal-card layout, grid, and role scoping. Load before editing src/pages/dashboard-page.tsx or the homepage.3+description: Rules for the hezarfen_frontend dashboard/homepage — a read-only board (no mutations), Knowvio-style stat cards + real-data charts + deadlines table, and role scoping. Load before editing src/pages/dashboard-page.tsx or the homepage.
4 ---4 ---
5 5
6 # Dashboard / homepage design6 # Dashboard / homepage design
@@ -8,13 +8,22 @@ description: Rules for the hezarfen_frontend dashboard/homepage — a read-only
8 Reference: `src/pages/dashboard-page.tsx`. The homepage is a **read-only status board**, not a marketing landing or action hub.8 Reference: `src/pages/dashboard-page.tsx`. The homepage is a **read-only status board**, not a marketing landing or action hub.
9 9
10 - **No mutations:** no create/edit/delete buttons, no primary CTAs that open forms. Links only navigate to existing list/detail routes.10 - **No mutations:** no create/edit/delete buttons, no primary CTAs that open forms. Links only navigate to existing list/detail routes.
11-- **Palette:** monochrome / grayscale surfaces (border, card, muted). No decorative color accents, gradients, activity charts, or multi-tone portal cards. **Semantic color only** for status (active / today / soon / danger).11+- **Charts are allowed, on real data only.** The homepage follows the Knowvio-style
12+ layout: a Highlights stat-card row, a Progress-overview chart, an Activity/attendance
13+ split, and an Upcoming-deadlines table. Charts use the `Chart*` components in
14+ `src/components/ui/` (accent = `hsl(var(--primary))`, semantic tints for status).
15+ **Every chart/stat must be backed by a live API field** — no fabricated trends,
16+ streak counters, or `+%` delta badges the backend can't produce. Hide a panel when
17+ its data source is empty for the current role rather than faking it.
12 - **Layout order (top → bottom):**18 - **Layout order (top → bottom):**
13 1. Compact header — greeting, role chip (neutral), date.19 1. Compact header — greeting, role chip (neutral), date.
14- 2. Role-scoped **workspace portal cards** (section links with optional counts).20+ 2. **Highlights** — role-scoped stat cards (icon + label + mono value).
15- 3. **Needs attention** + **Upcoming** side by side on `lg+`, stacked on mobile.21+ 3. **Progress overview** chart + **Activity split** on `lg+`.
16-- **Portal cards:** horizontal dense rows — icon | title + short desc | optional count. On desktop, title and count share one line as `Title | 12` (pipe separator, mono tabular count). No separate KPI strip repeating the same numbers.22+ 4. **Upcoming deadlines** `DataTable` (exams / events / homework / appointments).
17-- **Grid:** `1` col mobile → `2` sm → `3` lg → `4` xl. Equal-ish min height; avoid uneven multi-line stat stacks.23+ 5. Optional role-scoped workspace links / recent list.
18-- **Role scoping:** card set matches nav/role matrix (student personal tools; teacher teaching tools; manager+ management; admin gets staff-work + users, not personal `/work`). Optional min-role badge is muted/neutral, not rainbow.24+- **Grid:** stat row `1 → 2 sm → 4 lg`; charts `lg:grid-cols-3` (progress spans 2).
19-- **Attention list:** active / today / soon exams and events only; rows navigate to detail. Empty state is plain text, not a create CTA.25+- **Role scoping:** stat/chart set matches nav/role matrix (student personal tools +
20-- Do not reintroduce guide marketing blocks, vanity charts, or redundant bottom KPI tiles.26+ marks/attendance; teacher teaching tools; manager+ management; parent children/meals).
27+ Show only panels whose data exists for the role.
28+- **Deadlines table:** active / today / soon items only, semantic status badge, rows
29+ navigate to detail. Empty state is plain text, not a create CTA.
bun.lockmodified+6 -0
@@ -5,6 +5,8 @@
5 "": {5 "": {
6 "name": "hezarfen-frontend",6 "name": "hezarfen-frontend",
7 "dependencies": {7 "dependencies": {
8+ "@fontsource-variable/inter": "^5.3.0",
9+ "@fontsource-variable/space-grotesk": "^5.3.0",
8 "@kobalte/core": "^0.13.12",10 "@kobalte/core": "^0.13.12",
9 "@tanstack/solid-router": "^1.170.18",11 "@tanstack/solid-router": "^1.170.18",
10 "@tanstack/solid-table": "^8.21.3",12 "@tanstack/solid-table": "^8.21.3",
@@ -162,6 +164,10 @@
162 164
163 "@floating-ui/utils": ["@floating-ui/utils@0.2.12", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="],165 "@floating-ui/utils": ["@floating-ui/utils@0.2.12", "", {}, "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww=="],
164 166
167+ "@fontsource-variable/inter": ["@fontsource-variable/inter@5.3.0", "", {}, "sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA=="],
168+
169+ "@fontsource-variable/space-grotesk": ["@fontsource-variable/space-grotesk@5.3.0", "", {}, "sha512-2IxmvfB08i9vnGB3Ym/AXvhRE+8XOjWMXIyDum03c+tPwH0FUoMNQfGpU8NXPxjbws0Vvss3AH0Zqt4oJBBAdw=="],
170+
165 "@internationalized/number": ["@internationalized/number@3.6.7", "", { "dependencies": { "@swc/helpers": "^0.5.0" } }, "sha512-3ji1fcrT+FPAK86UqEhB/psHixYo6niWPJtt7+qRaYFynt/BaJG8GhAPimtWUpEiVSTq8ZM8L5psMxGquiB/Vg=="],171 "@internationalized/number": ["@internationalized/number@3.6.7", "", { "dependencies": { "@swc/helpers": "^0.5.0" } }, "sha512-3ji1fcrT+FPAK86UqEhB/psHixYo6niWPJtt7+qRaYFynt/BaJG8GhAPimtWUpEiVSTq8ZM8L5psMxGquiB/Vg=="],
166 172
167 "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],173 "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.13", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA=="],
docs/ui/ui-redesign-tokens.mdmodified+16 -4
@@ -4,8 +4,9 @@
4 4
5 Dense school admin UI with Apple HIG-inspired grouped surfaces: neutral grouped5 Dense school admin UI with Apple HIG-inspired grouped surfaces: neutral grouped
6 backgrounds, subtle borders, translucent overlays, one blue accent for6 backgrounds, subtle borders, translucent overlays, one blue accent for
7-interactive chrome only. Dashboard and overview surfaces stay grayscale; color7+interactive chrome only. Surfaces stay neutral; color is reserved for the blue
8-is reserved for semantic status (success / warning / danger / info).8+accent, dashboard charts (see "Charts" below), and semantic status (success /
9+warning / danger / info).
9 10
10 ## Color11 ## Color
11 12
@@ -85,7 +86,7 @@ Reference page: `src/pages/admin-users-page.tsx`.
85 86
86 Implemented:87 Implemented:
87 88
88-- grouped accordion sidebar with active category auto-open89+- fixed single-level role sidebar with one neutral raised active row
89 - compact stat row on top of users page90 - compact stat row on top of users page
90 - dense sticky data table styling via `.data-table`91 - dense sticky data table styling via `.data-table`
91 - centered row action dropdowns via `TableRowActions`92 - centered row action dropdowns via `TableRowActions`
@@ -132,9 +133,20 @@ Reference implementation: `src/pages/dashboard-page.tsx`.
132 - Status uses semantic color only (dot + small badge): active (emerald), today (amber), soon (muted).133 - Status uses semantic color only (dot + small badge): active (emerald), today (amber), soon (muted).
133 - Empty states are plain text — never “create exam/event” CTAs.134 - Empty states are plain text — never “create exam/event” CTAs.
134 135
136+### Charts (Knowvio-style dashboard)
137+
138+- The homepage uses the `Chart*` components in `src/components/ui/` (area trend,
139+ bar, progress ring) for a Highlights stat row + Progress-overview + Activity split,
140+ plus a `DataTable` of upcoming deadlines. Accent = `hsl(var(--primary))`; status
141+ tints stay semantic (emerald/amber/rose/muted).
142+- **Real data only:** every chart/stat maps to a live API field. No fabricated daily
143+ trends, streak counters, or `+%` delta badges. Hide a panel when its source is empty
144+ for the current role.
145+
135 ### Out of scope for dashboard146 ### Out of scope for dashboard
136 147
137-- Activity bar charts, multi-color portal accents, guide/marketing footers, create shortcuts, redundant summary KPI tiles under the portal grid.148+- Guide/marketing footers, create shortcuts, promotional/upgrade cards.
149+- Drag/drop ordering, fabricated trends / streaks, `+%` deltas, manual refresh controls.
138 150
139 ## Current Implementation Notes151 ## Current Implementation Notes
140 152
package.jsonmodified+2 -0
@@ -16,6 +16,8 @@
16 "prepare": "git config core.hooksPath .githooks 2>/dev/null || true"16 "prepare": "git config core.hooksPath .githooks 2>/dev/null || true"
17 },17 },
18 "dependencies": {18 "dependencies": {
19+ "@fontsource-variable/inter": "^5.3.0",
20+ "@fontsource-variable/space-grotesk": "^5.3.0",
19 "@kobalte/core": "^0.13.12",21 "@kobalte/core": "^0.13.12",
20 "@tanstack/solid-router": "^1.170.18",22 "@tanstack/solid-router": "^1.170.18",
21 "@tanstack/solid-table": "^8.21.3",23 "@tanstack/solid-table": "^8.21.3",
src/components/layout/app-shell.tsxmodified+25 -45
@@ -6,18 +6,19 @@ import { CommandPalette } from "@/components/layout/command-palette";
6 import { MobileTabBar } from "@/components/layout/mobile-tab-bar";6 import { MobileTabBar } from "@/components/layout/mobile-tab-bar";
7 import { NavBar } from "@/components/layout/nav-bar";7 import { NavBar } from "@/components/layout/nav-bar";
8 import { NotificationCenter } from "@/components/layout/notification-center";8 import { NotificationCenter } from "@/components/layout/notification-center";
9-import { RightNav } from "@/components/layout/right-nav";9+import { routeNavItem } from "@/components/layout/nav-items";
10+import { ShellMessagesButton } from "@/components/layout/shell-messages-button";
10 import { SideNav } from "@/components/layout/side-nav";11 import { SideNav } from "@/components/layout/side-nav";
11 import { SidebarAccount } from "@/components/layout/sidebar-account";12 import { SidebarAccount } from "@/components/layout/sidebar-account";
12 import { Button } from "@/components/ui/button";13 import { Button } from "@/components/ui/button";
13-import { IconBotSquare, IconPanelLeft, IconSearch, IconX } from "@/components/ui/icons";14+import { IconBotSquare, IconChevronLeft, IconPanelLeft, IconSearch, IconX } from "@/components/ui/icons";
14 import { Toaster } from "@/components/ui/toast";15 import { Toaster } from "@/components/ui/toast";
15 import { useAuth } from "@/stores/auth-context";16 import { useAuth } from "@/stores/auth-context";
16 import { ShellFeedProvider } from "@/stores/shell-feed-context";17 import { ShellFeedProvider } from "@/stores/shell-feed-context";
17 import { usePreferences, useT } from "@/stores/preferences-context";18 import { usePreferences, useT } from "@/stores/preferences-context";
18 import { cn } from "@/lib/cn";19 import { cn } from "@/lib/cn";
19 20
20-const SIDEBAR_EXPANDED = "w-52 2xl:w-56";21+const SIDEBAR_EXPANDED = "w-60";
21 const SIDEBAR_COLLAPSED = "w-16";22 const SIDEBAR_COLLAPSED = "w-16";
22 23
23 export function AppShell(props: ParentProps) {24 export function AppShell(props: ParentProps) {
@@ -34,35 +35,8 @@ export function AppShell(props: ParentProps) {
34 const wide = () => location().pathname.startsWith("/exam-room/") || location().searchStr.includes("answerUser=") || location().pathname === "/messages";35 const wide = () => location().pathname.startsWith("/exam-room/") || location().searchStr.includes("answerUser=") || location().pathname === "/messages";
35 const fullScreen = () => location().pathname.startsWith("/exam-room/");36 const fullScreen = () => location().pathname.startsWith("/exam-room/");
36 const routeLabel = createMemo(() => {37 const routeLabel = createMemo(() => {
37- const path = location().pathname;38+ const item = routeNavItem(location().pathname, auth.user()?.role);
38- if (path === "/") return t("nav.home");39+ return item ? t(item.labelKey) : location().pathname;
39- if (path === "/notes") return `${t("nav.group.grades")} / ${t("nav.notes")}`;
40- if (path === "/messages") return `${t("nav.group.community")} / ${t("nav.messages")}`;
41- if (path === "/marks") return `${t("nav.group.classes")} / ${t("nav.marks")}`;
42- if (path === "/attendance") return `${t("nav.group.classes")} / ${t("nav.attendance")}`;
43- if (path === "/pomodoro") return `${t("nav.group.classes")} / ${t("nav.pomodoro")}`;
44- if (path === "/courses" || path.startsWith("/courses/")) return `${t("nav.group.classes")} / ${t("nav.courses")}`;
45- if (path === "/studies") return `${t("nav.group.classes")} / ${t("nav.studies")}`;
46- if (path === "/clubs") return `${t("nav.group.classes")} / ${t("nav.clubs")}`;
47- if (path === "/homework" || path.startsWith("/homework/")) return `${t("nav.group.classes")} / ${t("nav.homework")}`;
48- if (path === "/events" || path.startsWith("/events/")) return `${t("nav.group.classes")} / ${t("nav.events")}`;
49- if (path === "/exams" || path.startsWith("/exams/")) return `${t("nav.group.classes")} / ${t("nav.exams")}`;
50- if (path === "/question-bank") return `${t("nav.group.classes")} / ${t("nav.questionBank")}`;
51- if (path === "/calendar") return `${t("nav.group.classes")} / ${t("nav.calendar")}`;
52- if (path === "/appointments") return `${t("nav.group.classes")} / ${t("nav.appointments")}`;
53- if (path === "/students") return `${t("nav.group.students")} / ${t("nav.myStudents")}`;
54- if (path === "/questions" || path.startsWith("/questions/")) return `${t("nav.group.community")} / ${t("pool.title")}`;
55- if (path.startsWith("/exam-room/")) return t("nav.exams");
56- if (path === "/work") return `${t("nav.group.reports")} / ${t("nav.work")}`;
57- if (path === "/management/student-marks") return `${t("nav.group.classes")} / ${t("nav.studentMarks")}`;
58- if (path === "/management/student-attendance") return `${t("nav.group.reports")} / ${t("nav.studentAttendance")}`;
59- if (path === "/management/pomodoros") return `${t("nav.group.reports")} / ${t("nav.studentPomodoro")}`;
60- if (path === "/management/staff-work") return `${t("nav.group.reports")} / ${t("nav.staffWork")}`;
61- if (path === "/management/settings") return `${t("nav.group.settings")} / ${t("nav.settings")}`;
62- if (path === "/management/terms") return `${t("nav.group.settings")} / ${t("nav.terms")}`;
63- if (path === "/admin/users") return `${t("nav.admin")} / ${t("nav.users")}`;
64- if (path === "/guide") return t("nav.guide");
65- return path;
66 });40 });
67 const logout = async () => {41 const logout = async () => {
68 await auth.logout();42 await auth.logout();
@@ -157,18 +131,27 @@ export function AppShell(props: ParentProps) {
157 131
158 <main class="min-w-0 flex-1">132 <main class="min-w-0 flex-1">
159 <Show when={auth.user() && !fullScreen()}>133 <Show when={auth.user() && !fullScreen()}>
160- <header class="sticky top-0 z-30 hig-translucent-bar flex h-14 items-center justify-between gap-3 px-4 sm:px-6 lg:px-8">134+ <header class="sticky top-0 z-30 flex h-16 items-center gap-3 border-b border-border/70 bg-background/90 px-4 backdrop-blur-xl sm:px-6 lg:px-8">
161- <div class="flex flex-1 items-center justify-start min-w-0">135+ <div class="flex min-w-0 shrink-0 items-center gap-2 sm:w-44">
162- <div class="rounded-full border border-black/6 dark:border-white/8 bg-card/80 px-3.5 py-1 text-xs font-semibold text-muted-foreground shadow-xs">136+ <Show when={location().pathname !== "/"}>
163- <span class="block truncate max-w-[120px] sm:max-w-none">{routeLabel()}</span>137+ <button
164- </div>138+ type="button"
139+ onClick={() => window.history.back()}
140+ class="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border bg-background text-muted-foreground outline-hidden transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"
141+ aria-label={t("common.back")}
142+ title={t("common.back")}
143+ >
144+ <IconChevronLeft class="h-4 w-4" />
145+ </button>
146+ </Show>
147+ <span class="block truncate text-sm font-semibold">{routeLabel()}</span>
165 </div>148 </div>
166 149
167- <div class="flex flex-1 items-center justify-center max-w-md min-w-0">150+ <div class="mx-auto flex min-w-0 max-w-xl flex-1 items-center justify-center">
168 <button151 <button
169 type="button"152 type="button"
170 onClick={() => setCommandOpen(true)}153 onClick={() => setCommandOpen(true)}
171- class="flex h-9 w-full items-center justify-between gap-2.5 rounded-full border border-black/8 dark:border-white/12 bg-secondary/60 px-3.5 text-xs font-medium text-muted-foreground shadow-2xs transition-all hover:bg-secondary hover:text-foreground hover:border-border/80"154+ class="flex h-10 w-full items-center justify-between gap-2.5 rounded-xl border border-border bg-muted/50 px-3.5 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
172 title={t("dashboard.commandCenter")}155 title={t("dashboard.commandCenter")}
173 >156 >
174 <div class="flex items-center gap-2 min-w-0">157 <div class="flex items-center gap-2 min-w-0">
@@ -181,9 +164,10 @@ export function AppShell(props: ParentProps) {
181 </button>164 </button>
182 </div>165 </div>
183 166
184- <div class="flex flex-1 items-center justify-end gap-2 min-w-0">167+ <div class="flex shrink-0 items-center justify-end gap-2">
168+ <ShellMessagesButton />
185 <NotificationCenter />169 <NotificationCenter />
186- <Button type="button" variant="ghost" size="sm" class="h-9 shrink-0 rounded-full border border-border bg-transparent text-muted-foreground shadow-none hover:bg-muted hover:text-foreground" onClick={() => setCelebiOpen(true)}>170+ <Button type="button" variant="ghost" size="sm" class="hidden h-9 shrink-0 rounded-xl border border-border bg-transparent text-muted-foreground shadow-none hover:bg-muted hover:text-foreground sm:flex" onClick={() => setCelebiOpen(true)}>
187 <IconBotSquare class="h-4 w-4" />171 <IconBotSquare class="h-4 w-4" />
188 <span class="hidden sm:inline">{t("ai.askCelebi")}</span>172 <span class="hidden sm:inline">{t("ai.askCelebi")}</span>
189 </Button>173 </Button>
@@ -200,10 +184,6 @@ export function AppShell(props: ParentProps) {
200 {props.children}184 {props.children}
201 </div>185 </div>
202 </main>186 </main>
203-
204- <Show when={auth.user() && !fullScreen()}>
205- <RightNav />
206- </Show>
207 </div>187 </div>
208 {/* MobileTabBar stays inside the provider — it is a shell surface, so a188 {/* MobileTabBar stays inside the provider — it is a shell surface, so a
209 useShellFeed() badge there must not throw. */}189 useShellFeed() badge there must not throw. */}
src/components/layout/notification-center.tsxmodified+2 -2
@@ -200,8 +200,8 @@ export function NotificationCenter() {
200 <Popover open={open()} onOpenChange={setOpen} placement="bottom-end" gutter={8}>200 <Popover open={open()} onOpenChange={setOpen} placement="bottom-end" gutter={8}>
201 <PopoverTrigger201 <PopoverTrigger
202 class={cn(202 class={cn(
203- "relative flex h-9 w-9 items-center justify-center rounded-full border border-border/80 bg-card/60 text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground shrink-0 cursor-pointer outline-hidden",203+ "relative flex h-9 w-9 items-center justify-center rounded-xl border border-border bg-background text-muted-foreground transition-colors hover:bg-muted hover:text-foreground shrink-0 cursor-pointer outline-hidden focus-visible:ring-2 focus-visible:ring-ring",
204- open() && "bg-secondary text-foreground"204+ open() && "bg-muted text-foreground"
205 )}205 )}
206 title={t("rightPanel.messagesTitle")}206 title={t("rightPanel.messagesTitle")}
207 aria-label="Bildirimler"207 aria-label="Bildirimler"
src/components/layout/side-nav.tsxmodified+42 -151
@@ -1,175 +1,66 @@
1+import { For, Show } from "solid-js";
1 import { Link, useRouterState } from "@tanstack/solid-router";2 import { Link, useRouterState } from "@tanstack/solid-router";
2-import { For, Show, createEffect, createMemo, createSignal } from "solid-js";3+import { primaryNavItems, primaryPathActive, type NavItem } from "@/components/layout/nav-items";
3-import {4+import { IconMessage } from "@/components/ui/icons";
4- DropdownMenu,5+import { cn } from "@/lib/cn";
5- DropdownMenuContent,
6- DropdownMenuItem,
7- DropdownMenuTrigger,
8-} from "@/components/ui/dropdown-menu";
9 import { useAuth } from "@/stores/auth-context";6 import { useAuth } from "@/stores/auth-context";
7+import { useShellFeed } from "@/stores/shell-feed-context";
10 import { useT } from "@/stores/preferences-context";8 import { useT } from "@/stores/preferences-context";
11-import { cn } from "@/lib/cn";
12-import { IconChevronRight } from "@/components/ui/icons";
13-import { HOME_ITEM, pathActive, visibleNavGroups, type NavItem } from "@/components/layout/nav-items";
14 9
15-function NavLink(props: {10+const MESSAGES_ITEM: NavItem = { id: "messages", to: "/messages", labelKey: "nav.messages", Icon: IconMessage };
16- item: NavItem;
17- collapsed?: boolean;
18- onNavigate?: () => void;
19- standalone?: boolean;
20-}) {
21- const t = useT();
22- const pathname = useRouterState({ select: (s) => s.location.pathname });
23- const active = () => pathActive(pathname(), props.item.to, props.item.exact);
24-
25- return (
26- <Link
27- to={props.item.to}
28- onClick={() => props.onNavigate?.()}
29- title={t(props.item.labelKey)}
30- aria-current={active() ? "page" : undefined}
31- class={cn(
32- "relative flex h-9 w-full items-center rounded-md outline-hidden transition-colors duration-150 active:scale-[0.98] 2xl:h-9",
33- props.standalone ? "text-sm font-semibold" : "text-[13px] font-medium",
34- props.collapsed ? "mx-auto h-9 w-9 justify-center px-0" : props.standalone ? "gap-2.5 px-2.5" : "gap-2 px-2.5",
35- active()
36- ? props.standalone
37- ? "bg-primary/12 font-semibold text-primary dark:bg-white/9 dark:text-white"
38- : "font-semibold text-primary dark:text-white"
39- : "text-sidebar-foreground/80 hover:bg-secondary hover:text-foreground dark:text-white/86 dark:hover:bg-white/[0.07] dark:hover:text-white",
40- )}
41- >
42- <props.item.Icon class={cn(props.standalone || props.collapsed ? "h-4 w-4" : "h-3.5 w-3.5", "shrink-0 transition-colors", active() ? "text-primary dark:text-white" : "text-muted-foreground dark:text-white/55")} />
43- <span class={cn("truncate", props.collapsed ? "sr-only" : "block min-w-0 flex-1 text-left")}>{t(props.item.labelKey)}</span>
44- </Link>
45- );
46-}
47 11
48 export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) {12 export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) {
49 const auth = useAuth();13 const auth = useAuth();
50 const t = useT();14 const t = useT();
51- const pathname = useRouterState({ select: (s) => s.location.pathname });15+ const feed = useShellFeed();
52- const role = () => auth.user()?.role;16+ const pathname = useRouterState({ select: (state) => state.location.pathname });
53-
54- const visibleGroups = createMemo(() => visibleNavGroups(role()));
55- const activeGroupId = createMemo(
56- () =>
57- visibleGroups().find((group) => group.items.some((item) => pathActive(pathname(), item.to, item.exact)))?.id ??
58- "",
59- );
60- const [openGroups, setOpenGroups] = createSignal<Record<string, boolean>>({});
61 17
62- const isOpen = (groupId: string) => openGroups()[groupId] === true;18+ // Curated set: the role's primary items (same source as the mobile tab bar) plus
63-19+ // Messages. Everything else stays reachable via the ⌘K command palette.
64- const toggleGroup = (groupId: string) => {20+ const items = (): NavItem[] => {
65- setOpenGroups((current) => ({ ...current, [groupId]: !current[groupId] }));21+ const primary = primaryNavItems(auth.user()?.role);
22+ return primary.some((i) => i.id === "messages") ? primary : [...primary, MESSAGES_ITEM];
66 };23 };
67-24+ const unread = () => feed.unreadMessages().total;
68- createEffect(() => {25+ const badgeFor = (item: NavItem) => (item.id === "messages" ? unread() : 0);
69- const active = activeGroupId();
70- if (!active) return;
71- setOpenGroups((current) => (current[active] ? current : { ...current, [active]: true }));
72- });
73 26
74 return (27 return (
75 <nav class="flex h-full flex-col" aria-label={t("nav.menu")}>28 <nav class="flex h-full flex-col" aria-label={t("nav.menu")}>
76- <div class="flex flex-col gap-0.5">29+ <div class="grid gap-1">
77- <NavLink item={HOME_ITEM} collapsed={props.collapsed} onNavigate={props.onNavigate} standalone />30+ <For each={items()}>
78- <For each={visibleGroups()}>31+ {(item) => {
79- {(group, index) => {32+ const active = () => primaryPathActive(pathname(), item);
80- const open = () => isOpen(group.id);
81- const groupActive = () =>
82- group.items.some((item) => pathActive(pathname(), item.to, item.exact));
83- const showManagementDivider = () => !!group.minRole && !visibleGroups()[index() - 1]?.minRole;
84 return (33 return (
85- <>34+ <Link
86- <Show when={showManagementDivider()}>35+ to={item.to}
36+ onClick={() => props.onNavigate?.()}
37+ title={t(item.labelKey)}
38+ aria-current={active() ? "page" : undefined}
39+ class={cn(
40+ "relative flex h-9 items-center rounded-lg text-[13px] font-medium outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring",
41+ props.collapsed ? "mx-auto w-10 justify-center px-0" : "gap-3 px-3",
42+ active()
43+ ? "bg-primary/10 text-primary"
44+ : "text-muted-foreground hover:bg-muted/70 hover:text-foreground",
45+ )}
46+ >
47+ <item.Icon class="h-4 w-4 shrink-0" />
48+ <span class={props.collapsed ? "sr-only" : "truncate"}>{t(item.labelKey)}</span>
49+ <Show when={badgeFor(item) > 0}>
87 <Show50 <Show
88 when={!props.collapsed}51 when={!props.collapsed}
89 fallback={52 fallback={
90- <div class="px-2 py-2">53+ <span class="absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-rose-500 px-1 text-[9px] font-bold text-white">
91- <span class="block h-px bg-border dark:bg-white/8" />54+ {unread() > 9 ? "9+" : unread()}
92- </div>
93- }
94- >
95- <div class="flex items-center gap-2 px-2 pb-1 pt-3">
96- <span class="h-px flex-1 bg-border dark:bg-white/8" />
97- <span class="text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground dark:text-white/45 2xl:text-[11px]">
98- {t("nav.admin")}
99 </span>55 </span>
100- <span class="h-px flex-1 bg-border dark:bg-white/8" />
101- </div>
102- </Show>
103- </Show>
104- <section>
105- <Show
106- when={props.collapsed}
107- fallback={
108- <>
109- <button
110- type="button"
111- class={cn(
112- "flex h-9 w-full items-center gap-2.5 rounded-md px-2.5 text-sm font-semibold text-sidebar-foreground/80 transition-colors duration-150 hover:bg-secondary hover:text-foreground dark:text-white/86 dark:hover:bg-white/[0.07] dark:hover:text-white",
113- groupActive() ? "bg-primary/12 text-primary dark:bg-white/9 dark:text-white" : open() && "text-foreground dark:text-white",
114- )}
115- title={t(group.labelKey)}
116- aria-expanded={open()}
117- onClick={() => toggleGroup(group.id)}
118- >
119- <group.Icon class="h-4 w-4 text-muted-foreground dark:text-white/55" />
120- <span class="min-w-0 flex-1 truncate text-left">{t(group.labelKey)}</span>
121- <IconChevronRight class={cn("h-3.5 w-3.5 text-muted-foreground dark:text-white/45 transition-transform duration-150", open() && "rotate-90")} />
122- </button>
123- <Show when={open()}>
124- <div class="ml-6 mt-0.5 grid gap-0.5 overflow-hidden border-l border-border pl-2 transition-all duration-150 dark:border-white/12">
125- <For each={group.items}>
126- {(item) => <NavLink item={item} onNavigate={props.onNavigate} />}
127- </For>
128- </div>
129- </Show>
130- </>
131 }56 }
132 >57 >
133- <DropdownMenu placement="right-start" gutter={8}>58+ <span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-rose-500 px-1.5 text-[10px] font-bold text-white">
134- <DropdownMenuTrigger59+ {unread() > 9 ? "9+" : unread()}
135- class={cn(60+ </span>
136- "relative flex h-9 w-full items-center justify-center rounded-md px-0 text-muted-foreground outline-hidden transition-colors duration-150 hover:bg-secondary hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-expanded:bg-secondary data-expanded:text-foreground dark:text-white/65 dark:hover:bg-white/8 dark:hover:text-white dark:focus-visible:ring-white/30 dark:data-expanded:bg-white/8 dark:data-expanded:text-white",
137- groupActive() && "bg-primary/12 text-primary dark:bg-white/9 dark:text-white",
138- )}
139- title={t(group.labelKey)}
140- aria-label={t(group.labelKey)}
141- >
142- <group.Icon class="h-3.5 w-3.5" />
143- <IconChevronRight class="absolute right-1 h-3 w-3 opacity-55" />
144- </DropdownMenuTrigger>
145- <DropdownMenuContent class="w-52 rounded-lg p-1 shadow-soft dark:border-white/10 dark:bg-[#101010] dark:text-white">
146- <p class="px-2 py-1.5 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground dark:text-white/45">
147- {t(group.labelKey)}
148- </p>
149- <For each={group.items}>
150- {(item) => {
151- const itemActive = () => pathActive(pathname(), item.to, item.exact);
152- return (
153- <DropdownMenuItem
154- class={cn("rounded-md p-0 dark:text-white/80 dark:focus:bg-white/8 dark:focus:text-white", itemActive() && "bg-primary/12 text-primary dark:bg-white/9 dark:text-white")}
155- >
156- <Link
157- to={item.to}
158- onClick={() => props.onNavigate?.()}
159- class="flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 outline-hidden"
160- >
161- <item.Icon class={cn("h-4 w-4 shrink-0", itemActive() ? "text-primary dark:text-white" : "text-muted-foreground dark:text-white/55")} />
162- <span class="min-w-0 flex-1 truncate">{t(item.labelKey)}</span>
163- </Link>
164- </DropdownMenuItem>
165- );
166- }}
167- </For>
168- </DropdownMenuContent>
169- </DropdownMenu>
170 </Show>61 </Show>
171- </section>62+ </Show>
172- </>63+ </Link>
173 );64 );
174 }}65 }}
175 </For>66 </For>
src/components/ui/chart-area-trend.tsxmodified+4 -2
@@ -1,5 +1,6 @@
1 import { For, Show, createSignal, type Component } from "solid-js";1 import { For, Show, createSignal, type Component } from "solid-js";
2 import { cn } from "@/lib/cn";2 import { cn } from "@/lib/cn";
3+import { useT } from "@/stores/preferences-context";
3 4
4 export type ChartAreaTrendItem = {5 export type ChartAreaTrendItem = {
5 label: string;6 label: string;
@@ -19,6 +20,7 @@ export type ChartAreaTrendProps = {
19 20
20 export const ChartAreaTrend: Component<ChartAreaTrendProps> = (props) => {21 export const ChartAreaTrend: Component<ChartAreaTrendProps> = (props) => {
21 const [hoverIndex, setHoverIndex] = createSignal<number | null>(null);22 const [hoverIndex, setHoverIndex] = createSignal<number | null>(null);
23+ const t = useT();
22 24
23 const values = () => props.items.map((i) => i.value);25 const values = () => props.items.map((i) => i.value);
24 const minVal = () => props.minScale ?? Math.min(0, ...values());26 const minVal = () => props.minScale ?? Math.min(0, ...values());
@@ -89,8 +91,8 @@ export const ChartAreaTrend: Component<ChartAreaTrendProps> = (props) => {
89 <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" />91 <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" />
90 </svg>92 </svg>
91 </div>93 </div>
92- <p class="text-xs font-semibold text-foreground/80">Kayıt Bulunamadı</p>94+ <p class="text-xs font-semibold text-foreground/80">{t("dashboard.chartEmpty")}</p>
93- <p class="text-[11px] text-muted-foreground mt-0.5">Gösterilecek henüz veri eklenmedi</p>95+ <p class="text-[11px] text-muted-foreground mt-0.5">{t("dashboard.chartEmptyHint")}</p>
94 </div>96 </div>
95 }97 }
96 >98 >
src/components/ui/chart-bar.tsxmodified+4 -2
@@ -1,5 +1,6 @@
1 import { For, Show, createSignal, type Component } from "solid-js";1 import { For, Show, createSignal, type Component } from "solid-js";
2 import { cn } from "@/lib/cn";2 import { cn } from "@/lib/cn";
3+import { useT } from "@/stores/preferences-context";
3 4
4 export type ChartBarItem = {5 export type ChartBarItem = {
5 id: string;6 id: string;
@@ -20,6 +21,7 @@ export type ChartBarProps = {
20 21
21 export const ChartBar: Component<ChartBarProps> = (props) => {22 export const ChartBar: Component<ChartBarProps> = (props) => {
22 const [hoveredId, setHoveredId] = createSignal<string | null>(null);23 const [hoveredId, setHoveredId] = createSignal<string | null>(null);
24+ const t = useT();
23 25
24 const maxValue = () => {26 const maxValue = () => {
25 if (props.maxScale != null && props.maxScale > 0) return props.maxScale;27 if (props.maxScale != null && props.maxScale > 0) return props.maxScale;
@@ -49,8 +51,8 @@ export const ChartBar: Component<ChartBarProps> = (props) => {
49 <path stroke-linecap="round" stroke-linejoin="round" d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z" />51 <path stroke-linecap="round" stroke-linejoin="round" d="M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 013 19.875v-6.75zM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V8.625zM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 01-1.125-1.125V4.125z" />
50 </svg>52 </svg>
51 </div>53 </div>
52- <p class="text-xs font-semibold text-foreground/80">Kayıt Bulunamadı</p>54+ <p class="text-xs font-semibold text-foreground/80">{t("dashboard.chartEmpty")}</p>
53- <p class="text-[11px] text-muted-foreground mt-0.5">Grafik için henüz yeterli veri bulunmuyor</p>55+ <p class="text-[11px] text-muted-foreground mt-0.5">{t("dashboard.chartEmptyHint")}</p>
54 </div>56 </div>
55 }57 }
56 >58 >
src/components/ui/chart-metric-cards.tsxdeleted+0 -72
@@ -1,72 +0,0 @@
1-import { For, Show, type Component } from "solid-js";
2-import { cn } from "@/lib/cn";
3-
4-export type ChartMetricCardItem = {
5- id: string;
6- label: string;
7- value: string | number;
8- change?: string;
9- isPositive?: boolean;
10- subtext?: string;
11- accentColor?: string;
12-};
13-
14-export type ChartMetricCardsProps = {
15- title: string;
16- subtitle?: string;
17- metrics: ChartMetricCardItem[];
18- class?: string;
19-};
20-
21-export const ChartMetricCards: Component<ChartMetricCardsProps> = (props) => {
22- return (
23- <div class={cn("flex flex-col space-y-3 rounded-2xl border border-border/60 bg-card p-4 shadow-xs dark:border-white/8", props.class)}>
24- <div class="space-y-0.5 min-w-0">
25- <h3 class="truncate text-sm font-semibold tracking-tight text-foreground">{props.title}</h3>
26- <Show when={props.subtitle}>
27- <p class="truncate text-xs text-muted-foreground">{props.subtitle}</p>
28- </Show>
29- </div>
30-
31- <div class="grid grid-cols-2 gap-2.5">
32- <For each={props.metrics}>
33- {(m) => (
34- <div class="flex flex-col justify-between rounded-xl border border-border/50 bg-muted/20 p-3 transition-colors hover:bg-muted/40">
35- <div class="flex items-center justify-between gap-1">
36- <span class="truncate text-xs font-medium text-muted-foreground">{m.label}</span>
37- <Show when={m.change}>
38- <span
39- class={cn(
40- "inline-flex items-center gap-1.5 px-1.5 py-0.5 rounded text-[10px] font-semibold mono tabular-nums",
41- m.isPositive !== false
42- ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border border-emerald-500/20"
43- : "bg-rose-500/10 text-rose-600 dark:text-rose-400 border border-rose-500/20",
44- )}
45- >
46- <span
47- class={cn(
48- "h-1.5 w-1.5 rounded-full shrink-0",
49- m.isPositive !== false ? "bg-emerald-500" : "bg-rose-500"
50- )}
51- aria-hidden="true"
52- />
53- {m.change}
54- </span>
55- </Show>
56- </div>
57-
58- <div class="mt-2 flex items-baseline justify-between">
59- <span class="mono tabular-nums text-xl font-bold tracking-tight text-foreground">
60- {m.value}
61- </span>
62- <Show when={m.subtext}>
63- <span class="text-[10px] text-muted-foreground font-medium">{m.subtext}</span>
64- </Show>
65- </div>
66- </div>
67- )}
68- </For>
69- </div>
70- </div>
71- );
72-};
src/components/ui/chart-progress-ring.tsxmodified+4 -2
@@ -1,5 +1,6 @@
1 import { For, Show, type Component } from "solid-js";1 import { For, Show, type Component } from "solid-js";
2 import { cn } from "@/lib/cn";2 import { cn } from "@/lib/cn";
3+import { useT } from "@/stores/preferences-context";
3 4
4 export type ProgressRingSegment = {5 export type ProgressRingSegment = {
5 id: string;6 id: string;
@@ -19,6 +20,7 @@ export type ChartProgressRingProps = {
19 };20 };
20 21
21 export const ChartProgressRing: Component<ChartProgressRingProps> = (props) => {22 export const ChartProgressRing: Component<ChartProgressRingProps> = (props) => {
23+ const t = useT();
22 const calculatedTotal = () => props.total ?? props.segments.reduce((acc, s) => acc + s.value, 0);24 const calculatedTotal = () => props.total ?? props.segments.reduce((acc, s) => acc + s.value, 0);
23 25
24 return (26 return (
@@ -44,8 +46,8 @@ export const ChartProgressRing: Component<ChartProgressRingProps> = (props) => {
44 <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 10.5H21A7.5 7.5 0 0013.5 3v7.5z" />46 <path stroke-linecap="round" stroke-linejoin="round" d="M13.5 10.5H21A7.5 7.5 0 0013.5 3v7.5z" />
45 </svg>47 </svg>
46 </div>48 </div>
47- <p class="text-xs font-semibold text-foreground/80">Kayıt Bulunamadı</p>49+ <p class="text-xs font-semibold text-foreground/80">{t("dashboard.chartEmpty")}</p>
48- <p class="text-[11px] text-muted-foreground mt-0.5">Analiz için henüz yeterli veri eklenmedi</p>50+ <p class="text-[11px] text-muted-foreground mt-0.5">{t("dashboard.chartEmptyHint")}</p>
49 </div>51 </div>
50 }52 }
51 >53 >
src/i18n/messages.tsmodified+410 -2
@@ -21,6 +21,12 @@ export type MessageKey =
21 | "ai.suggest3"21 | "ai.suggest3"
22 | "ai.suggest4"22 | "ai.suggest4"
23 | "nav.home"23 | "nav.home"
24+ | "nav.today"
25+ | "nav.classes"
26+ | "nav.progress"
27+ | "nav.students"
28+ | "nav.children"
29+ | "nav.school"
24 | "nav.notes"30 | "nav.notes"
25 | "nav.events"31 | "nav.events"
26 | "nav.exams"32 | "nav.exams"
@@ -29,6 +35,7 @@ export type MessageKey =
29 | "nav.courses"35 | "nav.courses"
30 | "nav.studies"36 | "nav.studies"
31 | "nav.clubs"37 | "nav.clubs"
38+ | "nav.meals"
32 | "nav.marks"39 | "nav.marks"
33 | "nav.messages"40 | "nav.messages"
34 | "nav.pomodoro"41 | "nav.pomodoro"
@@ -58,6 +65,7 @@ export type MessageKey =
58 | "nav.group.reports"65 | "nav.group.reports"
59 | "nav.group.settings"66 | "nav.group.settings"
60 | "nav.group.community"67 | "nav.group.community"
68+ | "nav.darkMode"
61 | "rightPanel.messagesTitle"69 | "rightPanel.messagesTitle"
62 | "rightPanel.calendarTitle"70 | "rightPanel.calendarTitle"
63 | "rightPanel.openFullMessages"71 | "rightPanel.openFullMessages"
@@ -267,6 +275,51 @@ export type MessageKey =
267 | "dashboard.portal.studentMarksDesc"275 | "dashboard.portal.studentMarksDesc"
268 | "dashboard.portal.settingsDesc"276 | "dashboard.portal.settingsDesc"
269 | "dashboard.portal.termsDesc"277 | "dashboard.portal.termsDesc"
278+ | "dashboard.portal.mealsDesc"
279+ | "dashboard.highlights"
280+ | "dashboard.progressOverview"
281+ | "dashboard.progressOverviewDesc"
282+ | "dashboard.activitySplit"
283+ | "dashboard.activitySplitDesc"
284+ | "dashboard.workloadSplit"
285+ | "dashboard.workloadSplitDesc"
286+ | "dashboard.deadlines"
287+ | "dashboard.classSizes"
288+ | "dashboard.courseAverages"
289+ | "dashboard.chartEmpty"
290+ | "dashboard.chartEmptyHint"
291+ | "dashboard.col.task"
292+ | "dashboard.col.dueDate"
293+ | "dashboard.col.type"
294+ | "dashboard.col.status"
295+ | "dashboard.type.exam"
296+ | "dashboard.type.event"
297+ | "dashboard.type.appointment"
298+ | "dashboard.type.homework"
299+ | "dashboard.stats.attendance"
300+ | "dashboard.stats.homework"
301+ | "dashboard.stats.students"
302+ | "dashboard.stats.children"
303+ | "dashboard.stats.meals"
304+ | "dashboard.stats.appointments"
305+ | "dashboard.attend.present"
306+ | "dashboard.attend.absent"
307+ | "dashboard.attend.late"
308+ | "dashboard.attend.excused"
309+ | "dashboard.welcomeBack"
310+ | "dashboard.welcomeHint"
311+ | "dashboard.refresh"
312+ | "dashboard.col.priority"
313+ | "dashboard.priority.high"
314+ | "dashboard.priority.medium"
315+ | "dashboard.quickReview.title"
316+ | "dashboard.quickReview.subtitle"
317+ | "dashboard.quickReview.placeholder"
318+ | "dashboard.quickReview.practice"
319+ | "dashboard.quickReview.startQuiz"
320+ | "dashboard.questionHubDesc"
321+ | "dashboard.questionHubPlaceholder"
322+ | "dashboard.askQuestion"
270 | "notes.title"323 | "notes.title"
271 | "notes.subtitle"324 | "notes.subtitle"
272 | "notes.new"325 | "notes.new"
@@ -664,6 +717,13 @@ export type MessageKey =
664 | "courses.teacherAssigned"717 | "courses.teacherAssigned"
665 | "courses.teacherUnassigned"718 | "courses.teacherUnassigned"
666 | "courses.noTeachers"719 | "courses.noTeachers"
720+ | "courses.overview"
721+ | "courses.work"
722+ | "courses.people"
723+ | "courses.upcoming"
724+ | "courses.noUpcoming"
725+ | "courses.nextExam"
726+ | "courses.nextHomework"
667 | "homework.title"727 | "homework.title"
668 | "homework.item"728 | "homework.item"
669 | "homework.add"729 | "homework.add"
@@ -794,6 +854,82 @@ export type MessageKey =
794 | "settings.maxFileSize"854 | "settings.maxFileSize"
795 | "settings.maxFileSizeHelp"855 | "settings.maxFileSizeHelp"
796 | "settings.maxFileSizeInvalid"856 | "settings.maxFileSizeInvalid"
857+ | "settings.aiPolicy"
858+ | "settings.aiPolicyHelp"
859+ | "settings.chatHistory"
860+ | "settings.chatThreads"
861+ | "settings.chatMessage"
862+ | "settings.foodPolicy"
863+ | "settings.foodPolicyHelp"
864+ | "settings.mealCutoff"
865+ | "settings.noCutoff"
866+ | "settings.mealSlot"
867+ | "settings.servingTimeUtc"
868+ | "settings.addMealSlot"
869+ | "settings.dietaryTags"
870+ | "settings.addDietaryTag"
871+ | "meals.title"
872+ | "meals.subtitle"
873+ | "meals.publish"
874+ | "meals.publishHelp"
875+ | "meals.date"
876+ | "meals.slot"
877+ | "meals.capacity"
878+ | "meals.from"
879+ | "meals.empty"
880+ | "meals.dishes"
881+ | "meals.conflict"
882+ | "meals.menu"
883+ | "meals.detailHelp"
884+ | "meals.total"
885+ | "meals.cutoff"
886+ | "meals.noCutoff"
887+ | "meals.bookingStatus"
888+ | "meals.closed"
889+ | "meals.open"
890+ | "meals.child"
891+ | "meals.myAccount"
892+ | "meals.service"
893+ | "meals.manage"
894+ | "meals.noDishes"
895+ | "meals.booked"
896+ | "meals.notBooked"
897+ | "meals.cutoffPassed"
898+ | "meals.bookingHelp"
899+ | "meals.book"
900+ | "meals.cancelBooking"
901+ | "meals.cancelSummary"
902+ | "meals.cancelled"
903+ | "meals.dietaryProfile"
904+ | "meals.noDietaryNotes"
905+ | "meals.balance"
906+ | "meals.ledger"
907+ | "meals.ledger.charge"
908+ | "meals.ledger.credit"
909+ | "meals.ledger.reversal"
910+ | "meals.noLedger"
911+ | "meals.attendance"
912+ | "meals.walkIn"
913+ | "meals.served"
914+ | "meals.missed"
915+ | "meals.notMarked"
916+ | "meals.addDish"
917+ | "meals.studentRecord"
918+ | "meals.student"
919+ | "meals.dietaryNote"
920+ | "meals.bookingAudit"
921+ | "meals.recordCredit"
922+ | "meals.creditAppendOnly"
923+ | "meals.amountTry"
924+ | "meals.method"
925+ | "meals.note"
926+ | "meals.creditRecorded"
927+ | "meals.deleteMenu"
928+ | "meals.deleteDish"
929+ | "meals.editMenu"
930+ | "meals.editDish"
931+ | "meals.dishName"
932+ | "meals.priceTry"
797 | "terms.title"933 | "terms.title"
798 | "terms.subtitle"934 | "terms.subtitle"
799 | "terms.create"935 | "terms.create"
@@ -972,6 +1108,12 @@ const en: Dict = {
972 "ai.suggest3": "Do I have any missing homework?",1108 "ai.suggest3": "Do I have any missing homework?",
973 "ai.suggest4": "How is my attendance this term?",1109 "ai.suggest4": "How is my attendance this term?",
974 "nav.home": "Home",1110 "nav.home": "Home",
1111+ "nav.today": "Today",
1112+ "nav.classes": "Classes",
1113+ "nav.progress": "Progress",
1114+ "nav.students": "Students",
1115+ "nav.children": "Children",
1116+ "nav.school": "School",
975 "nav.notes": "Notes",1117 "nav.notes": "Notes",
976 "nav.events": "Events",1118 "nav.events": "Events",
977 "nav.exams": "Exams",1119 "nav.exams": "Exams",
@@ -980,6 +1122,7 @@ const en: Dict = {
980 "nav.courses": "Courses",1122 "nav.courses": "Courses",
981 "nav.studies": "Study sessions",1123 "nav.studies": "Study sessions",
982 "nav.clubs": "Clubs",1124 "nav.clubs": "Clubs",
1125+ "nav.meals": "Meals",
983 "nav.marks": "Report card",1126 "nav.marks": "Report card",
984 "nav.messages": "Messages",1127 "nav.messages": "Messages",
985 "rightPanel.messagesTitle": "Messages",1128 "rightPanel.messagesTitle": "Messages",
@@ -1016,6 +1159,7 @@ const en: Dict = {
1016 "nav.group.reports": "Reports",1159 "nav.group.reports": "Reports",
1017 "nav.group.settings": "Settings",1160 "nav.group.settings": "Settings",
1018 "nav.group.community": "Community",1161 "nav.group.community": "Community",
1162+ "nav.darkMode": "Dark mode",
1019 "nav.myStudents": "My Students",1163 "nav.myStudents": "My Students",
1020 "parents.title": "My Students",1164 "parents.title": "My Students",
1021 "parents.subtitle": "View records for your linked students.",1165 "parents.subtitle": "View records for your linked students.",
@@ -1218,6 +1362,51 @@ const en: Dict = {
1218 "dashboard.portal.studentMarksDesc": "View and grade student results.",1362 "dashboard.portal.studentMarksDesc": "View and grade student results.",
1219 "dashboard.portal.settingsDesc": "System preferences and configuration.",1363 "dashboard.portal.settingsDesc": "System preferences and configuration.",
1220 "dashboard.portal.termsDesc": "Manage academic terms and periods.",1364 "dashboard.portal.termsDesc": "Manage academic terms and periods.",
1365+ "dashboard.portal.mealsDesc": "Menus, bookings, dietary alerts, and meal balance.",
1366+ "dashboard.highlights": "Highlights",
1367+ "dashboard.progressOverview": "Progress overview",
1368+ "dashboard.progressOverviewDesc": "Your performance across courses.",
1369+ "dashboard.activitySplit": "Attendance split",
1370+ "dashboard.activitySplitDesc": "Your attendance breakdown.",
1371+ "dashboard.workloadSplit": "Workload split",
1372+ "dashboard.workloadSplitDesc": "Courses, exams, events, and more.",
1373+ "dashboard.deadlines": "Upcoming deadlines",
1374+ "dashboard.classSizes": "Class sizes",
1375+ "dashboard.courseAverages": "Course averages",
1376+ "dashboard.chartEmpty": "No records found",
1377+ "dashboard.chartEmptyHint": "Not enough data to display yet.",
1378+ "dashboard.col.task": "Task",
1379+ "dashboard.col.dueDate": "Due date",
1380+ "dashboard.col.type": "Type",
1381+ "dashboard.col.status": "Status",
1382+ "dashboard.type.exam": "Exam",
1383+ "dashboard.type.event": "Event",
1384+ "dashboard.type.appointment": "Appointment",
1385+ "dashboard.type.homework": "Homework",
1386+ "dashboard.stats.attendance": "Attendance",
1387+ "dashboard.stats.homework": "Homework",
1388+ "dashboard.stats.students": "Students",
1389+ "dashboard.stats.children": "Children",
1390+ "dashboard.stats.meals": "Meal menus",
1391+ "dashboard.stats.appointments": "Appointments",
1392+ "dashboard.attend.present": "Present",
1393+ "dashboard.attend.absent": "Absent",
1394+ "dashboard.attend.late": "Late",
1395+ "dashboard.attend.excused": "Excused",
1396+ "dashboard.welcomeBack": "Welcome back, {name}!",
1397+ "dashboard.welcomeHint": "Here's what needs your attention today.",
1398+ "dashboard.refresh": "Refresh data",
1399+ "dashboard.col.priority": "Priority",
1400+ "dashboard.priority.high": "High",
1401+ "dashboard.priority.medium": "Medium",
1402+ "dashboard.quickReview.title": "Quick review",
1403+ "dashboard.quickReview.subtitle": "Sharpen your knowledge in 2 minutes!",
1404+ "dashboard.quickReview.placeholder": "Choose a topic to review…",
1405+ "dashboard.quickReview.practice": "Practice",
1406+ "dashboard.quickReview.startQuiz": "Start quiz",
1407+ "dashboard.questionHubDesc": "Browse the question bank or ask a question.",
1408+ "dashboard.questionHubPlaceholder": "Search the question bank…",
1409+ "dashboard.askQuestion": "Ask a question",
1221 "notes.title": "Notebook",1410 "notes.title": "Notebook",
1222 "notes.subtitle": "Private scratchpad for class ideas and reminders.",1411 "notes.subtitle": "Private scratchpad for class ideas and reminders.",
1223 "notes.new": "New note",1412 "notes.new": "New note",
@@ -1688,7 +1877,7 @@ const en: Dict = {
1688 "courses.weight": "Weight",1877 "courses.weight": "Weight",
1689 "courses.delete": "Delete course",1878 "courses.delete": "Delete course",
1690 "courses.kind": "Course type",1879 "courses.kind": "Course type",
1691- "courses.kind.course": "Course",1880+ "courses.kind.course": "Classes",
1692 "courses.kind.study": "Study",1881 "courses.kind.study": "Study",
1693 "courses.kind.club": "Club",1882 "courses.kind.club": "Club",
1694 "courses.capacity": "Capacity",1883 "courses.capacity": "Capacity",
@@ -1700,6 +1889,13 @@ const en: Dict = {
1700 "courses.teacherAssigned": "Teacher assigned successfully.",1889 "courses.teacherAssigned": "Teacher assigned successfully.",
1701 "courses.teacherUnassigned": "Teacher unassigned successfully.",1890 "courses.teacherUnassigned": "Teacher unassigned successfully.",
1702 "courses.noTeachers": "No assigned teachers.",1891 "courses.noTeachers": "No assigned teachers.",
1892+ "courses.overview": "Overview",
1893+ "courses.work": "Work",
1894+ "courses.people": "People",
1895+ "courses.upcoming": "Upcoming work",
1896+ "courses.noUpcoming": "No upcoming work.",
1897+ "courses.nextExam": "Next exam",
1898+ "courses.nextHomework": "Next homework",
1703 "homework.title": "Homework",1899 "homework.title": "Homework",
1704 "homework.item": "Homework",1900 "homework.item": "Homework",
1705 "homework.add": "Add homework",1901 "homework.add": "Add homework",
@@ -1830,6 +2026,82 @@ const en: Dict = {
1830 "settings.maxFileSize": "Max note file size",2026 "settings.maxFileSize": "Max note file size",
1831 "settings.maxFileSizeHelp": "Per-file upload cap for note attachments, in MiB. Backend accepts 0.001-25 MiB.",2027 "settings.maxFileSizeHelp": "Per-file upload cap for note attachments, in MiB. Backend accepts 0.001-25 MiB.",
1832 "settings.maxFileSizeInvalid": "Enter a valid file size.",2028 "settings.maxFileSizeInvalid": "Enter a valid file size.",
2029+ "settings.aiPolicy": "AI policy",
2030+ "settings.aiPolicyHelp": "Limits for conversation context, threads, and message length.",
2031+ "settings.chatHistory": "History turns",
2032+ "settings.chatThreads": "Maximum threads",
2033+ "settings.chatMessage": "Message length",
2034+ "settings.foodPolicy": "Food policy",
2035+ "settings.foodPolicyHelp": "Meal slots use UTC serving times. Empty lists disable the meal program.",
2036+ "settings.mealCutoff": "Booking/cancellation cutoff (minutes)",
2037+ "settings.noCutoff": "No cutoff",
2038+ "settings.mealSlot": "Meal slot",
2039+ "settings.servingTimeUtc": "Serving time (UTC)",
2040+ "settings.addMealSlot": "Add meal slot",
2041+ "settings.dietaryTags": "Dietary tags",
2042+ "settings.addDietaryTag": "Add dietary tag",
2043+ "meals.title": "Meals",
2044+ "meals.subtitle": "Browse menus by date, manage dietary safety, and track meal accounts.",
2045+ "meals.publish": "Publish menu",
2046+ "meals.publishHelp": "One menu per date and meal slot.",
2047+ "meals.date": "Menu date",
2048+ "meals.slot": "Meal slot",
2049+ "meals.capacity": "Capacity",
2050+ "meals.from": "Starting date",
2051+ "meals.empty": "No menus in this date range.",
2052+ "meals.dishes": "dishes",
2053+ "meals.conflict": "Dietary warning",
2054+ "meals.menu": "Menu",
2055+ "meals.detailHelp": "Dishes, booking state, dietary warnings, service, and account records.",
2056+ "meals.total": "Total price",
2057+ "meals.cutoff": "Cutoff",
2058+ "meals.noCutoff": "No cutoff",
2059+ "meals.bookingStatus": "Booking",
2060+ "meals.closed": "Closed",
2061+ "meals.open": "Open",
2062+ "meals.child": "Child",
2063+ "meals.myAccount": "Account",
2064+ "meals.service": "Service register",
2065+ "meals.manage": "Manage",
2066+ "meals.noDishes": "No dishes have been added.",
2067+ "meals.booked": "Booked",
2068+ "meals.notBooked": "Not booked",
2069+ "meals.cutoffPassed": "The booking and cancellation cutoff has passed.",
2070+ "meals.bookingHelp": "The backend confirms capacity, cutoff, conflicts, and price.",
2071+ "meals.book": "Book seat",
2072+ "meals.cancelBooking": "Cancel booking",
2073+ "meals.cancelSummary": "Cancellation releases the seat and appends an exact reversal of the original charge. It is refused after cutoff.",
2074+ "meals.cancelled": "Booking cancelled.",
2075+ "meals.dietaryProfile": "Dietary profile",
2076+ "meals.noDietaryNotes": "No dietary notes recorded.",
2077+ "meals.balance": "Balance",
2078+ "meals.ledger": "Ledger",
2079+ "meals.ledger.charge": "Meal charge",
2080+ "meals.ledger.credit": "Credit",
2081+ "meals.ledger.reversal": "Refund",
2082+ "meals.noLedger": "No ledger entries.",
2083+ "meals.attendance": "Meal attendance",
2084+ "meals.walkIn": "Walk-in",
2085+ "meals.served": "Served",
2086+ "meals.missed": "Missed",
2087+ "meals.notMarked": "Not marked",
2088+ "meals.addDish": "Add dish",
2089+ "meals.studentRecord": "Student meal record",
2090+ "meals.student": "Student",
2091+ "meals.dietaryNote": "Kitchen note",
2092+ "meals.bookingAudit": "Booking audit",
2093+ "meals.recordCredit": "Record credit",
2094+ "meals.creditAppendOnly": "Credits are append-only. Corrections require a compensating entry.",
2095+ "meals.amountTry": "Amount (TRY)",
2096+ "meals.method": "Method",
2097+ "meals.note": "Note",
2098+ "meals.creditRecorded": "Credit recorded.",
2099+ "meals.deleteMenu": "Delete menu",
2100+ "meals.deleteDish": "Delete dish",
2101+ "meals.editMenu": "Edit menu",
2102+ "meals.editDish": "Edit dish",
2103+ "meals.dishName": "Dish name",
2104+ "meals.priceTry": "Price (TRY)",
1833 "terms.title": "Academic terms",2105 "terms.title": "Academic terms",
1834 "terms.subtitle": "Manage calendar terms and assign courses to them.",2106 "terms.subtitle": "Manage calendar terms and assign courses to them.",
1835 "terms.create": "Create term",2107 "terms.create": "Create term",
@@ -1935,6 +2207,12 @@ const tr: Dict = {
1935 "ai.suggest3": "Eksik ödevim var mı?",2207 "ai.suggest3": "Eksik ödevim var mı?",
1936 "ai.suggest4": "Bu dönem devamsızlığım nasıl?",2208 "ai.suggest4": "Bu dönem devamsızlığım nasıl?",
1937 "nav.home": "Ana sayfa",2209 "nav.home": "Ana sayfa",
2210+ "nav.today": "Bugün",
2211+ "nav.classes": "Sınıflar",
2212+ "nav.progress": "İlerleme",
2213+ "nav.students": "Öğrenciler",
2214+ "nav.children": "Çocuklar",
2215+ "nav.school": "Okul",
1938 "nav.notes": "Defter",2216 "nav.notes": "Defter",
1939 "nav.events": "Etkinlikler",2217 "nav.events": "Etkinlikler",
1940 "nav.exams": "Sınavlar",2218 "nav.exams": "Sınavlar",
@@ -1943,6 +2221,7 @@ const tr: Dict = {
1943 "nav.courses": "Ders",2221 "nav.courses": "Ders",
1944 "nav.studies": "Etüt",2222 "nav.studies": "Etüt",
1945 "nav.clubs": "Kulüp",2223 "nav.clubs": "Kulüp",
2224+ "nav.meals": "Yemekler",
1946 "nav.marks": "Karnem",2225 "nav.marks": "Karnem",
1947 "nav.messages": "Mesajlar",2226 "nav.messages": "Mesajlar",
1948 "rightPanel.messagesTitle": "Mesajlar",2227 "rightPanel.messagesTitle": "Mesajlar",
@@ -1979,6 +2258,7 @@ const tr: Dict = {
1979 "nav.group.reports": "Raporlar",2258 "nav.group.reports": "Raporlar",
1980 "nav.group.settings": "Ayarlar",2259 "nav.group.settings": "Ayarlar",
1981 "nav.group.community": "Topluluk",2260 "nav.group.community": "Topluluk",
2261+ "nav.darkMode": "Karanlık mod",
1982 "nav.myStudents": "Öğrencilerim",2262 "nav.myStudents": "Öğrencilerim",
1983 "parents.title": "Öğrencilerim",2263 "parents.title": "Öğrencilerim",
1984 "parents.subtitle": "Size bağlı öğrencilerin akademik kayıtlarını inceleyin.",2264 "parents.subtitle": "Size bağlı öğrencilerin akademik kayıtlarını inceleyin.",
@@ -2181,6 +2461,51 @@ const tr: Dict = {
2181 "dashboard.portal.studentMarksDesc": "Öğrenci sonuçlarını görüntüle ve notlandır.",2461 "dashboard.portal.studentMarksDesc": "Öğrenci sonuçlarını görüntüle ve notlandır.",
2182 "dashboard.portal.settingsDesc": "Sistem tercihleri ve yapılandırma.",2462 "dashboard.portal.settingsDesc": "Sistem tercihleri ve yapılandırma.",
2183 "dashboard.portal.termsDesc": "Akademik dönemleri ve periyotları yönet.",2463 "dashboard.portal.termsDesc": "Akademik dönemleri ve periyotları yönet.",
2464+ "dashboard.portal.mealsDesc": "Menüler, rezervasyonlar, beslenme uyarıları ve bakiye.",
2465+ "dashboard.highlights": "Öne çıkanlar",
2466+ "dashboard.progressOverview": "Performans özeti",
2467+ "dashboard.progressOverviewDesc": "Derslere göre performansın.",
2468+ "dashboard.activitySplit": "Yoklama dağılımı",
2469+ "dashboard.activitySplitDesc": "Yoklama dağılımın.",
2470+ "dashboard.workloadSplit": "İş yükü dağılımı",
2471+ "dashboard.workloadSplitDesc": "Dersler, sınavlar, etkinlikler ve dahası.",
2472+ "dashboard.deadlines": "Yaklaşan son tarihler",
2473+ "dashboard.classSizes": "Sınıf mevcutları",
2474+ "dashboard.courseAverages": "Ders ortalamaları",
2475+ "dashboard.chartEmpty": "Kayıt bulunamadı",
2476+ "dashboard.chartEmptyHint": "Gösterilecek yeterli veri yok.",
2477+ "dashboard.col.task": "Görev",
2478+ "dashboard.col.dueDate": "Son tarih",
2479+ "dashboard.col.type": "Tür",
2480+ "dashboard.col.status": "Durum",
2481+ "dashboard.type.exam": "Sınav",
2482+ "dashboard.type.event": "Etkinlik",
2483+ "dashboard.type.appointment": "Randevu",
2484+ "dashboard.type.homework": "Ödev",
2485+ "dashboard.stats.attendance": "Yoklama",
2486+ "dashboard.stats.homework": "Ödev",
2487+ "dashboard.stats.students": "Öğrenciler",
2488+ "dashboard.stats.children": "Çocuklar",
2489+ "dashboard.stats.meals": "Yemek menüleri",
2490+ "dashboard.stats.appointments": "Randevular",
2491+ "dashboard.attend.present": "Var",
2492+ "dashboard.attend.absent": "Yok",
2493+ "dashboard.attend.late": "Geç",
2494+ "dashboard.attend.excused": "İzinli",
2495+ "dashboard.welcomeBack": "Tekrar hoş geldin, {name}!",
2496+ "dashboard.welcomeHint": "Bugün dikkat etmen gerekenler burada.",
2497+ "dashboard.refresh": "Verileri yenile",
2498+ "dashboard.col.priority": "Öncelik",
2499+ "dashboard.priority.high": "Yüksek",
2500+ "dashboard.priority.medium": "Orta",
2501+ "dashboard.quickReview.title": "Hızlı tekrar",
2502+ "dashboard.quickReview.subtitle": "2 dakikada bilgini tazele!",
2503+ "dashboard.quickReview.placeholder": "Tekrar için konu seç…",
2504+ "dashboard.quickReview.practice": "Alıştır",
2505+ "dashboard.quickReview.startQuiz": "Teste başla",
2506+ "dashboard.questionHubDesc": "Soru havuzuna göz at ya da soru sor.",
2507+ "dashboard.questionHubPlaceholder": "Soru havuzunda ara…",
2508+ "dashboard.askQuestion": "Soru sor",
2184 "notes.title": "Defter",2509 "notes.title": "Defter",
2185 "notes.subtitle": "Ders fikirleri ve hatırlatmalar için özel defter.",2510 "notes.subtitle": "Ders fikirleri ve hatırlatmalar için özel defter.",
2186 "notes.new": "Yeni not",2511 "notes.new": "Yeni not",
@@ -2651,7 +2976,7 @@ const tr: Dict = {
2651 "courses.weight": "Ağırlık",2976 "courses.weight": "Ağırlık",
2652 "courses.delete": "Dersi sil",2977 "courses.delete": "Dersi sil",
2653 "courses.kind": "Ders türü",2978 "courses.kind": "Ders türü",
2654- "courses.kind.course": "Ders",2979+ "courses.kind.course": "Dersler",
2655 "courses.kind.study": "Etüt",2980 "courses.kind.study": "Etüt",
2656 "courses.kind.club": "Kulüp",2981 "courses.kind.club": "Kulüp",
2657 "courses.capacity": "Kapasite",2982 "courses.capacity": "Kapasite",
@@ -2663,6 +2988,13 @@ const tr: Dict = {
2663 "courses.teacherAssigned": "Öğretmen başarıyla atandı.",2988 "courses.teacherAssigned": "Öğretmen başarıyla atandı.",
2664 "courses.teacherUnassigned": "Öğretmen başarıyla çıkarıldı.",2989 "courses.teacherUnassigned": "Öğretmen başarıyla çıkarıldı.",
2665 "courses.noTeachers": "Atanmış öğretmen yok.",2990 "courses.noTeachers": "Atanmış öğretmen yok.",
2991+ "courses.overview": "Genel Bakış",
2992+ "courses.work": "Çalışmalar",
2993+ "courses.people": "Kişiler",
2994+ "courses.upcoming": "Yaklaşan çalışmalar",
2995+ "courses.noUpcoming": "Yaklaşan çalışma yok.",
2996+ "courses.nextExam": "Sıradaki sınav",
2997+ "courses.nextHomework": "Sıradaki ödev",
2666 "homework.title": "Ödevler",2998 "homework.title": "Ödevler",
2667 "homework.item": "Ödev",2999 "homework.item": "Ödev",
2668 "homework.add": "Ödev ekle",3000 "homework.add": "Ödev ekle",
@@ -2793,6 +3125,82 @@ const tr: Dict = {
2793 "settings.maxFileSize": "Not dosyası boyut sınırı",3125 "settings.maxFileSize": "Not dosyası boyut sınırı",
2794 "settings.maxFileSizeHelp": "Not ekleri için dosya başına yükleme sınırı, MiB cinsinden. Backend 0.001-25 MiB kabul eder.",3126 "settings.maxFileSizeHelp": "Not ekleri için dosya başına yükleme sınırı, MiB cinsinden. Backend 0.001-25 MiB kabul eder.",
2795 "settings.maxFileSizeInvalid": "Geçerli bir dosya boyutu gir.",3127 "settings.maxFileSizeInvalid": "Geçerli bir dosya boyutu gir.",
3128+ "settings.aiPolicy": "Yapay zekâ politikası",
3129+ "settings.aiPolicyHelp": "Konuşma bağlamı, konu sayısı ve mesaj uzunluğu sınırları.",
3130+ "settings.chatHistory": "Geçmiş turu",
3131+ "settings.chatThreads": "En fazla konu",
3132+ "settings.chatMessage": "Mesaj uzunluğu",
3133+ "settings.foodPolicy": "Yemek politikası",
3134+ "settings.foodPolicyHelp": "Öğün saatleri UTC girilir. Boş listeler yemek programını kapatır.",
3135+ "settings.mealCutoff": "Rezervasyon/iptal kapanışı (dakika)",
3136+ "settings.noCutoff": "Kapanış yok",
3137+ "settings.mealSlot": "Öğün",
3138+ "settings.servingTimeUtc": "Servis saati (UTC)",
3139+ "settings.addMealSlot": "Öğün ekle",
3140+ "settings.dietaryTags": "Beslenme etiketleri",
3141+ "settings.addDietaryTag": "Beslenme etiketi ekle",
3142+ "meals.title": "Yemekler",
3143+ "meals.subtitle": "Menüleri tarihe göre incele; beslenme güvenliğini ve yemek hesabını takip et.",
3144+ "meals.publish": "Menü yayınla",
3145+ "meals.publishHelp": "Her tarih ve öğün için tek menü.",
3146+ "meals.date": "Menü tarihi",
3147+ "meals.slot": "Öğün",
3148+ "meals.capacity": "Kapasite",
3149+ "meals.from": "Başlangıç tarihi",
3150+ "meals.empty": "Bu tarih aralığında menü yok.",
3151+ "meals.dishes": "yemek",
3152+ "meals.conflict": "Beslenme uyarısı",
3153+ "meals.menu": "Menü",
3154+ "meals.detailHelp": "Yemekler, rezervasyon, beslenme uyarıları, servis ve hesap kayıtları.",
3155+ "meals.total": "Toplam fiyat",
3156+ "meals.cutoff": "Kapanış",
3157+ "meals.noCutoff": "Kapanış yok",
3158+ "meals.bookingStatus": "Rezervasyon",
3159+ "meals.closed": "Kapalı",
3160+ "meals.open": "Açık",
3161+ "meals.child": "Çocuk",
3162+ "meals.myAccount": "Hesap",
3163+ "meals.service": "Servis kaydı",
3164+ "meals.manage": "Yönet",
3165+ "meals.noDishes": "Henüz yemek eklenmedi.",
3166+ "meals.booked": "Rezerve edildi",
3167+ "meals.notBooked": "Rezervasyon yok",
3168+ "meals.cutoffPassed": "Rezervasyon ve iptal süresi geçti.",
3169+ "meals.bookingHelp": "Kapasiteyi, kapanışı, çakışmaları ve fiyatı sunucu doğrular.",
3170+ "meals.book": "Yer ayır",
3171+ "meals.cancelBooking": "Rezervasyonu iptal et",
3172+ "meals.cancelSummary": "İptal yeri serbest bırakır ve ilk ücretin tam ters kaydını ekler. Kapanıştan sonra reddedilir.",
3173+ "meals.cancelled": "Rezervasyon iptal edildi.",
3174+ "meals.dietaryProfile": "Beslenme profili",
3175+ "meals.noDietaryNotes": "Beslenme notu yok.",
3176+ "meals.balance": "Bakiye",
3177+ "meals.ledger": "Hesap hareketleri",
3178+ "meals.ledger.charge": "Yemek ücreti",
3179+ "meals.ledger.credit": "Kredi",
3180+ "meals.ledger.reversal": "İade",
3181+ "meals.noLedger": "Hesap hareketi yok.",
3182+ "meals.attendance": "Yemek katılımı",
3183+ "meals.walkIn": "Rezervasyonsuz",
3184+ "meals.served": "Servis edildi",
3185+ "meals.missed": "Gelmedi",
3186+ "meals.notMarked": "İşaretlenmedi",
3187+ "meals.addDish": "Yemek ekle",
3188+ "meals.studentRecord": "Öğrenci yemek kaydı",
3189+ "meals.student": "Öğrenci",
3190+ "meals.dietaryNote": "Mutfak notu",
3191+ "meals.bookingAudit": "Rezervasyon denetimi",
3192+ "meals.recordCredit": "Kredi kaydet",
3193+ "meals.creditAppendOnly": "Krediler yalnızca eklenir. Düzeltme dengeleyici yeni kayıt gerektirir.",
3194+ "meals.amountTry": "Tutar (TRY)",
3195+ "meals.method": "Yöntem",
3196+ "meals.note": "Not",
3197+ "meals.creditRecorded": "Kredi kaydedildi.",
3198+ "meals.deleteMenu": "Menüyü sil",
3199+ "meals.deleteDish": "Yemeği sil",
3200+ "meals.editMenu": "Menüyü düzenle",
3201+ "meals.editDish": "Yemeği düzenle",
3202+ "meals.dishName": "Yemek adı",
3203+ "meals.priceTry": "Fiyat (TRY)",
2796 "terms.title": "Akademik dönemler",3204 "terms.title": "Akademik dönemler",
2797 "terms.subtitle": "Takvim dönemlerini yönet ve dersleri dönemlere bağla.",3205 "terms.subtitle": "Takvim dönemlerini yönet ve dersleri dönemlere bağla.",
2798 "terms.create": "Dönem oluştur",3206 "terms.create": "Dönem oluştur",
src/index.cssmodified+16 -16
@@ -17,11 +17,11 @@
17 17
18 @theme {18 @theme {
19 --font-sans:19 --font-sans:
20- -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',20+ 'Inter Variable', -apple-system, BlinkMacSystemFont, 'SF Pro Text',
21- 'SF Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;21+ 'Helvetica Neue', Helvetica, Arial, sans-serif;
22 --font-display:22 --font-display:
23- -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',23+ 'Space Grotesk Variable', 'Inter Variable', -apple-system,
24- 'SF Pro', sans-serif;24+ BlinkMacSystemFont, 'SF Pro Display', sans-serif;
25 25
26 --color-border: hsl(var(--border));26 --color-border: hsl(var(--border));
27 --color-input: hsl(var(--input));27 --color-input: hsl(var(--input));
@@ -122,9 +122,9 @@
122 122
123 @utility font-display {123 @utility font-display {
124 font-family:124 font-family:
125- -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',125+ 'Space Grotesk Variable', 'Inter Variable', -apple-system,
126- 'SF Pro', sans-serif;126+ BlinkMacSystemFont, 'SF Pro Display', sans-serif;
127- letter-spacing: -0.015em;127+ letter-spacing: -0.02em;
128 }128 }
129 129
130 @utility glass-header {130 @utility glass-header {
@@ -442,9 +442,9 @@
442 --ui-text-2: 240 5% 35%;442 --ui-text-2: 240 5% 35%;
443 --ui-text-3: 240 4% 52%;443 --ui-text-3: 240 4% 52%;
444 444
445- /* Apple System SF Blue (#007AFF) */445+ /* Knowvio brand orange (#F97316) */
446- --ui-accent: 211 100% 50%;446+ --ui-accent: 24 95% 53%;
447- --ui-accent-muted: 211 90% 94%;447+ --ui-accent-muted: 24 95% 94%;
448 448
449 /* Apple System Status Colors */449 /* Apple System Status Colors */
450 --ui-success: 142 71% 45%;450 --ui-success: 142 71% 45%;
@@ -477,7 +477,7 @@
477 --muted: var(--ui-surface-2);477 --muted: var(--ui-surface-2);
478 --muted-foreground: var(--ui-text-2);478 --muted-foreground: var(--ui-text-2);
479 --accent: var(--ui-accent-muted);479 --accent: var(--ui-accent-muted);
480- --accent-foreground: 211 100% 32%;480+ --accent-foreground: 24 90% 32%;
481 --destructive: var(--ui-danger);481 --destructive: var(--ui-danger);
482 --destructive-foreground: 0 0% 100%;482 --destructive-foreground: 0 0% 100%;
483 --border: var(--ui-border-1);483 --border: var(--ui-border-1);
@@ -504,9 +504,9 @@
504 --ui-text-2: 240 5% 68%;504 --ui-text-2: 240 5% 68%;
505 --ui-text-3: 240 4% 48%;505 --ui-text-3: 240 4% 48%;
506 506
507- /* Electric Dark Accent */507+ /* Knowvio brand orange (dark) */
508- --ui-accent: 217 91% 60%;508+ --ui-accent: 24 95% 58%;
509- --ui-accent-muted: 217 60% 16%;509+ --ui-accent-muted: 24 60% 16%;
510 --ui-success: 142 71% 52%;510 --ui-success: 142 71% 52%;
511 --ui-success-muted: 142 40% 14%;511 --ui-success-muted: 142 40% 14%;
512 --ui-warning: 38 92% 54%;512 --ui-warning: 38 92% 54%;
@@ -517,7 +517,7 @@
517 --ui-info-muted: 199 50% 14%;517 --ui-info-muted: 199 50% 14%;
518 518
519 --primary-foreground: 0 0% 100%;519 --primary-foreground: 0 0% 100%;
520- --accent-foreground: 217 100% 85%;520+ --accent-foreground: 24 100% 80%;
521 --destructive-foreground: 0 0% 100%;521 --destructive-foreground: 0 0% 100%;
522 --sidebar: var(--ui-bg);522 --sidebar: var(--ui-bg);
523 }523 }
@@ -528,7 +528,7 @@
528 528
529 html {529 html {
530 @apply scroll-smooth;530 @apply scroll-smooth;
531- font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "SF Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;531+ font-family: 'Inter Variable', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Helvetica, Arial, sans-serif;
532 -webkit-font-smoothing: antialiased;532 -webkit-font-smoothing: antialiased;
533 -moz-osx-font-smoothing: grayscale;533 -moz-osx-font-smoothing: grayscale;
534 }534 }
src/index.tsxmodified+2 -0
@@ -1,5 +1,7 @@
1 /* @refresh reload */1 /* @refresh reload */
2 import { render } from "solid-js/web";2 import { render } from "solid-js/web";
3+import "@fontsource-variable/inter";
4+import "@fontsource-variable/space-grotesk";
3 import { App } from "@/app";5 import { App } from "@/app";
4 import "@/index.css";6 import "@/index.css";
5 7
src/pages/dashboard-page.tsxmodified+387 -1185
@@ -1,76 +1,93 @@
1-import { For, Match, Show, Switch, createEffect, createMemo, createResource, createSignal, type Component } from "solid-js";1+import { For, Show, Suspense, createMemo, createResource, createSignal, type Component } from "solid-js";
2 import { Link } from "@tanstack/solid-router";2 import { Link } from "@tanstack/solid-router";
3+import type { ColumnDef } from "@tanstack/solid-table";
4+import type { Role } from "@/api/client";
3 import { formatApiError } from "@/api/client";5 import { formatApiError } from "@/api/client";
4-import { getMyStudents } from "@/api/parents";6+import { getAppointments } from "@/api/appointments";
5 import { getCourses } from "@/api/courses";7 import { getCourses } from "@/api/courses";
6 import { getEvents } from "@/api/events";8 import { getEvents } from "@/api/events";
7 import { getExams } from "@/api/exams";9 import { getExams } from "@/api/exams";
8-import { getMyCourses, getMyMarks, getUserAttendance } from "@/api/reports";10+import { getHomework } from "@/api/homework";
9-import { getNotes } from "@/api/notes";11+import { getMealMenus } from "@/api/meals";
12+import { getMyStudents } from "@/api/parents";
13+import { getMyAttendance, getMyCourses, getMyMarks } from "@/api/reports";
10 import { getTime } from "@/api/time/getTime";14 import { getTime } from "@/api/time/getTime";
11-import type { Course, Exam, Event, Role } from "@/api/client";
12 import { RouteGuard } from "@/components/layout/route-guard";15 import { RouteGuard } from "@/components/layout/route-guard";
13-import { Alert } from "@/components/ui/alert";16+import { Badge } from "@/components/ui/badge";
14-import { Button } from "@/components/ui/button";17+import { ChartAreaTrend } from "@/components/ui/chart-area-trend";
18+import { ChartBar } from "@/components/ui/chart-bar";
19+import { ChartProgressRing } from "@/components/ui/chart-progress-ring";
20+import { DataTable } from "@/components/ui/data-table";
15 import {21 import {
22+ IconArchive,
16 IconBook,23 IconBook,
17- IconBriefcase,
18- IconCalendar,
19 IconCalendarDays,24 IconCalendarDays,
20 IconChart,25 IconChart,
21- IconChevronDown,
22- IconChevronUp,
23- IconClock,
24 IconClipboardCheck,26 IconClipboardCheck,
25 IconExam,27 IconExam,
26- IconMessage,28+ IconHelpCircle,
27- IconNote,29+ IconHomework,
28- IconSettings,30+ IconRefresh,
31+ IconSearch,
29 IconUsers,32 IconUsers,
33+ IconUtensils,
30 } from "@/components/ui/icons";34 } from "@/components/ui/icons";
31-import { PaginationControls } from "@/components/ui/pagination-controls";
32 import { PageSpinner } from "@/components/ui/page-spinner";35 import { PageSpinner } from "@/components/ui/page-spinner";
33-import { ChartBar, type ChartBarItem } from "@/components/ui/chart-bar";
34-import { ChartProgressRing, type ProgressRingSegment } from "@/components/ui/chart-progress-ring";
35-import { ChartAreaTrend, type ChartAreaTrendItem } from "@/components/ui/chart-area-trend";
36-import { ChartMetricCards, type ChartMetricCardItem } from "@/components/ui/chart-metric-cards";
37 import type { MessageKey } from "@/i18n/messages";36 import type { MessageKey } from "@/i18n/messages";
38 import { cn } from "@/lib/cn";37 import { cn } from "@/lib/cn";
39-import { createNow } from "@/lib/create-now";
40-import { examKindLabel } from "@/lib/exam-labels";
41-import { examDisplayStatus } from "@/lib/exam-status";
42 import { formatDateTime } from "@/lib/format";38 import { formatDateTime } from "@/lib/format";
43-import { hasMinRole } from "@/lib/roles";
44-import { scheduleStatusClass, scheduleStatusDotClass } from "@/lib/schedule-status";
45 import { useAuth } from "@/stores/auth-context";39 import { useAuth } from "@/stores/auth-context";
46 import { usePreferences, useT } from "@/stores/preferences-context";40 import { usePreferences, useT } from "@/stores/preferences-context";
47 41
48-const WEEK_MS = 7 * 24 * 60 * 60 * 1000;42+const DAY_MS = 24 * 60 * 60 * 1000;
49-const ATTENTION_LIMIT = 8;43+const WEEK_MS = 7 * DAY_MS;
50-const PORTAL_ORDER_KEY = "hezarfen.dashboard.portalOrder";
51 44
52-type AttentionKind = "active" | "soon" | "today";45+type Status = "active" | "today" | "soon";
46+type DeadlineKind = "exam" | "event" | "appointment" | "homework";
53 47
54-type AttentionItem = {48+type DeadlineRow = {
55 id: string;49 id: string;
56- kind: "exam" | "event";50+ kind: DeadlineKind;
57 title: string;51 title: string;
58- at: number | null;52+ at: number;
59- subtitle: string;53+ status: Status;
60- status: AttentionKind;
61- to: "/exams/$id" | "/events/$id";
62 };54 };
63 55
64-type PortalCardDef = {56+type StatCardData = {
65- titleKey: MessageKey;57+ labelKey: MessageKey;
66- to: string;58+ value: string;
67- descKey?: MessageKey;
68 Icon: Component<{ class?: string }>;59 Icon: Component<{ class?: string }>;
69- stat?: string;60+ spark?: number[];
70- minRole?: Role;
71 };61 };
72 62
73-const ROLE_KEY: Record<Role, MessageKey> = {63+// Tiny real-data sparkline; renders nothing when there's no series.
64+function StatSpark(props: { values: number[] }) {
65+ const pts = () => {
66+ const v = props.values;
67+ if (v.length < 2) return "";
68+ const min = Math.min(...v);
69+ const max = Math.max(...v);
70+ const range = max - min || 1;
71+ const w = 64;
72+ const h = 24;
73+ return v
74+ .map((val, i) => {
75+ const x = (i / (v.length - 1)) * w;
76+ const y = h - ((val - min) / range) * h;
77+ return `${x.toFixed(1)},${y.toFixed(1)}`;
78+ })
79+ .join(" ");
80+ };
81+ return (
82+ <Show when={pts()}>
83+ <svg viewBox="0 0 64 24" class="h-6 w-16 shrink-0 overflow-visible" preserveAspectRatio="none">
84+ <polyline points={pts()} fill="none" stroke="hsl(var(--primary))" stroke-width="2" stroke-linejoin="round" stroke-linecap="round" />
85+ </svg>
86+ </Show>
87+ );
88+}
89+
90+const roleKeys: Record<Role, MessageKey> = {
74 student: "role.student",91 student: "role.student",
75 parent: "role.parent",92 parent: "role.parent",
76 teacher: "role.teacher",93 teacher: "role.teacher",
@@ -78,1222 +95,407 @@ const ROLE_KEY: Record<Role, MessageKey> = {
78 admin: "role.admin",95 admin: "role.admin",
79 };96 };
80 97
81-const ROLE_TONE: Record<Role, string> = {98+const kindKeys: Record<DeadlineKind, MessageKey> = {
82- student: "border border-cyan-500/50 bg-muted/40 text-foreground ring-1 ring-cyan-500/30",99+ exam: "dashboard.type.exam",
83- parent: "border border-violet-500/50 bg-muted/40 text-foreground ring-1 ring-violet-500/30",100+ event: "dashboard.type.event",
84- teacher: "border border-emerald-500/50 bg-muted/40 text-foreground ring-1 ring-emerald-500/30",101+ appointment: "dashboard.type.appointment",
85- manager: "border border-amber-500/50 bg-muted/40 text-foreground ring-1 ring-amber-500/30",102+ homework: "dashboard.type.homework",
86- admin: "border border-rose-500/50 bg-muted/40 text-foreground ring-1 ring-rose-500/30",
87 };103 };
88 104
89-function portalTone(to: string) {105+function scheduleStatus(startsAt: number | null, endsAt: number | null, now: number): Status | null {
90- const base = "bg-muted/40 text-muted-foreground shadow-xs transition-all duration-200 group-hover:scale-105 group-hover:text-foreground dark:bg-muted/30 border";106+ if (startsAt == null || (endsAt ?? startsAt) < now) return null;
91- if (to === "/exams") {107+ if (startsAt <= now) return "active";
92- return cn(base, "border-indigo-500/50 dark:border-indigo-400/40 group-hover:border-indigo-500/90 dark:group-hover:border-indigo-400 group-hover:shadow-[0_0_12px_rgba(99,102,241,0.25)]");108+ if (startsAt - now <= DAY_MS) return "today";
93- }109+ if (startsAt - now <= WEEK_MS) return "soon";
94- if (to === "/courses") {110+ return null;
95- return cn(base, "border-cyan-500/50 dark:border-cyan-400/40 group-hover:border-cyan-500/90 dark:group-hover:border-cyan-400 group-hover:shadow-[0_0_12px_rgba(6,182,212,0.25)]");
96- }
97- if (to === "/marks" || to === "/management/student-marks") {
98- return cn(base, "border-amber-500/50 dark:border-amber-400/40 group-hover:border-amber-500/90 dark:group-hover:border-amber-400 group-hover:shadow-[0_0_12px_rgba(245,158,11,0.25)]");
99- }
100- if (to === "/studies") {
101- return cn(base, "border-emerald-500/50 dark:border-emerald-400/40 group-hover:border-emerald-500/90 dark:group-hover:border-emerald-400 group-hover:shadow-[0_0_12px_rgba(16,185,129,0.25)]");
102- }
103- if (to === "/events") {
104- return cn(base, "border-rose-500/50 dark:border-rose-400/40 group-hover:border-rose-500/90 dark:group-hover:border-rose-400 group-hover:shadow-[0_0_12px_rgba(244,63,94,0.25)]");
105- }
106- if (to === "/notes") {
107- return cn(base, "border-purple-500/50 dark:border-purple-400/40 group-hover:border-purple-500/90 dark:group-hover:border-purple-400 group-hover:shadow-[0_0_12px_rgba(168,85,247,0.25)]");
108- }
109- if (to === "/pomodoro" || to === "/management/pomodoros") {
110- return cn(base, "border-red-500/50 dark:border-red-400/40 group-hover:border-red-500/90 dark:group-hover:border-red-400 group-hover:shadow-[0_0_12px_rgba(239,68,68,0.25)]");
111- }
112- if (to === "/clubs") {
113- return cn(base, "border-fuchsia-500/50 dark:border-fuchsia-400/40 group-hover:border-fuchsia-500/90 dark:group-hover:border-fuchsia-400 group-hover:shadow-[0_0_12px_rgba(217,70,239,0.25)]");
114- }
115- if (to === "/messages") {
116- return cn(base, "border-sky-500/50 dark:border-sky-400/40 group-hover:border-sky-500/90 dark:group-hover:border-sky-400 group-hover:shadow-[0_0_12px_rgba(14,165,233,0.25)]");
117- }
118- if (to === "/students") {
119- return cn(base, "border-violet-500/50 dark:border-violet-400/40 group-hover:border-violet-500/90 dark:group-hover:border-violet-400 group-hover:shadow-[0_0_12px_rgba(139,92,246,0.25)]");
120- }
121- if (to === "/admin/users") {
122- return cn(base, "border-pink-500/50 dark:border-pink-400/40 group-hover:border-pink-500/90 dark:group-hover:border-pink-400 group-hover:shadow-[0_0_12px_rgba(236,72,153,0.25)]");
123- }
124- if (to === "/management/student-attendance") {
125- return cn(base, "border-teal-500/50 dark:border-teal-400/40 group-hover:border-teal-500/90 dark:group-hover:border-teal-400 group-hover:shadow-[0_0_12px_rgba(20,184,166,0.25)]");
126- }
127- if (to === "/work") {
128- return cn(base, "border-blue-500/50 dark:border-blue-400/40 group-hover:border-blue-500/90 dark:group-hover:border-blue-400 group-hover:shadow-[0_0_12px_rgba(59,130,246,0.25)]");
129- }
130- if (to === "/management/staff-work") {
131- return cn(base, "border-amber-400/60 dark:border-amber-300/40 group-hover:border-amber-400 dark:group-hover:border-amber-300 group-hover:shadow-[0_0_12px_rgba(251,191,36,0.25)]");
132- }
133- if (to === "/management/terms") {
134- return cn(base, "border-orange-500/50 dark:border-orange-400/40 group-hover:border-orange-500/90 dark:group-hover:border-orange-400 group-hover:shadow-[0_0_12px_rgba(249,115,22,0.25)]");
135- }
136- if (to === "/management/settings") {
137- return cn(base, "border-lime-500/50 dark:border-lime-400/40 group-hover:border-lime-500/90 dark:group-hover:border-lime-400 group-hover:shadow-[0_0_12px_rgba(132,204,22,0.25)]");
138- }
139- return cn(base, "border-primary/50 dark:border-primary/40 group-hover:border-primary");
140-}
141-
142-
143-function examWindow(exam: Exam, now: number): AttentionKind | "upcoming" | "past" | "unscheduled" {
144- const status = examDisplayStatus(exam, now);
145- if (status === "active") return "active";
146- if (status !== "upcoming") return status === "unscheduled" ? "unscheduled" : "past";
147- if (exam.starts_at != null && exam.starts_at > now) {
148- const delta = exam.starts_at - now;
149- if (delta <= 24 * 60 * 60 * 1000) return "today";
150- if (delta <= WEEK_MS) return "soon";
151- return "upcoming";
152- }
153- return "upcoming";
154-}
155-
156-function eventWindow(event: Event, now: number): AttentionKind | "upcoming" | "past" | "unscheduled" {
157- if (event.starts_at == null) return "unscheduled";
158- if (event.ends_at != null && event.ends_at < now) return "past";
159- if (event.starts_at > now) {
160- const delta = event.starts_at - now;
161- if (delta <= 24 * 60 * 60 * 1000) return "today";
162- if (delta <= WEEK_MS) return "soon";
163- return "upcoming";
164- }
165- if (event.ends_at == null || event.ends_at >= now) return "active";
166- return "past";
167 }111 }
168 112
169 export default function DashboardPage() {113 export default function DashboardPage() {
170- return (
171- <RouteGuard>
172- <DashboardContent />
173- </RouteGuard>
174- );
175-}
176-
177-function DashboardContent() {
178 const auth = useAuth();114 const auth = useAuth();
179 const t = useT();115 const t = useT();
180 const { locale } = usePreferences();116 const { locale } = usePreferences();
181- const copy = (tr: string, en: string) => (locale() === "tr" ? tr : en);
182- const countLabel = (count: number, tr: string, en: string) => `${count} ${copy(tr, en)}`;
183- const percentLabel = (value: number) => (locale() === "tr" ? `%${value}` : `${value}%`);
184 const user = () => auth.user()!;117 const user = () => auth.user()!;
185 const role = () => user().role;118 const role = () => user().role;
186- const now = createNow();119+ const [clock, clockQ] = createResource(() => getTime().catch(() => ({ now: Date.now() })));
187- const [portalOrder, setPortalOrder] = createSignal<string[]>([]);120+ const [courses, coursesQ] = createResource(
188- const [previewPortalOrder, setPreviewPortalOrder] = createSignal<string[] | null>(null);121+ () => role() === "parent" ? null : role(),
189- const [draggingPortal, setDraggingPortal] = createSignal<string | null>(null);122+ (currentRole) => currentRole === "student"
190- const [dragOverPortal, setDragOverPortal] = createSignal<string | null>(null);123+ ? getMyCourses({ kind: "course", limit: 12 })
191- const [editingPortalOrder, setEditingPortalOrder] = createSignal(false);124+ : getCourses({ kind: "course", limit: 12 }),
192- const [attentionPage, setAttentionPage] = createSignal(0);
193-
194- const [courses] = createResource(
195- () => (role() !== "student" && role() !== "parent" ? true : null),
196- async (enabled) => (enabled ? getCourses({ limit: 1 }) : null),
197 );125 );
198- const [myCourses] = createResource(126+ const [events, eventsQ] = createResource(
199- () => (role() === "student" ? true : null),127+ () => role() === "parent" ? null : clock()?.now,
200- async (enabled) => {128+ (now) => getEvents({ ends_after: now, limit: 50 }),
201- if (!enabled) return null;
202- try {
203- return await getMyCourses({ limit: 1 });
204- } catch {
205- return null;
206- }
207- },
208 );129 );
209- const [events] = createResource(130+ const [exams, examsQ] = createResource(
210- () => (role() === "parent" ? null : true),131+ () => role() === "parent" ? null : role(),
211- async (enabled) => (enabled ? getEvents({ limit: 1 }) : null),132+ () => getExams({ limit: 50 }),
212 );133 );
213- const [exams] = createResource(134+ const [homework, homeworkQ] = createResource(
214- () => (role() === "parent" ? null : true),135+ () => role() === "parent" ? null : clock()?.now,
215- async (enabled) => (enabled ? getExams({ limit: 1 }) : null),136+ (now) => getHomework({ due_after: now, limit: 50 }),
216 );137 );
217- const [notes] = createResource(138+ const [children, childrenQ] = createResource(
218- () => (role() === "parent" ? null : true),139+ () => role() === "parent" ? true : null,
219- async (enabled) => (enabled ? getNotes({ limit: 1 }) : null),140+ () => getMyStudents({ limit: 12 }),
220 );141 );
221- const [marks] = createResource(142+ const [appointments, appointmentsQ] = createResource(
222- () => (role() === "student" ? true : null),143+ () => role() === "parent" ? true : null,
223- async (enabled) => (enabled ? getMyMarks() : null),144+ () => getAppointments({ limit: 20 }),
224 );145 );
225- const [myStudents] = createResource(146+ const [menus, menusQ] = createResource(
226- () => (role() === "parent" ? true : null),147+ () => clock()?.now,
227- async (enabled) => (enabled ? getMyStudents() : null),148+ (now) => getMealMenus({ from: new Date(now).toISOString().slice(0, 10), limit: 1 }),
228 );149 );
229-150+ const [marks, marksQ] = createResource(
230- const resourceError = createMemo(() => {151+ () => role() === "student" ? true : null,
231- const e = courses.error || myCourses.error || events.error || exams.error || notes.error || marks.error || myStudents.error;152+ () => getMyMarks(),
232- return e ? formatApiError(e, locale()) : null;
233- });
234-
235- const loading = () =>
236- (role() === "student" ? myCourses.loading : courses.loading) ||
237- events.loading ||
238- exams.loading ||
239- notes.loading ||
240- myStudents.loading;
241-
242- const fullName = () => [user().name, user().surname].filter(Boolean).join(" ") || user().username;
243- const hasGlobalScope = createMemo(() => hasMinRole(role(), "admin"));
244- const scopedCourses = createMemo(() => (role() === "student" ? (myCourses()?.items ?? []) : (courses()?.items ?? [])));
245- const scopedCourseIds = createMemo(() => new Set(scopedCourses().map((c) => c.id)));
246-
247- const courseMap = createMemo(() => {
248- const map = new Map<string, string>();
249- for (const course of scopedCourses()) map.set(course.id, course.title);
250- return map;
251- });
252-
253- const visibleExams = createMemo(() => {
254- const all = exams()?.items ?? [];
255- if (hasGlobalScope()) return all;
256- const allowed = scopedCourseIds();
257- if (role() === "student" || role() === "teacher") {
258- if (allowed.size === 0) return [];
259- return all.filter((exam) => allowed.has(exam.course));
260- }
261- return all;
262- });
263-
264- const countCoursesByKind = (kind: Course["kind"]) => scopedCourses().filter((course) => course.kind === kind).length;
265- const courseCount = createMemo(() => countCoursesByKind("course"));
266- const studyCount = createMemo(() => countCoursesByKind("study"));
267- const clubCount = createMemo(() => countCoursesByKind("club"));
268- const examCount = createMemo(() => exams()?.total ?? visibleExams().length);
269- const eventCount = createMemo(() => events()?.total ?? 0);
270- const noteCount = createMemo(() => notes()?.total ?? 0);
271- const studentCount = createMemo(() => myStudents()?.total ?? 0);
272- const [userAttendance] = createResource(
273- () => (role() !== "student" && user()?.id ? user()?.id : null),
274- async (id) => {
275- try {
276- return await getUserAttendance(id);
277- } catch {
278- return null;
279- }
280- }
281 );153 );
282-154+ const [attendance, attendanceQ] = createResource(
283- const realAttendanceRate = createMemo(() => {155+ () => role() === "student" ? true : null,
284- const rep = userAttendance();156+ () => getMyAttendance(),
285- if (!rep) return null;
286- const totalPresent = (rep.events?.present ?? 0) + (rep.sessions?.present ?? 0);
287- const totalAll = (rep.events?.total ?? 0) + (rep.sessions?.total ?? 0);
288- if (totalAll === 0) return null;
289- return Math.round((totalPresent / totalAll) * 100);
290- });
291-
292- const overallAvg = createMemo(() => marks()?.overall_average ?? null);
293- const avgLabel = createMemo(() =>
294- overallAvg() != null ? `${Math.round(overallAvg()! * 10) / 10}` : "—",
295 );157 );
296 158
297- const portalCards = createMemo<PortalCardDef[]>(() => {159+ const [refreshing, setRefreshing] = createSignal(false);
298- const r = role();160+ const refresh = async () => {
299- const cc = String(courseCount());161+ if (refreshing()) return;
300- const sc = String(studyCount());162+ setRefreshing(true);
301- const clc = String(clubCount());163+ try {
302- const ec = String(examCount());164+ await Promise.all(
303- const evc = String(eventCount());165+ [clockQ, coursesQ, eventsQ, examsQ, homeworkQ, childrenQ, appointmentsQ, menusQ, marksQ, attendanceQ]
304- const nc = String(noteCount());166+ .map((q) => q.refetch()),
305- const stc = String(studentCount());
306- const list: PortalCardDef[] = [];
307-
308- if (r === "parent") {
309- list.push(
310- { Icon: IconUsers, titleKey: "nav.myStudents", to: "/students", stat: stc },
311- { Icon: IconMessage, titleKey: "nav.messages", to: "/messages" },
312- );
313- return list;
314- }
315-
316- if (r === "student") {
317- list.push(
318- { Icon: IconExam, titleKey: "nav.exams", to: "/exams", descKey: "dashboard.portal.examsDesc", stat: ec },
319- { Icon: IconBook, titleKey: "nav.courses", to: "/courses", descKey: "dashboard.portal.coursesDesc", stat: cc },
320- { Icon: IconChart, titleKey: "nav.marks", to: "/marks", descKey: "dashboard.portal.marksDesc", stat: avgLabel() },
321- { Icon: IconClock, titleKey: "nav.studies", to: "/studies", descKey: "dashboard.portal.studiesDesc", stat: sc },
322- { Icon: IconCalendar, titleKey: "nav.events", to: "/events", descKey: "dashboard.portal.eventsDesc", stat: evc },
323- { Icon: IconNote, titleKey: "nav.notes", to: "/notes", descKey: "dashboard.portal.notesDesc", stat: nc },
324- { Icon: IconClock, titleKey: "nav.pomodoro", to: "/pomodoro", descKey: "dashboard.portal.pomodoroDesc" },
325- { Icon: IconUsers, titleKey: "nav.clubs", to: "/clubs", descKey: "dashboard.portal.clubsDesc", stat: clc },
326- { Icon: IconMessage, titleKey: "nav.messages", to: "/messages" },
327- );
328- return list;
329- }
330-
331- if (r === "teacher") {
332- list.push(
333- { Icon: IconChart, titleKey: "nav.studentMarks", to: "/management/student-marks", descKey: "dashboard.portal.studentMarksDesc", minRole: "teacher" },
334- { Icon: IconClipboardCheck, titleKey: "nav.studentAttendance", to: "/management/student-attendance", descKey: "dashboard.portal.attendanceDesc", minRole: "teacher" },
335- { Icon: IconBook, titleKey: "nav.courses", to: "/courses", descKey: "dashboard.portal.coursesDesc", stat: cc },
336- { Icon: IconExam, titleKey: "nav.exams", to: "/exams", descKey: "dashboard.portal.examsDesc", stat: ec },
337- { Icon: IconCalendar, titleKey: "nav.events", to: "/events", descKey: "dashboard.portal.eventsDesc", stat: evc, minRole: "teacher" },
338- { Icon: IconClock, titleKey: "nav.studies", to: "/studies", descKey: "dashboard.portal.studiesDesc", stat: sc },
339- { Icon: IconClock, titleKey: "nav.studentPomodoro", to: "/management/pomodoros", descKey: "dashboard.portal.pomodoroDesc", minRole: "teacher" },
340- { Icon: IconBriefcase, titleKey: "nav.work", to: "/work", descKey: "dashboard.portal.workDesc", minRole: "teacher" },
341- { Icon: IconNote, titleKey: "nav.notes", to: "/notes", descKey: "dashboard.portal.notesDesc", stat: nc },
342- { Icon: IconUsers, titleKey: "nav.clubs", to: "/clubs", descKey: "dashboard.portal.clubsDesc", stat: clc },
343- { Icon: IconMessage, titleKey: "nav.messages", to: "/messages" },
344- );
345- return list;
346- }
347-
348- if (r === "manager") {
349- list.push(
350- { Icon: IconBriefcase, titleKey: "nav.staffWork", to: "/management/staff-work", descKey: "dashboard.portal.workDesc", minRole: "manager" },
351- { Icon: IconClipboardCheck, titleKey: "nav.studentAttendance", to: "/management/student-attendance", descKey: "dashboard.portal.attendanceDesc", minRole: "teacher" },
352- { Icon: IconChart, titleKey: "nav.studentMarks", to: "/management/student-marks", descKey: "dashboard.portal.studentMarksDesc", minRole: "teacher" },
353- { Icon: IconBook, titleKey: "nav.courses", to: "/courses", descKey: "dashboard.portal.coursesDesc", stat: cc },
354- { Icon: IconExam, titleKey: "nav.exams", to: "/exams", descKey: "dashboard.portal.examsDesc", stat: ec },
355- { Icon: IconCalendar, titleKey: "nav.events", to: "/events", descKey: "dashboard.portal.eventsDesc", stat: evc },
356- { Icon: IconCalendarDays, titleKey: "nav.terms", to: "/management/terms", descKey: "dashboard.portal.termsDesc", minRole: "manager" },
357- { Icon: IconSettings, titleKey: "nav.settings", to: "/management/settings", descKey: "dashboard.portal.settingsDesc", minRole: "manager" },
358- { Icon: IconClock, titleKey: "nav.studies", to: "/studies", descKey: "dashboard.portal.studiesDesc", stat: sc },
359- { Icon: IconUsers, titleKey: "nav.clubs", to: "/clubs", descKey: "dashboard.portal.clubsDesc", stat: clc },
360- { Icon: IconClock, titleKey: "nav.studentPomodoro", to: "/management/pomodoros", descKey: "dashboard.portal.pomodoroDesc", minRole: "teacher" },
361- { Icon: IconBriefcase, titleKey: "nav.work", to: "/work", descKey: "dashboard.portal.workDesc", minRole: "teacher" },
362- { Icon: IconMessage, titleKey: "nav.messages", to: "/messages" },
363- { Icon: IconNote, titleKey: "nav.notes", to: "/notes", descKey: "dashboard.portal.notesDesc", stat: nc },
364 );167 );
365- return list;168+ } finally {
169+ setRefreshing(false);
366 }170 }
171+ };
367 172
368- // admin173+ const fullName = () => [user().name, user().surname].filter(Boolean).join(" ") || user().username;
369- list.push(174+ const now = () => clock()?.now ?? Date.now();
370- { Icon: IconUsers, titleKey: "nav.users", to: "/admin/users", descKey: "dashboard.portal.usersDesc", minRole: "admin" },175+
371- { Icon: IconSettings, titleKey: "nav.settings", to: "/management/settings", descKey: "dashboard.portal.settingsDesc", minRole: "manager" },176+ const attendanceRate = createMemo(() => {
372- { Icon: IconCalendarDays, titleKey: "nav.terms", to: "/management/terms", descKey: "dashboard.portal.termsDesc", minRole: "manager" },177+ const report = attendance();
373- { Icon: IconBriefcase, titleKey: "nav.staffWork", to: "/management/staff-work", descKey: "dashboard.portal.workDesc", minRole: "manager" },178+ if (!report) return null;
374- { Icon: IconChart, titleKey: "nav.studentMarks", to: "/management/student-marks", descKey: "dashboard.portal.studentMarksDesc", minRole: "teacher" },179+ const total = report.events.total + report.sessions.total;
375- { Icon: IconClipboardCheck, titleKey: "nav.studentAttendance", to: "/management/student-attendance", descKey: "dashboard.portal.attendanceDesc", minRole: "teacher" },180+ const present = report.events.present + report.sessions.present;
376- { Icon: IconBook, titleKey: "nav.courses", to: "/courses", descKey: "dashboard.portal.coursesDesc", stat: cc },181+ return total ? Math.round((present / total) * 100) : null;
377- { Icon: IconExam, titleKey: "nav.exams", to: "/exams", descKey: "dashboard.portal.examsDesc", stat: ec },
378- { Icon: IconCalendar, titleKey: "nav.events", to: "/events", descKey: "dashboard.portal.eventsDesc", stat: evc },
379- { Icon: IconClock, titleKey: "nav.studies", to: "/studies", descKey: "dashboard.portal.studiesDesc", stat: sc },
380- { Icon: IconUsers, titleKey: "nav.clubs", to: "/clubs", descKey: "dashboard.portal.clubsDesc", stat: clc },
381- { Icon: IconClock, titleKey: "nav.studentPomodoro", to: "/management/pomodoros", descKey: "dashboard.portal.pomodoroDesc", minRole: "teacher" },
382- { Icon: IconMessage, titleKey: "nav.messages", to: "/messages" },
383- { Icon: IconNote, titleKey: "nav.notes", to: "/notes", descKey: "dashboard.portal.notesDesc", stat: nc },
384- );
385- return list;
386 });182 });
387- const portalOrderKey = () => `${PORTAL_ORDER_KEY}.${role()}`;
388- const cardsFromOrder = (cards: PortalCardDef[], order: string[]) => {
389- const byId = new Map(cards.map((card) => [card.to, card]));
390- const ordered: PortalCardDef[] = [];
391- const seen = new Set<string>();
392 183
393- for (const id of order) {184+ const capacities = () =>
394- const card = byId.get(id);185+ (courses()?.items ?? []).map((c) => c.capacity).filter((n): n is number => n != null);
395- if (card && !seen.has(id)) {186+ const courseAvgValues = () =>
396- ordered.push(card);187+ (marks()?.courses ?? []).filter((c) => c.average != null).map((c) => c.average!);
397- seen.add(id);188+ const attendanceValues = () => {
398- }189+ const report = attendance();
399- }190+ if (!report) return [];
400-191+ const sum = (k: "present" | "absent" | "late" | "excused") => report.events[k] + report.sessions[k];
401- for (const card of cards) {192+ return [sum("present"), sum("late"), sum("excused"), sum("absent")];
402- if (!seen.has(card.to)) {
403- ordered.push(card);
404- }
405- }
406-
407- return ordered;
408- };
409- const baseOrderedPortalCards = createMemo(() => cardsFromOrder(portalCards(), portalOrder()));
410- const orderedPortalCards = createMemo(() => {
411- const cards = portalCards();
412- const preview = previewPortalOrder();
413- return preview ? cardsFromOrder(cards, preview) : baseOrderedPortalCards();
414- });
415- createEffect(() => {
416- try {
417- setPortalOrder(JSON.parse(window.localStorage.getItem(portalOrderKey()) || "[]") as string[]);
418- } catch {
419- setPortalOrder([]);
420- }
421- });
422- const movePortalCard = (from: string, to: string) => {
423- if (from === to) return;
424- const current = baseOrderedPortalCards().map((card) => card.to);
425- const fromIndex = current.indexOf(from);
426- const toIndex = current.indexOf(to);
427- if (fromIndex >= 0 && toIndex >= 0) {
428- const ids = current.slice();
429- ids.splice(toIndex, 0, ids.splice(fromIndex, 1)[0]);
430- setPortalOrder(ids);
431- setPreviewPortalOrder(null);
432- window.localStorage.setItem(portalOrderKey(), JSON.stringify(ids));
433- }
434- };
435- const moveCardByDelta = (cardTo: string, delta: number) => {
436- const current = baseOrderedPortalCards().map((card) => card.to);
437- const index = current.indexOf(cardTo);
438- if (index < 0) return;
439- const targetIndex = index + delta;
440- if (targetIndex < 0 || targetIndex >= current.length) return;
441- const ids = current.slice();
442- const [item] = ids.splice(index, 1);
443- ids.splice(targetIndex, 0, item);
444- setPortalOrder(ids);
445- setPreviewPortalOrder(null);
446- window.localStorage.setItem(portalOrderKey(), JSON.stringify(ids));
447- };
448- const resetPortalOrder = () => {
449- setPortalOrder([]);
450- setPreviewPortalOrder(null);
451- window.localStorage.removeItem(portalOrderKey());
452 };193 };
453 194
454- const attention = createMemo<AttentionItem[]>(() => {195+ const stats = createMemo<StatCardData[]>(() => {
455- const n = now();196+ const r = role();
456- const items: AttentionItem[] = [];197+ if (r === "student") {
457-198+ return [
458- for (const exam of visibleExams()) {199+ { labelKey: "dashboard.stats.courses", value: String(courses()?.total ?? 0), Icon: IconBook, spark: capacities() },
459- const status = examWindow(exam, n);200+ { labelKey: "dashboard.stats.exams", value: String(exams()?.total ?? 0), Icon: IconExam },
460- if (status === "active" || status === "today" || status === "soon") {201+ { labelKey: "dashboard.stats.average", value: marks()?.overall_average == null ? "—" : marks()!.overall_average!.toFixed(1), Icon: IconChart, spark: courseAvgValues() },
461- items.push({202+ { labelKey: "dashboard.stats.attendance", value: attendanceRate() == null ? "—" : `${attendanceRate()}%`, Icon: IconClipboardCheck, spark: attendanceValues() },
462- id: exam.id,203+ ];
463- kind: "exam",
464- title: exam.title,
465- at: exam.starts_at,
466- subtitle: courseMap().get(exam.course) ?? examKindLabel(String(exam.kind), t),
467- status,
468- to: "/exams/$id",
469- });
470- }
471 }204 }
472-205+ if (r === "teacher") {
473- for (const event of events()?.items ?? []) {206+ return [
474- const status = eventWindow(event, n);207+ { labelKey: "dashboard.stats.courses", value: String(courses()?.total ?? 0), Icon: IconBook, spark: capacities() },
475- if (status === "active" || status === "today" || status === "soon") {208+ { labelKey: "dashboard.stats.exams", value: String(exams()?.total ?? 0), Icon: IconExam },
476- items.push({209+ { labelKey: "dashboard.stats.events", value: String(events()?.total ?? 0), Icon: IconCalendarDays },
477- id: event.id,210+ { labelKey: "dashboard.stats.homework", value: String(homework()?.total ?? 0), Icon: IconHomework },
478- kind: "event",211+ ];
479- title: event.title,212+ }
480- at: event.starts_at,213+ if (r === "parent") {
481- subtitle: event.description || t("nav.events"),214+ return [
482- status,215+ { labelKey: "dashboard.stats.children", value: String(children()?.total ?? 0), Icon: IconUsers },
483- to: "/events/$id",216+ { labelKey: "dashboard.stats.appointments", value: String(appointments()?.total ?? 0), Icon: IconCalendarDays },
484- });217+ { labelKey: "dashboard.stats.meals", value: String(menus()?.total ?? 0), Icon: IconUtensils },
485- }218+ ];
486 }219 }
487-
488- const rank: Record<AttentionKind, number> = { active: 0, today: 1, soon: 2 };
489- return items
490- .sort((a, b) => {
491- const r = rank[a.status] - rank[b.status];
492- if (r !== 0) return r;
493- return (a.at ?? Number.MAX_SAFE_INTEGER) - (b.at ?? Number.MAX_SAFE_INTEGER);
494- });
495- });
496-
497- const [attentionFilter, setAttentionFilter] = createSignal<"all" | "exam" | "event">("all");
498-
499- const filteredAttention = createMemo(() => {
500- const filter = attentionFilter();
501- if (filter === "all") return attention();
502- return attention().filter((item) => item.kind === filter);
503- });
504-
505- const attentionTotalPages = createMemo(() => Math.max(1, Math.ceil(filteredAttention().length / ATTENTION_LIMIT)));
506- const pagedAttention = createMemo(() => {
507- const start = attentionPage() * ATTENTION_LIMIT;
508- return filteredAttention().slice(start, start + ATTENTION_LIMIT);
509- });
510-
511- const courseMarkItems = createMemo<ChartBarItem[]>(() => {
512- const list = marks()?.courses ?? [];
513- return list.map((c) => ({
514- id: c.course.id,
515- label: c.course.title,
516- value: c.average ?? 0,
517- max: 100,
518- formattedValue: c.average != null ? `${Math.round(c.average * 10) / 10}` : "—",
519- colorClass: (c.average ?? 0) >= 70 ? "bg-emerald-500" : (c.average ?? 0) >= 50 ? "bg-amber-500" : "bg-rose-500",
520- }));
521- });
522-
523- const scheduleTimeItems = createMemo<ChartBarItem[]>(() => {
524- const items = attention();
525- const activeCount = items.filter((i) => i.status === "active").length;
526- const todayCount = items.filter((i) => i.status === "today").length;
527- const soonCount = items.filter((i) => i.status === "soon").length;
528 return [220 return [
529- { id: "active", label: copy("Aktif Program", "Active schedule"), value: activeCount, colorClass: "bg-emerald-500" },221+ { labelKey: "dashboard.stats.courses", value: String(courses()?.total ?? 0), Icon: IconBook, spark: capacities() },
530- { id: "today", label: copy("Bugünkü Sınav / Etkinlik", "Today exams / events"), value: todayCount, colorClass: "bg-amber-500" },222+ { labelKey: "dashboard.stats.exams", value: String(exams()?.total ?? 0), Icon: IconExam },
531- { id: "soon", label: copy("Yakında (7 Gün İçi)", "Next 7 days"), value: soonCount, colorClass: "bg-indigo-500" },223+ { labelKey: "dashboard.stats.events", value: String(events()?.total ?? 0), Icon: IconCalendarDays },
224+ { labelKey: "dashboard.stats.meals", value: String(menus()?.total ?? 0), Icon: IconUtensils },
532 ];225 ];
533 });226 });
534 227
535- const scheduleSegments = createMemo<ProgressRingSegment[]>(() => {228+ // Progress panel — student: per-course averages; teacher/manager/admin: class sizes.
536- const items = attention();229+ const courseAverages = createMemo(() =>
537- const active = items.filter((i) => i.status === "active").length;230+ (marks()?.courses ?? [])
538- const today = items.filter((i) => i.status === "today").length;231+ .filter((c) => c.average != null)
539- const soon = items.filter((i) => i.status === "soon").length;232+ .map((c) => ({ label: c.course.title, value: c.average!, formattedValue: c.average!.toFixed(1) })),
233+ );
234+ const classSizes = createMemo(() =>
235+ (courses()?.items ?? [])
236+ .filter((c) => c.capacity != null)
237+ .map((c) => ({ id: c.id, label: c.title, value: c.capacity! })),
238+ );
239+
240+ // Weekly activity split — student attendance breakdown (events + sessions).
241+ const attendanceSegments = createMemo(() => {
242+ const report = attendance();
243+ if (!report) return [];
244+ const sum = (k: "present" | "absent" | "late" | "excused") => report.events[k] + report.sessions[k];
540 return [245 return [
541- { id: "active", label: copy("Aktif", "Active"), value: active, colorClass: "bg-emerald-500" },246+ { id: "present", label: t("dashboard.attend.present"), value: sum("present"), colorClass: "bg-emerald-500" },
542- { id: "today", label: copy("Bugün", "Today"), value: today, colorClass: "bg-amber-500" },247+ { id: "absent", label: t("dashboard.attend.absent"), value: sum("absent"), colorClass: "bg-rose-500" },
543- { id: "soon", label: copy("Yakında", "Upcoming"), value: soon, colorClass: "bg-indigo-500" },248+ { id: "late", label: t("dashboard.attend.late"), value: sum("late"), colorClass: "bg-amber-500" },
249+ { id: "excused", label: t("dashboard.attend.excused"), value: sum("excused"), colorClass: "bg-muted-foreground/40" },
544 ];250 ];
545 });251 });
546 252
547- const weeklyDensityItems = createMemo<ChartBarItem[]>(() => {253+ // Right-side "workload split" for non-student roles — real resource totals.
548- const days: { id: string; label: string; count: number }[] = [];254+ const workloadSegments = createMemo(() => {
549- const today = new Date();255+ const r = role();
550- const dayNames = locale() === "tr" ? ["Pzr", "Pzt", "Sal", "Çrş", "Prş", "Cum", "Cmt"] : ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];256+ const base = [
551-257+ { id: "courses", label: t("nav.classes"), value: courses()?.total ?? 0, colorClass: "bg-primary" },
552- for (let i = 0; i < 7; i++) {258+ { id: "exams", label: t("nav.exams"), value: exams()?.total ?? 0, colorClass: "bg-blue-500" },
553- const d = new Date(today);259+ { id: "events", label: t("nav.events"), value: events()?.total ?? 0, colorClass: "bg-emerald-500" },
554- d.setDate(today.getDate() + i);260+ ];
555- const dayStart = new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();261+ if (r === "teacher") {
556- const dayEnd = dayStart + 86400000;262+ return [...base, { id: "homework", label: t("nav.homework"), value: homework()?.total ?? 0, colorClass: "bg-rose-500" }];
557- const dayLabel = i === 0 ? copy("Bugün", "Today") : `${dayNames[d.getDay()]} ${d.getDate()}`;
558-
559- let count = 0;
560- for (const exam of visibleExams()) {
561- if (exam.starts_at != null && exam.starts_at >= dayStart && exam.starts_at < dayEnd) {
562- count++;
563- }
564- }
565- for (const event of events()?.items ?? []) {
566- if (event.starts_at != null && event.starts_at >= dayStart && event.starts_at < dayEnd) {
567- count++;
568- }
569- }
570- // Include active weekday schedule baseline for rich platform activity curve
571- if (count === 0 && d.getDay() !== 0 && d.getDay() !== 6) {
572- count = (d.getDay() % 3) + 2;
573- }
574-
575- days.push({
576- id: `day-${i}`,
577- label: dayLabel,
578- count,
579- });
580 }263 }
581-264+ return [...base, { id: "meals", label: t("nav.meals"), value: menus()?.total ?? 0, colorClass: "bg-rose-500" }];
582- return days.map((d) => ({
583- id: d.id,
584- label: d.label,
585- value: d.count,
586- formattedValue: `${d.count} ${copy("Aktivite", "activities")}`,
587- colorClass: d.count > 0 ? "bg-emerald-500" : "bg-muted-foreground/30",
588- }));
589 });265 });
590 266
591- const studentGradeTrendItems = createMemo<ChartAreaTrendItem[]>(() => {267+ const deadlines = createMemo<DeadlineRow[]>(() => {
592- const report = marks();268+ const items: DeadlineRow[] = [];
593- if (!report || !report.courses || report.courses.length === 0) {269+ for (const exam of exams()?.items ?? []) {
594- return [];270+ const status = scheduleStatus(exam.starts_at, exam.ends_at, now());
271+ if (status) items.push({ id: exam.id, kind: "exam", title: exam.title, at: exam.starts_at!, status });
595 }272 }
596-273+ for (const event of events()?.items ?? []) {
597- const entries: { label: string; value: number }[] = [];274+ const status = scheduleStatus(event.starts_at, event.ends_at, now());
598- for (const c of report.courses) {275+ if (status) items.push({ id: event.id, kind: "event", title: event.title, at: event.starts_at!, status });
599- for (const r of c.results ?? []) {
600- if (r.mark != null) {
601- entries.push({
602- label: r.title,
603- value: r.mark,
604- });
605- }
606- }
607 }276 }
608-277+ for (const hw of homework()?.items ?? []) {
609- if (entries.length === 0) {278+ const status = scheduleStatus(hw.due_at, hw.due_at, now());
610- const courseWithAvg = report.courses.filter((c) => c.average != null);279+ if (status) items.push({ id: hw.id, kind: "homework", title: hw.title, at: hw.due_at, status });
611- if (courseWithAvg.length === 0) return [];
612- return courseWithAvg.map((c) => ({
613- label: c.course.title,
614- value: c.average!,
615- formattedValue: `${Math.round(c.average! * 10) / 10} ${copy("Puan", "points")}`,
616- }));
617 }280 }
618-281+ for (const appointment of appointments()?.items ?? []) {
619- return entries.slice(-6).map((e) => ({282+ if (appointment.starts_at == null || !["pending", "approved"].includes(appointment.status)) continue;
620- label: e.label,283+ const status = scheduleStatus(appointment.starts_at, appointment.ends_at, now());
621- value: e.value,284+ if (status) {
622- formattedValue: `${Math.round(e.value * 10) / 10} ${copy("Puan", "points")}`,285+ const person = appointment.teacher?.display_name || appointment.teacher?.username || t("nav.appointments");
623- }));286+ items.push({ id: appointment.id, kind: "appointment", title: person, at: appointment.starts_at, status });
624- });287+ }
625-
626- const studentMetricCards = createMemo<ChartMetricCardItem[]>(() => {
627- const avg = overallAvg();
628- const att = realAttendanceRate();
629- return [
630- {
631- id: "gpa",
632- label: copy("Not Ortalaması", "Average grade"),
633- value: avgLabel() === "—" ? copy("Kayıt yok", "No records") : avgLabel(),
634- change: avg != null ? (avg >= 70 ? copy("Yüksek", "High") : copy("Normal", "Normal")) : undefined,
635- isPositive: avg != null ? avg >= 50 : true,
636- subtext: copy("Genel ders başarı ortalaması", "Overall course average"),
637- },
638- {
639- id: "attendance",
640- label: copy("Derse Katılım", "Attendance"),
641- value: att != null ? percentLabel(att) : copy("Kayıt yok", "No records"),
642- change: att != null ? (att >= 85 ? copy("Düzenli", "Regular") : copy("Takip Edilmeli", "Needs attention")) : undefined,
643- isPositive: att != null ? att >= 85 : true,
644- subtext: copy("Devamlılık oranı", "Attendance rate"),
645- },
646- {
647- id: "notes",
648- label: copy("Ders Notları", "Course notes"),
649- value: noteCount() > 0 ? countLabel(noteCount(), "Not", "notes") : copy("Kayıt yok", "No records"),
650- subtext: copy("Kayıtlı notlar", "Saved notes"),
651- },
652- {
653- id: "courses",
654- label: copy("Kayıtlı Dersler", "Enrolled courses"),
655- value: scopedCourses().length > 0 ? countLabel(scopedCourses().length, "Ders", "courses") : copy("Kayıt yok", "No records"),
656- subtext: copy("Aktif müfredat programı", "Active curriculum"),
657- },
658- ];
659- });
660-
661- const teacherMetricCards = createMemo<ChartMetricCardItem[]>(() => {
662- const att = realAttendanceRate();
663- return [
664- { id: "avgMark", label: copy("Sınıf Not Ortalaması", "Class average"), value: "78.4", change: "+1.5%", isPositive: true, subtext: copy("Sorumlu sınıflar", "Assigned classes") },
665- {
666- id: "attRate",
667- label: copy("Sınıf Katılım Oranı", "Class attendance rate"),
668- value: att != null ? percentLabel(att) : copy("Kayıt yok", "No records"),
669- change: att != null ? (att >= 85 ? copy("Yüksek", "High") : copy("Takip Edilmeli", "Needs attention")) : undefined,
670- isPositive: att != null ? att >= 85 : true,
671- subtext: copy("Ortalama devam", "Average attendance"),
672- },
673- { id: "activeExams", label: copy("Sınav Sayısı", "Exam count"), value: countLabel(examCount(), "Sınav", "exams"), subtext: copy("Okunan ve canlı", "Graded and live") },
674- { id: "myCourses", label: copy("Verilen Dersler", "Assigned courses"), value: countLabel(scopedCourses().length, "Ders", "courses"), subtext: copy("Aktif ders yükü", "Active teaching load") },
675- ];
676- });
677-
678- const managerMetricCards = createMemo<ChartMetricCardItem[]>(() => {
679- const att = realAttendanceRate();
680- return [
681- { id: "schoolAvg", label: copy("Okul Başarı Ortalaması", "School average"), value: "81.2", change: "+2.4%", isPositive: true, subtext: copy("Kurum ortalaması", "Institution average") },
682- {
683- id: "overallAtt",
684- label: copy("Genel Devamlılık", "Overall attendance"),
685- value: att != null ? percentLabel(att) : copy("Kayıt yok", "No records"),
686- change: att != null ? (att >= 85 ? copy("Yüksek", "High") : copy("Takip Edilmeli", "Needs attention")) : undefined,
687- isPositive: att != null ? att >= 85 : true,
688- subtext: copy("Tüm sınıflar", "All classes"),
689- },
690- { id: "staffWork", label: copy("Personel Mesai", "Staff work"), value: "88.0%", subtext: copy("Tamamlanan vardiya", "Completed shifts") },
691- { id: "totalPrograms", label: copy("Program Sayısı", "Program count"), value: countLabel(courseCount() + studyCount() + clubCount(), "Program", "programs"), subtext: copy("Ders, etüt, kulüp", "Courses, studies, clubs") },
692- ];
693- });
694-
695- const teacherCourseStats = createMemo<ChartBarItem[]>(() => {
696- const list = scopedCourses();
697- if (list.length === 0) {
698- return [
699- { id: "c1", label: "Matematik 10-A", value: 84, max: 100, formattedValue: "84.0", colorClass: "bg-emerald-500" },
700- { id: "c2", label: "Fizik 11-B", value: 76, max: 100, formattedValue: "76.5", colorClass: "bg-emerald-500" },
701- { id: "c3", label: "Geometri 9-C", value: 68, max: 100, formattedValue: "68.0", colorClass: "bg-amber-500" },
702- ];
703 }288 }
704- return list.map((c) => ({289+ return items.sort((a, b) => a.at - b.at);
705- id: c.id,
706- label: c.title,
707- value: 78,
708- max: 100,
709- formattedValue: "78.0",
710- colorClass: "bg-emerald-500",
711- }));
712- });
713-
714- const teacherExamStatusSegments = createMemo<ProgressRingSegment[]>(() => {
715- const total = visibleExams().length;
716- const active = visibleExams().filter((e) => examWindow(e, now()) === "active").length;
717- return [
718- { id: "graded", label: copy("Değerlendirildi", "Graded"), value: Math.max(1, Math.ceil(total * 0.6)), colorClass: "bg-emerald-500" },
719- { id: "pending", label: copy("Okuma Bekliyor", "Awaiting grading"), value: Math.max(1, Math.floor(total * 0.4)), colorClass: "bg-amber-500" },
720- { id: "active", label: copy("Canlı Sınav", "Live exam"), value: active, colorClass: "bg-indigo-500" },
721- ];
722- });
723-
724- const managerCourseKindItems = createMemo<ChartBarItem[]>(() => [
725- { id: "courses", label: copy("Ders Programları", "Courses"), value: courseCount(), formattedValue: countLabel(courseCount(), "ders", "courses"), colorClass: "bg-emerald-500" },
726- { id: "studies", label: copy("Etüt Seansları", "Study sessions"), value: studyCount(), formattedValue: countLabel(studyCount(), "etüt", "study sessions"), colorClass: "bg-amber-500" },
727- { id: "clubs", label: copy("Sosyal Kulüpler", "Clubs"), value: clubCount(), formattedValue: countLabel(clubCount(), "kulüp", "clubs"), colorClass: "bg-indigo-500" },
728- ]);
729-
730- const managerStaffWorkSegments = createMemo<ProgressRingSegment[]>(() => [
731- { id: "completed", label: copy("Tamamlanan Mesai", "Completed work"), value: 42, colorClass: "bg-emerald-500" },
732- { id: "active", label: copy("Devam Eden Vardiya", "Active shifts"), value: 8, colorClass: "bg-indigo-500" },
733- { id: "pending", label: copy("Planlanan Görev", "Planned tasks"), value: 6, colorClass: "bg-amber-500" },
734- ]);
735-
736- const adminUserRoleItems = createMemo<ChartBarItem[]>(() => [
737- { id: "students", label: copy("Öğrenciler", "Students"), value: 140, formattedValue: countLabel(140, "kişi", "people"), colorClass: "bg-emerald-500" },
738- { id: "teachers", label: copy("Öğretmenler", "Teachers"), value: 24, formattedValue: countLabel(24, "kişi", "people"), colorClass: "bg-indigo-500" },
739- { id: "parents", label: copy("Veliler", "Parents"), value: 110, formattedValue: countLabel(110, "kişi", "people"), colorClass: "bg-sky-500" },
740- { id: "managers", label: copy("Yöneticiler", "Managers"), value: 6, formattedValue: countLabel(6, "kişi", "people"), colorClass: "bg-amber-500" },
741- { id: "admins", label: copy("Sistem Adminleri", "System admins"), value: 2, formattedValue: countLabel(2, "kişi", "people"), colorClass: "bg-purple-500" },
742- ]);
743-
744- const adminSystemCapacitySegments = createMemo<ProgressRingSegment[]>(() => [
745- { id: "courses", label: copy("Aktif Dersler", "Active courses"), value: courseCount(), colorClass: "bg-emerald-500" },
746- { id: "exams", label: copy("Sınav Kayıtları", "Exam records"), value: examCount(), colorClass: "bg-amber-500" },
747- { id: "events", label: copy("Etkinlikler", "Events"), value: eventCount(), colorClass: "bg-indigo-500" },
748- ]);
749-
750- const [serverPing, setServerPing] = createSignal<{ latency: number; status: string } | null>(null);
751-
752- createEffect(() => {
753- const t0 = performance.now();
754- getTime()
755- .then(() => {
756- const latency = Math.max(1, Math.round(performance.now() - t0));
757- setServerPing({ latency, status: "reachable" });
758- })
759- .catch(() => {
760- setServerPing({ latency: 0, status: "offline" });
761- });
762 });290 });
763 291
764- const adminMetricCards = createMemo<ChartMetricCardItem[]>(() => [292+ const headerClass = "text-xs font-medium text-muted-foreground";
765- { id: "users", label: copy("Aktif Kullanıcılar", "Active users"), value: "282", change: copy("+12 bu ay", "+12 this month"), isPositive: true, subtext: copy("Platform geneli", "Platform-wide") },293+ const deadlineColumns = createMemo<ColumnDef<DeadlineRow>[]>(() => [
294+ {
295+ accessorKey: "title",
296+ header: t("dashboard.col.task"),
297+ enableSorting: false,
298+ meta: { headerClass },
299+ cell: (info) => <span class="font-medium">{info.row.original.title}</span>,
300+ },
301+ {
302+ accessorKey: "kind",
303+ header: t("dashboard.col.type"),
304+ enableSorting: false,
305+ meta: { headerClass },
306+ cell: (info) => <span class="text-muted-foreground">{t(kindKeys[info.row.original.kind])}</span>,
307+ },
308+ {
309+ accessorKey: "at",
310+ header: t("dashboard.col.dueDate"),
311+ enableSorting: false,
312+ meta: { headerClass },
313+ cell: (info) => <span class="tabular-nums text-muted-foreground">{formatDateTime(info.row.original.at, locale())}</span>,
314+ },
315+ {
316+ accessorKey: "status",
317+ header: t("dashboard.col.status"),
318+ enableSorting: false,
319+ meta: { headerClass },
320+ cell: (info) => {
321+ const s = info.row.original.status;
322+ return (
323+ <Badge variant="outline" class="rounded-full text-[10px]">
324+ <span class={cn("mr-1.5 inline-block h-1.5 w-1.5 rounded-full", s === "active" ? "bg-emerald-500" : s === "today" ? "bg-amber-500" : "bg-muted-foreground/50")} />
325+ {s === "active" ? t("dashboard.activeNow") : s === "today" ? t("dashboard.today") : t("dashboard.soon")}
326+ </Badge>
327+ );
328+ },
329+ },
766 {330 {
767- id: "uptime",331+ id: "priority",
768- label: copy("Sunucu Yanıt Süresi", "Server response time"),332+ header: t("dashboard.col.priority"),
769- value: serverPing() ? `${serverPing()!.latency} ms` : "—",333+ enableSorting: false,
770- change: serverPing() ? serverPing()!.status === "reachable" ? copy("Erişilebilir", "Reachable") : copy("Çevrimdışı", "Offline") : copy("Ölçülüyor", "Measuring"),334+ meta: { headerClass },
771- isPositive: serverPing()?.status === "reachable",335+ cell: (info) => {
772- subtext: copy("Canlı ping", "Live ping"),336+ const high = info.row.original.status !== "soon";
337+ return (
338+ <span class={cn("text-xs font-semibold", high ? "text-rose-600 dark:text-rose-400" : "text-amber-600 dark:text-amber-400")}>
339+ {high ? t("dashboard.priority.high") : t("dashboard.priority.medium")}
340+ </span>
341+ );
342+ },
773 },343 },
774- { id: "courses", label: copy("Aktif Ders Kaydı", "Active course records"), value: String(courseCount()), subtext: copy("Müfredat dersi", "Curriculum courses") },
775- { id: "exams", label: copy("Sınav Havuzu", "Exam pool"), value: String(examCount()), subtext: copy("Tüm sınavlar", "All exams") },
776 ]);344 ]);
777 345
778- const [showAllPortals, setShowAllPortals] = createSignal(false);346+ const deadlineSearch = (row: DeadlineRow, q: string) => row.title.toLowerCase().includes(q.toLowerCase());
779 347
780- const displayPortalCards = createMemo(() => {348+ const error = createMemo(() => {
781- const cards = orderedPortalCards();349+ const problem = courses.error || events.error || exams.error || homework.error || children.error || appointments.error || menus.error || marks.error || attendance.error;
782- if (editingPortalOrder() || showAllPortals() || cards.length <= 8) {350+ return problem ? formatApiError(problem, locale()) : "";
783- return cards;
784- }
785- return cards.slice(0, 8);
786 });351 });
787 352
788 return (353 return (
789- <div class="overflow-hidden rounded-[1.75rem] border border-[#F2F2F3] bg-background shadow-apple dark:border-white/8 dark:bg-background">354+ <RouteGuard>
790- <header class="flex flex-wrap items-end justify-between gap-3 border-b border-[#F2F2F3] bg-card/85 px-4 py-4 backdrop-blur-xl dark:border-white/8 sm:px-5">355+ <div class="space-y-5">
791- <div class="min-w-0 space-y-1">356+ <header class="flex flex-wrap items-end justify-between gap-3">
792- <p class="text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground">{t("dashboard.today")}</p>357+ <div class="space-y-1">
793- <h1 class="truncate font-display text-xl font-semibold tracking-tight text-foreground sm:text-2xl">358+ <h1 class="font-display text-2xl font-semibold tracking-tight">{t("dashboard.welcomeBack", { name: fullName() })}</h1>
794- {t("dashboard.greeting", { name: fullName() })}359+ <p class="text-sm text-muted-foreground">{t("dashboard.welcomeHint")}</p>
795- </h1>360+ </div>
796- <p class="text-sm text-muted-foreground">{t("dashboard.observationOnly")}</p>361+ <div class="flex items-center gap-2">
797- </div>362+ <Badge variant="outline" class="rounded-full bg-muted/40">{t(roleKeys[role()])}</Badge>
798- <div class="flex flex-wrap items-center gap-2 text-xs text-muted-foreground">363+ <time class="text-sm tabular-nums text-muted-foreground">
799- <span class={cn("rounded-full border px-2.5 py-1 font-semibold shadow-xs", ROLE_TONE[role()])}>364+ {new Intl.DateTimeFormat(locale() === "tr" ? "tr-TR" : "en-GB", { dateStyle: "medium" }).format(now())}
800- {t(ROLE_KEY[role()])}365+ </time>
801- </span>366+ </div>
802- <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-xs">367+ </header>
803- <span class="h-2 w-2 rounded-full bg-emerald-500 shadow-[0_0_0_3px_rgba(16,185,129,0.14)]" aria-hidden="true" />
804- {formatDateTime(now(), locale()).split(",")[0]}
805- </span>
806- </div>
807- </header>
808-
809- <Show when={resourceError()}>
810- {(msg) => <div class="px-4 pt-4 sm:px-5"><Alert variant="destructive">{msg()}</Alert></div>}
811- </Show>
812-
813- <Show when={!loading()} fallback={<div class="px-4 py-8"><PageSpinner /></div>}>
814- <div class="space-y-5 bg-muted/10 px-4 py-4 sm:px-5 sm:py-5 dark:bg-black/40">
815-
816- {/* Visual Analytics Panel (4 Distinct Chart Types Grid) */}
817- <Show when={role() !== "parent"}>
818- <section class="grid grid-cols-1 gap-5 lg:grid-cols-2" aria-label={copy("Görsel Analiz ve Raporlar", "Visual analytics and reports")}>
819- <Switch>
820- {/* STUDENT ROLE CHARTS (4 Distinct Types) */}
821- <Match when={role() === "student"}>
822- <ChartMetricCards
823- title={copy("Öğrenim & Katılım KPI Özeti", "Learning and attendance KPI summary")}
824- subtitle={copy("Genel başarı notu, katılım ve not sayıları", "Overall grades, attendance, and note counts")}
825- metrics={studentMetricCards()}
826- />
827-
828- <ChartAreaTrend
829- title={copy("Sınav & Başarı Not Trendi", "Exam and grade trend")}
830- subtitle={copy("Dönem içi sınav notlarının gelişim eğrisi", "Term exam grade trend")}
831- items={studentGradeTrendItems()}
832- unit={copy(" Puan", " points")}
833- minScale={50}
834- maxScale={100}
835- />
836-
837- <Show
838- when={courseMarkItems().length > 0}
839- fallback={
840- <ChartBar
841- title={copy("Sınav & Zaman Çizelgesi Dağılımı", "Exam and schedule distribution")}
842- subtitle={copy("Aktif, bugün ve 7 gün içerisindeki program yoğunluğu", "Active, today, and next 7-day schedule load")}
843- items={scheduleTimeItems()}
844- />
845- }
846- >
847- <ChartBar
848- title={copy("Ders Bazlı Başarı Notları", "Course grade performance")}
849- subtitle={copy("Kayıtlı dersler geneli ortalama puanlar", "Average scores across enrolled courses")}
850- items={courseMarkItems()}
851- maxScale={100}
852- />
853- </Show>
854 368
855- <ChartProgressRing369+ <Suspense fallback={<PageSpinner />}>
856- title={copy("Program & Takip Analizi", "Schedule and tracking analysis")}370+ <Show when={error()}>
857- valueText={`${attention().length}`}371+ <p class="rounded-xl border border-destructive/30 bg-destructive/5 px-4 py-3 text-sm text-destructive">{error()}</p>
858- subtext={copy("yaklaşan ve aktif kayıt", "upcoming and active records")}372+ </Show>
859- subtitle={copy("Durum bazlı zaman çizelgesi oransal göstergesi", "Status-based schedule ratio")}
860- segments={scheduleSegments()}
861- />
862- </Match>
863 373
864- {/* TEACHER ROLE CHARTS (4 Distinct Types) */}374+ <section class="space-y-3" aria-labelledby="highlights-heading">
865- <Match when={role() === "teacher"}>375+ <h2 id="highlights-heading" class="text-sm font-semibold">{t("dashboard.highlights")}</h2>
866- <ChartMetricCards376+ <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4">
867- title={copy("Öğretim & Okuma KPI Özeti", "Teaching and grading KPI summary")}377+ <For each={stats()}>
868- subtitle={copy("Sorumlu dersler, sınavlar ve ortalama katılım", "Assigned courses, exams, and average attendance")}378+ {(stat) => (
869- metrics={teacherMetricCards()}379+ <div class="rounded-2xl border border-border bg-card px-4 py-3.5 shadow-xs">
870- />380+ <div class="flex items-center gap-2">
381+ <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-border bg-muted/30 text-muted-foreground">
382+ <stat.Icon class="h-4 w-4" />
383+ </span>
384+ <p class="min-w-0 flex-1 truncate text-xs font-medium text-muted-foreground">{t(stat.labelKey)}</p>
385+ </div>
386+ <div class="mt-3 flex items-end justify-between gap-2">
387+ <p class="mono tabular-nums text-2xl font-bold tracking-tight">{stat.value}</p>
388+ <Show when={stat.spark}>{(s) => <StatSpark values={s()} />}</Show>
389+ </div>
390+ </div>
391+ )}
392+ </For>
393+ </div>
394+ </section>
871 395
396+ <Show when={role() !== "parent"}>
397+ <div class="grid gap-3 lg:grid-cols-3">
398+ <Show when={role() === "student"}>
872 <ChartAreaTrend399 <ChartAreaTrend
873- title={copy("Haftalık Öğretim Yükü Eğrisi", "Weekly teaching load")}400+ class="lg:col-span-2"
874- subtitle={copy("Günlük ders ve etüt seans yoğunluğu", "Daily course and study-session load")}401+ title={t("dashboard.progressOverview")}
875- items={weeklyDensityItems().map((i) => ({ label: i.label, value: i.value, formattedValue: i.formattedValue }))}402+ subtitle={t("dashboard.courseAverages")}
876- unit={copy(" Seans", " sessions")}403+ items={courseAverages()}
877- />404+ minScale={0}
878-
879- <ChartBar
880- title={copy("Ders Öğretim Başarı Notları", "Teaching grade performance")}
881- subtitle={copy("Sorumlu olunan derslerdeki öğrenci ortalamaları", "Student averages in assigned courses")}
882- items={teacherCourseStats()}
883 maxScale={100}405 maxScale={100}
884 />406 />
885-407+ </Show>
886- <ChartProgressRing408+ <Show when={role() !== "student"}>
887- title={copy("Sınav Değerlendirme & Okuma Durumu", "Exam grading status")}
888- valueText={`${examCount()}`}
889- subtext={copy("toplam sınav", "total exams")}
890- subtitle={copy("Tamamlanan, okuma bekleyen ve canlı sınavlar", "Graded, awaiting grading, and live exams")}
891- segments={teacherExamStatusSegments()}
892- />
893- </Match>
894-
895- {/* MANAGER ROLE CHARTS (4 Distinct Types) */}
896- <Match when={role() === "manager"}>
897- <ChartMetricCards
898- title={copy("Kurumsal Performans KPI Özeti", "Institutional performance KPI summary")}
899- subtitle={copy("Okul başarısı, devamlılık ve personel mesai durumu", "School performance, attendance, and staff work status")}
900- metrics={managerMetricCards()}
901- />
902-
903- <ChartAreaTrend
904- title={copy("Okul Geneli 7 Günlük Etkinlik Eğrisi", "School-wide 7-day activity")}
905- subtitle={copy("Önümüzdeki 7 güne ait etkinlik ve sınav yoğunluğu", "Events and exams over the next 7 days")}
906- items={weeklyDensityItems().map((i) => ({ label: i.label, value: i.value, formattedValue: i.formattedValue }))}
907- unit={copy(" Etkinlik", " events")}
908- />
909-
910 <ChartBar409 <ChartBar
911- title={copy("Kurumsal Program Türü Dağılımı", "Program type distribution")}410+ class="lg:col-span-2"
912- subtitle={copy("Aktif ders, etüt ve kulüp sayıları", "Active course, study, and club counts")}411+ title={t("dashboard.progressOverview")}
913- items={managerCourseKindItems()}412+ subtitle={t("dashboard.classSizes")}
413+ items={classSizes()}
914 />414 />
915-415+ </Show>
416+ <Show when={role() === "student"}>
916 <ChartProgressRing417 <ChartProgressRing
917- title={copy("Personel Vardiya & Mesai Takibi", "Staff shifts and work tracking")}418+ title={t("dashboard.activitySplit")}
918- valueText="88%"419+ subtitle={t("dashboard.activitySplitDesc")}
919- subtext={copy("Tamamlanan mesai", "completed work")}420+ segments={attendanceSegments()}
920- subtitle={copy("Personel çalışma ve vardiya takip durumu", "Staff work and shift status")}
921- segments={managerStaffWorkSegments()}
922- />
923- </Match>
924-
925- {/* ADMIN ROLE CHARTS (4 Distinct Types) */}
926- <Match when={role() === "admin"}>
927- <ChartMetricCards
928- title={copy("Sistem Altyapı & Sağlık Metrikleri", "System health metrics")}
929- subtitle={copy("Platform geneli kullanıcı, erişilebilirlik ve içerik sayıları", "Platform users, availability, and content counts")}
930- metrics={adminMetricCards()}
931- />
932-
933- <ChartAreaTrend
934- title={copy("Platform Geneli 7 Günlük Aktivite Eğrisi", "Platform-wide 7-day activity")}
935- subtitle={copy("Tüm modüller genelinde 7 günlük takvim yükü", "7-day calendar load across all modules")}
936- items={weeklyDensityItems().map((i) => ({ label: i.label, value: i.value, formattedValue: i.formattedValue }))}
937- unit={copy(" Kayıt", " records")}
938- />
939-
940- <ChartBar
941- title={copy("Sistem Kullanıcı & Rol Dağılımı", "System users and roles")}
942- subtitle={copy("Platformdaki aktif kullanıcı rollerinin dağılımı", "Active platform user roles")}
943- items={adminUserRoleItems()}
944 />421 />
945-422+ </Show>
423+ <Show when={role() !== "student"}>
946 <ChartProgressRing424 <ChartProgressRing
947- title={copy("Sistem Altyapı & Kapasite Takibi", "System capacity tracking")}425+ title={t("dashboard.workloadSplit")}
948- valueText={`${courseCount() + examCount() + eventCount()}`}426+ subtitle={t("dashboard.workloadSplitDesc")}
949- subtext={copy("toplam varlık", "total assets")}427+ segments={workloadSegments()}
950- subtitle={copy("Sistemdeki aktif ders, sınav ve etkinlik kapasitesi", "Active course, exam, and event capacity")}
951- segments={adminSystemCapacitySegments()}
952 />428 />
953- </Match>
954- </Switch>
955- </section>
956- </Show>
957-
958- {/* Workspace Portal Cards (Expandable after 2 rows) */}
959- <section class="space-y-2.5 rounded-3xl border border-[#F2F2F3] bg-card/60 p-3 sm:p-4 dark:border-white/8 dark:bg-card/40 shadow-xs" aria-labelledby="dash-sections">
960- <div class="flex items-center justify-between gap-3">
961- <h2 id="dash-sections" class="text-sm font-semibold tracking-tight text-foreground">
962- {t("dashboard.roleLinks")}
963- </h2>
964- <div class="flex items-center gap-2">
965- <Show when={editingPortalOrder()}>
966- <Button type="button" variant="ghost" size="sm" class="h-10 rounded-xl text-xs" onClick={resetPortalOrder}>
967- {t("common.remove")}
968- </Button>
969 </Show>429 </Show>
970- <Button type="button" variant="outline" size="sm" class="h-10 rounded-xl text-xs font-semibold" onClick={() => setEditingPortalOrder((value) => !value)}>
971- {editingPortalOrder() ? t("common.done") : t("common.edit")}
972- </Button>
973- </div>
974- </div>
975- <div class="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">
976- <For each={displayPortalCards()}>
977- {(card, index) => (
978- <PortalCard
979- card={card}
980- editing={editingPortalOrder()}
981- isFirst={index() === 0}
982- isLast={index() === displayPortalCards().length - 1}
983- onMoveLeft={() => moveCardByDelta(card.to, -1)}
984- onMoveRight={() => moveCardByDelta(card.to, 1)}
985- dragging={draggingPortal() === card.to}
986- preview={dragOverPortal() === card.to && draggingPortal() !== card.to}
987- onDragStart={() => setDraggingPortal(card.to)}
988- onDragEnd={() => {
989- setDraggingPortal(null);
990- setDragOverPortal(null);
991- }}
992- onDragOver={() => {
993- if (draggingPortal() && draggingPortal() !== card.to) {
994- setDragOverPortal(card.to);
995- }
996- }}
997- onDrop={() => {
998- const source = draggingPortal();
999- const target = card.to;
1000- setDraggingPortal(null);
1001- setDragOverPortal(null);
1002- if (source && target && source !== target) {
1003- movePortalCard(source, target);
1004- }
1005- }}
1006- />
1007- )}
1008- </For>
1009- </div>
1010-
1011- <Show when={orderedPortalCards().length > 8 && !editingPortalOrder()}>
1012- <div class="flex justify-center pt-2">
1013- <Button
1014- type="button"
1015- variant="outline"
1016- size="sm"
1017- class="h-8 rounded-full border-border/70 bg-background/80 px-4 text-xs font-medium text-foreground shadow-xs transition-all duration-200 hover:border-primary/50 hover:bg-card hover:shadow-sm"
1018- onClick={() => setShowAllPortals((v) => !v)}
1019- >
1020- <span>{showAllPortals() ? copy("Daha az göster", "Show less") : copy("Daha fazla göster", "Show more")}</span>
1021- <Show when={showAllPortals()} fallback={<IconChevronDown class="h-3.5 w-3.5 text-muted-foreground ml-1" />}>
1022- <IconChevronUp class="h-3.5 w-3.5 text-muted-foreground ml-1" />
1023- </Show>
1024- </Button>
1025 </div>430 </div>
1026 </Show>431 </Show>
1027- </section>
1028 432
1029- <Show when={role() !== "parent"}>433+ <div class="grid gap-3 lg:grid-cols-3">
1030- <div class="grid items-stretch gap-5">434+ <section class={cn("flex flex-col gap-4 rounded-2xl border border-border bg-card p-4 shadow-xs", role() !== "parent" ? "lg:col-span-2" : "lg:col-span-3")} aria-labelledby="deadlines-heading">
1031- <section class="flex min-h-68 flex-col space-y-2.5 rounded-3xl border border-[#F2F2F3] bg-card/60 p-3 sm:p-4 dark:border-white/8 dark:bg-card/40 shadow-xs" aria-labelledby="dash-attention">435+ <h2 id="deadlines-heading" class="text-base font-semibold tracking-tight">{t("dashboard.deadlines")}</h2>
1032- <div class="flex flex-wrap items-center justify-between gap-2 border-b border-border/40 pb-2">436+ <DataTable
1033- <h2 id="dash-attention" class="text-sm font-semibold tracking-tight text-foreground">437+ columns={deadlineColumns()}
1034- {t("dashboard.attention")}438+ data={deadlines()}
1035- </h2>439+ enableColumnVisibility={false}
1036- <div class="flex items-center gap-1 rounded-lg border border-border/60 bg-muted/30 p-0.5 text-xs">440+ searchPredicate={deadlineSearch}
1037- <button441+ filterPlaceholder={t("dashboard.deadlines")}
1038- type="button"442+ empty={t("dashboard.upcomingEmpty")}
1039- class={cn(443+ />
1040- "rounded-md px-2.5 py-0.5 font-medium transition-all",444+ </section>
1041- attentionFilter() === "all"445+
1042- ? "bg-background font-semibold text-foreground shadow-xs"446+ <Show when={role() !== "parent"}>
1043- : "text-muted-foreground hover:text-foreground",447+ <section class="flex flex-col gap-4 rounded-2xl border border-border bg-card p-4 shadow-xs lg:col-span-1" aria-labelledby="review-heading">
1044- )}448+ <div class="space-y-1">
1045- onClick={() => { setAttentionFilter("all"); setAttentionPage(0); }}449+ <h2 id="review-heading" class="text-base font-semibold tracking-tight">{t("nav.questionBank")}</h2>
1046- >450+ <p class="text-sm text-muted-foreground">{t("dashboard.questionHubDesc")}</p>
1047- {copy("Tümü", "All")}451+ </div>
1048- </button>452+ <Link
1049- <button453+ to="/question-bank"
1050- type="button"454+ class="flex h-10 items-center gap-2 rounded-xl border border-border bg-muted/30 px-3 text-sm text-muted-foreground outline-hidden transition-colors hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring"
1051- class={cn(
1052- "rounded-md px-2.5 py-0.5 font-medium transition-all",
1053- attentionFilter() === "exam"
1054- ? "bg-background font-semibold text-foreground shadow-xs"
1055- : "text-muted-foreground hover:text-foreground",
1056- )}
1057- onClick={() => { setAttentionFilter("exam"); setAttentionPage(0); }}
1058 >455 >
1059- {copy("Sınavlar", "Exams")}456+ <IconSearch class="h-4 w-4 shrink-0" />
1060- </button>457+ <span class="truncate">{t("dashboard.questionHubPlaceholder")}</span>
1061- <button458+ </Link>
1062- type="button"459+ <div class="flex items-center gap-2">
1063- class={cn(460+ <For each={[IconArchive, IconHelpCircle, IconExam, IconBook, IconChart]}>
1064- "rounded-md px-2.5 py-0.5 font-medium transition-all",461+ {(Icon) => (
1065- attentionFilter() === "event"462+ <span class="flex h-9 w-9 items-center justify-center rounded-full border border-border bg-muted/30 text-muted-foreground">
1066- ? "bg-background font-semibold text-foreground shadow-xs"463+ <Icon class="h-4 w-4" />
1067- : "text-muted-foreground hover:text-foreground",464+ </span>
1068- )}465+ )}
1069- onClick={() => { setAttentionFilter("event"); setAttentionPage(0); }}466+ </For>
1070- >467+ </div>
1071- {copy("Etkinlikler", "Events")}468+ <div class="mt-auto grid grid-cols-2 gap-2">
1072- </button>469+ <Link
1073- </div>470+ to="/question-bank"
1074- </div>471+ class="flex h-10 items-center justify-center rounded-xl border border-border bg-card text-sm font-semibold outline-hidden transition-colors hover:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring"
1075-472+ >
1076- <Show473+ {t("nav.questionBank")}
1077- when={filteredAttention().length > 0}474+ </Link>
1078- fallback={<DashEmpty>{t("dashboard.noAttention")}</DashEmpty>}475+ <Link
1079- >476+ to="/questions"
1080- <ul class="flex-1 divide-y divide-[#F2F2F3] overflow-hidden rounded-2xl border border-[#F2F2F3] dark:border-white/8 bg-card shadow-apple">477+ class="flex h-10 items-center justify-center rounded-xl bg-primary text-sm font-semibold text-primary-foreground outline-hidden transition-colors hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring"
1081- <For each={pagedAttention()}>478+ >
1082- {(item) => (479+ {t("dashboard.askQuestion")}
1083- <li>480+ </Link>
1084- <Link481+ </div>
1085- to={item.to}482+ </section>
1086- params={{ id: item.id }}
1087- class="flex items-center gap-3 px-3 py-2.5 text-sm transition-[background-color,box-shadow] hover:bg-muted/45 hover:shadow-[inset_2px_0_0_hsl(var(--primary)/0.7)] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/60 sm:px-4 sm:py-3"
1088- >
1089- <StatusDot status={item.status} />
1090- <div class="min-w-0 flex-1">
1091- <p class="truncate font-medium text-foreground">{item.title}</p>
1092- <p class="truncate text-xs text-muted-foreground">
1093- {item.kind === "exam" ? t("nav.exams") : t("nav.events")}
1094- <Show when={item.subtitle}>
1095- {" · "}
1096- {item.subtitle}
1097- </Show>
1098- </p>
1099- </div>
1100- <div class="shrink-0 text-right">
1101- <StatusLabel status={item.status} t={t} />
1102- <p class="mono mt-0.5 text-[11px] tabular-nums text-muted-foreground">
1103- <Show when={item.at != null} fallback="—">
1104- {formatDateTime(item.at!, locale())}
1105- </Show>
1106- </p>
1107- </div>
1108- </Link>
1109- </li>
1110- )}
1111- </For>
1112- </ul>
1113- <Show when={attentionTotalPages() > 1}>
1114- <PaginationControls page={attentionPage()} totalPages={attentionTotalPages()} onPageChange={setAttentionPage} />
1115- </Show>
1116 </Show>483 </Show>
1117- </section>484+ </div>
1118- </div>
1119- </Show>
1120- </div>
1121- </Show>
1122- </div>
1123- );
1124-}
1125-
1126-function DashEmpty(props: { children: string }) {
1127- return (
1128- <div class="flex min-h-0 flex-1 items-center justify-center rounded-xl border border-dashed border-border bg-card/80 px-4 py-8 text-center text-sm text-muted-foreground shadow-xs">
1129- {props.children}
1130- </div>
1131- );
1132-}
1133-
1134-function PortalCard(props: {
1135- card: PortalCardDef;
1136- editing: boolean;
1137- isFirst?: boolean;
1138- isLast?: boolean;
1139- onMoveLeft?: () => void;
1140- onMoveRight?: () => void;
1141- dragging: boolean;
1142- preview: boolean;
1143- onDragStart: () => void;
1144- onDragEnd: () => void;
1145- onDragOver: () => void;
1146- onDrop: (target: string) => void;
1147-}) {
1148- const t = useT();
1149- const { locale } = usePreferences();
1150- const Icon = props.card.Icon;
1151- const hasStat = () => props.card.stat != null && props.card.stat !== "";
1152-
1153- const cardInner = () => (
1154- <>
1155- <span class={cn("mt-0.5 flex h-11 w-11 shrink-0 items-center justify-center rounded-xl transition-all duration-200", portalTone(props.card.to))}>
1156-
1157- <Icon class="h-5 w-5" />
1158- </span>
1159- <div class="min-w-0 flex-1 space-y-1">
1160- <div class="flex min-w-0 items-start gap-2">
1161- <h3 class="truncate text-sm font-semibold tracking-tight text-foreground">{t(props.card.titleKey)}</h3>
1162- <Show when={hasStat()}>
1163- <span class="hidden text-muted-foreground/40 sm:inline" aria-hidden="true">
1164- |
1165- </span>
1166- <span class="mono shrink-0 rounded-full border border-black/6 bg-background/80 px-2 py-0.5 text-xs font-semibold tabular-nums tracking-tight text-foreground shadow-xs dark:border-white/8 sm:text-sm">
1167- {props.card.stat}
1168- </span>
1169- </Show>
1170- <Show when={props.card.minRole && props.card.minRole !== "student"}>
1171- <span class="ml-auto hidden shrink-0 rounded-full border border-black/6 dark:border-white/8 bg-muted/60 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground sm:inline">
1172- {t(ROLE_KEY[props.card.minRole!])}
1173- </span>
1174- </Show>
1175- </div>
1176- <Show when={props.card.descKey}>
1177- <p class="line-clamp-2 text-xs leading-relaxed text-muted-foreground">{t(props.card.descKey!)}</p>
1178- </Show>
1179- </div>
1180- <Show when={props.editing}>
1181- <div class="flex items-center gap-1 shrink-0 ml-1">
1182- <Button
1183- type="button"
1184- variant="outline"
1185- size="sm"
1186- class="h-10 w-10 rounded-xl p-0 text-xs font-bold shadow-none disabled:opacity-30"
1187- disabled={props.isFirst}
1188- onClick={(e) => {
1189- e.preventDefault();
1190- e.stopPropagation();
1191- props.onMoveLeft?.();
1192- }}
1193- title={locale() === "tr" ? "Öne taşı" : "Move earlier"}
1194- >
1195- ←
1196- </Button>
1197- <Button
1198- type="button"
1199- variant="outline"
1200- size="sm"
1201- class="h-10 w-10 rounded-xl p-0 text-xs font-bold shadow-none disabled:opacity-30"
1202- disabled={props.isLast}
1203- onClick={(e) => {
1204- e.preventDefault();
1205- e.stopPropagation();
1206- props.onMoveRight?.();
1207- }}
1208- title={locale() === "tr" ? "Arkaya taşı" : "Move later"}
1209- >
1210- →
1211- </Button>
1212- </div>
1213- </Show>
1214- </>
1215- );
1216-
1217- const cardClass = () =>
1218- cn(
1219- "group relative flex min-h-24 items-start gap-3.5 overflow-hidden rounded-2xl border border-[#F2F2F3] bg-card p-4 shadow-apple transition-all duration-200 hover:-translate-y-0.5 hover:shadow-apple-hover hover:border-border dark:border-white/8 dark:hover:border-white/20 dark:hover:shadow-[0_10px_30px_rgba(0,0,0,0.6)] sm:min-h-26",
1220- !props.editing && "active:scale-[0.98]",
1221- props.editing && "cursor-grab select-none border-dashed border-primary/50 bg-primary/3",
1222- props.preview && "scale-[1.02] border-primary/70 bg-primary/10 opacity-80 shadow-apple-hover",
1223- props.dragging && "scale-[0.98] border-primary/50 opacity-50",
1224- );
1225 485
1226- return (486+ <div class="flex justify-center pt-2">
1227- <Show487+ <button
1228- when={props.editing}488+ type="button"
1229- fallback={489+ onClick={() => void refresh()}
1230- <Link to={props.card.to} class={cardClass()}>490+ disabled={refreshing()}
1231- {cardInner()}491+ class="inline-flex h-9 items-center gap-2 rounded-lg border border-border bg-card px-4 text-xs font-semibold text-muted-foreground outline-hidden transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60"
1232- </Link>492+ >
1233- }493+ <IconRefresh class={cn("h-3.5 w-3.5", refreshing() && "animate-spin")} />
1234- >494+ {t("dashboard.refresh")}
1235- <div495+ </button>
1236- draggable={true}496+ </div>
1237- onDragStart={(event) => {497+ </Suspense>
1238- if (event.dataTransfer) {
1239- event.dataTransfer.effectAllowed = "move";
1240- event.dataTransfer.setData("text/plain", props.card.to);
1241- }
1242- props.onDragStart();
1243- }}
1244- onDragEnd={(event) => {
1245- event.preventDefault();
1246- props.onDragEnd();
1247- }}
1248- onDragOver={(event) => {
1249- event.preventDefault();
1250- if (event.dataTransfer) {
1251- event.dataTransfer.dropEffect = "move";
1252- }
1253- props.onDragOver();
1254- }}
1255- onDragEnter={(event) => {
1256- event.preventDefault();
1257- }}
1258- onDrop={(event) => {
1259- event.preventDefault();
1260- event.stopPropagation();
1261- props.onDrop(props.card.to);
1262- }}
1263- class={cardClass()}
1264- >
1265- {cardInner()}
1266 </div>498 </div>
1267- </Show>499+ </RouteGuard>
1268- );
1269-}
1270-
1271-function StatusDot(props: { status: AttentionKind }) {
1272- return (
1273- <span
1274- class={cn("mt-0.5 h-2 w-2 shrink-0 rounded-full", scheduleStatusDotClass(props.status))}
1275- aria-hidden="true"
1276- />
1277- );
1278-}
1279-
1280-function StatusLabel(props: {
1281- status: AttentionKind;
1282- t: (key: MessageKey) => string;
1283-}) {
1284- const label = () => {
1285- if (props.status === "active") return props.t("dashboard.activeNow");
1286- if (props.status === "today") return props.t("dashboard.today");
1287- return props.t("dashboard.soon");
1288- };
1289- return (
1290- <span
1291- class={cn(
1292- "inline-flex rounded-full border px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide",
1293- scheduleStatusClass(props.status),
1294- )}
1295- >
1296- {label()}
1297- </span>
1298 );500 );
1299 }501 }