✨ add dense admin directory redesign
Browse files at this commit9774cd96751b942fc72e78d60d1fac50a9b6bd6aParent: 0465336- feat
- ✨ add dense admin directory redesign
9 changed files +522 -194
- docs/ui-redesign-tokens.md +95 -0
- src/components/layout/app-shell.tsx +2 -4
- src/components/layout/side-nav.tsx +198 -73
- src/components/layout/sidebar-account.tsx +23 -10
- src/components/ui/icons.tsx +9 -0
- src/components/users/user-table.tsx +31 -8
- src/i18n/messages.ts +17 -2
- src/index.css +113 -86
- src/pages/admin-users-page.tsx +34 -11
docs/ui-redesign-tokens.mdadded+95 -0
| @@ -0,0 +1,95 @@ | |||
| 1 | +# UI Redesign Tokens | ||
| 2 | + | ||
| 3 | +## Direction | ||
| 4 | + | ||
| 5 | +Dense school admin UI: Fintables-style tables, Cloudflare-style grouped sidebar, | ||
| 6 | +neutral surfaces, subtle borders, one blue accent. | ||
| 7 | + | ||
| 8 | +## Color | ||
| 9 | + | ||
| 10 | +Light palette is defined in `src/index.css` as `--ui-*` variables: | ||
| 11 | + | ||
| 12 | +- `--ui-bg`: `#f7f8f8` | ||
| 13 | +- `--ui-surface-1`: `#ffffff` | ||
| 14 | +- `--ui-surface-2`: `#f1f3f3` | ||
| 15 | +- `--ui-surface-3`: `#e7eaea` | ||
| 16 | +- `--ui-border-1`: `#d9dddd` | ||
| 17 | +- `--ui-border-2`: `#c7cccc` | ||
| 18 | +- `--ui-text-1`: `#101414` | ||
| 19 | +- `--ui-text-2`: `#4b5555` | ||
| 20 | +- `--ui-text-3`: `#788181` | ||
| 21 | +- `--ui-accent`: `#2563eb` | ||
| 22 | +- semantic colors: success, warning, danger, info, each with muted pair | ||
| 23 | + | ||
| 24 | +Dark palette mirrors same token names with dark surfaces and brighter semantic | ||
| 25 | +foregrounds. | ||
| 26 | + | ||
| 27 | +Existing shadcn tokens (`--background`, `--card`, `--primary`, etc.) are mapped | ||
| 28 | +to these `--ui-*` variables so existing components keep working. | ||
| 29 | + | ||
| 30 | +## Typography | ||
| 31 | + | ||
| 32 | +- UI face: `DM Sans` | ||
| 33 | +- Data face: `.mono` / `.num`, using `ui-monospace, SFMono-Regular, Menlo, | ||
| 34 | + Monaco, Consolas` | ||
| 35 | +- Display serif removed from data/admin pages; `.font-display` now maps to UI | ||
| 36 | + face for tighter dashboard hierarchy. | ||
| 37 | + | ||
| 38 | +Scale target: | ||
| 39 | + | ||
| 40 | +- `xs`: 12/16, labels and metadata | ||
| 41 | +- `sm`: 13/18, nav and table cells | ||
| 42 | +- `base`: 14/20, body | ||
| 43 | +- `lg`: 18/24, section/page titles | ||
| 44 | +- `xl`: 22/28, key page title only | ||
| 45 | + | ||
| 46 | +## Spacing | ||
| 47 | + | ||
| 48 | +CSS variables: | ||
| 49 | + | ||
| 50 | +- `--space-1`: 4px | ||
| 51 | +- `--space-2`: 8px | ||
| 52 | +- `--space-3`: 12px | ||
| 53 | +- `--space-4`: 16px | ||
| 54 | +- `--space-5`: 20px | ||
| 55 | +- `--space-6`: 24px | ||
| 56 | +- `--space-8`: 32px | ||
| 57 | + | ||
| 58 | +Density defaults: | ||
| 59 | + | ||
| 60 | +- sidebar group/header row: 32px | ||
| 61 | +- table header/cell row: 36px | ||
| 62 | +- card padding: 16px | ||
| 63 | +- radius: 6px | ||
| 64 | +- table numerals/IDs use tabular mono | ||
| 65 | + | ||
| 66 | +## Proof Of Concept | ||
| 67 | + | ||
| 68 | +Reference page: `src/pages/admin-users-page.tsx`. | ||
| 69 | + | ||
| 70 | +Implemented: | ||
| 71 | + | ||
| 72 | +- grouped accordion sidebar with active category auto-open | ||
| 73 | +- compact stat row on top of users page | ||
| 74 | +- dense sticky data table styling via `.data-table` | ||
| 75 | +- role pills with semantic tints | ||
| 76 | +- mono IDs and tabular metrics | ||
| 77 | +- neutral surfaces, subtle borders, no gradients or decorative cards | ||
| 78 | + | ||
| 79 | +Static wireframe: | ||
| 80 | + | ||
| 81 | +```text | ||
| 82 | +Students / Users | ||
| 83 | +People & roles | ||
| 84 | + | ||
| 85 | +[ Total ] [ Students ] [ Teachers ] [ Managers ] [ Admins ] | ||
| 86 | + | ||
| 87 | +Directory [ Search... ] | ||
| 88 | +┌──────────┬────────────┬──────────────┬─────────┬──────────────┬────────┐ | ||
| 89 | +│ Username │ Name │ Email │ Role │ ID │ Update │ | ||
| 90 | +├──────────┼────────────┼──────────────┼─────────┼──────────────┼────────┤ | ||
| 91 | +│ ali │ Ali Demir │ ali@... │ Student │ 01J... │ select │ | ||
| 92 | +│ ayse │ Ayse Kaya │ — │ Student │ 01J... │ select │ | ||
| 93 | +│ mehmet │ Mehmet Ar │ mehmet@... │ Teacher │ 01J... │ select │ | ||
| 94 | +└──────────┴────────────┴──────────────┴─────────┴──────────────┴────────┘ | ||
| 95 | +``` | ||
src/components/layout/app-shell.tsxmodified+2 -4
| @@ -5,7 +5,7 @@ import { NavBar } from "@/components/layout/nav-bar"; | |||
| 5 | import { SideNav } from "@/components/layout/side-nav"; | 5 | import { SideNav } from "@/components/layout/side-nav"; |
| 6 | import { SidebarAccount } from "@/components/layout/sidebar-account"; | 6 | import { SidebarAccount } from "@/components/layout/sidebar-account"; |
| 7 | import { Button } from "@/components/ui/button"; | 7 | import { Button } from "@/components/ui/button"; |
| 8 | -import { IconChevronLeft, IconChevronRight, IconMenu } from "@/components/ui/icons"; | 8 | +import { IconMenu, IconPanelLeft } from "@/components/ui/icons"; |
| 9 | import { useAuth } from "@/stores/auth-context"; | 9 | import { useAuth } from "@/stores/auth-context"; |
| 10 | import { usePreferences, useT } from "@/stores/preferences-context"; | 10 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 11 | import { cn } from "@/lib/cn"; | 11 | import { cn } from "@/lib/cn"; |
| @@ -76,9 +76,7 @@ export function AppShell(props: ParentProps) { | |||
| 76 | title={collapsed() ? t("nav.expand") : t("nav.collapse")} | 76 | title={collapsed() ? t("nav.expand") : t("nav.collapse")} |
| 77 | onClick={() => prefs.toggleSidebar()} | 77 | onClick={() => prefs.toggleSidebar()} |
| 78 | > | 78 | > |
| 79 | - <Show when={collapsed()} fallback={<IconChevronLeft class="h-4 w-4 shrink-0" />}> | 79 | + <IconPanelLeft class="h-4 w-4 shrink-0" /> |
| 80 | - <IconChevronRight class="h-4 w-4 shrink-0" /> | ||
| 81 | - </Show> | ||
| 82 | </Button> | 80 | </Button> |
| 83 | </div> | 81 | </div> |
| 84 | 82 | ||
src/components/layout/side-nav.tsxmodified+198 -73
| @@ -1,5 +1,11 @@ | |||
| 1 | import { Link, useRouterState } from "@tanstack/solid-router"; | 1 | import { Link, useRouterState } from "@tanstack/solid-router"; |
| 2 | -import { For, Show, createMemo, type Component } from "solid-js"; | 2 | +import { For, Show, createEffect, createMemo, createSignal, type Component } from "solid-js"; |
| 3 | +import { | ||
| 4 | + DropdownMenu, | ||
| 5 | + DropdownMenuContent, | ||
| 6 | + DropdownMenuItem, | ||
| 7 | + DropdownMenuTrigger, | ||
| 8 | +} from "@/components/ui/dropdown-menu"; | ||
| 3 | import { useAuth } from "@/stores/auth-context"; | 9 | import { useAuth } from "@/stores/auth-context"; |
| 4 | import { useT } from "@/stores/preferences-context"; | 10 | import { useT } from "@/stores/preferences-context"; |
| 5 | import { hasMinRole } from "@/lib/roles"; | 11 | import { hasMinRole } from "@/lib/roles"; |
| @@ -10,10 +16,10 @@ import { | |||
| 10 | IconBook, | 16 | IconBook, |
| 11 | IconCalendar, | 17 | IconCalendar, |
| 12 | IconChart, | 18 | IconChart, |
| 19 | + IconChevronRight, | ||
| 20 | + IconEdit, | ||
| 13 | IconExam, | 21 | IconExam, |
| 14 | - IconGuide, | ||
| 15 | IconHome, | 22 | IconHome, |
| 16 | - IconEdit, | ||
| 17 | IconNote, | 23 | IconNote, |
| 18 | IconUsers, | 24 | IconUsers, |
| 19 | } from "@/components/ui/icons"; | 25 | } from "@/components/ui/icons"; |
| @@ -26,26 +32,78 @@ type NavItem = { | |||
| 26 | exact?: boolean; | 32 | exact?: boolean; |
| 27 | }; | 33 | }; |
| 28 | 34 | ||
| 29 | -const MAIN_ITEMS: NavItem[] = [ | 35 | +type NavGroup = { |
| 30 | - { to: "/", labelKey: "nav.home", Icon: IconHome, exact: true }, | 36 | + id: string; |
| 31 | - { to: "/courses", labelKey: "nav.courses", Icon: IconBook }, | 37 | + labelKey: MessageKey; |
| 32 | - { to: "/exams", labelKey: "nav.exams", Icon: IconExam }, | 38 | + Icon: Component<{ class?: string }>; |
| 33 | - { to: "/marks", labelKey: "nav.marks", Icon: IconChart }, | 39 | + minRole?: Role; |
| 34 | - { to: "/attendance", labelKey: "nav.attendance", Icon: IconCalendar }, | 40 | + items: NavItem[]; |
| 35 | - { to: "/notes", labelKey: "nav.notes", Icon: IconNote }, | 41 | +}; |
| 36 | - { to: "/events", labelKey: "nav.events", Icon: IconCalendar }, | 42 | + |
| 37 | - { to: "/work", labelKey: "nav.work", Icon: IconChart, minRole: "teacher" }, | 43 | +const NAV_GROUPS: NavGroup[] = [ |
| 38 | - { to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, minRole: "teacher" }, | 44 | + { |
| 39 | - { to: "/management/student-attendance", labelKey: "nav.studentAttendance", Icon: IconCalendar, minRole: "teacher" }, | 45 | + id: "students", |
| 40 | - { to: "/management/settings", labelKey: "nav.settings", Icon: IconEdit, minRole: "manager" }, | 46 | + labelKey: "nav.group.students", |
| 41 | - { to: "/management/terms", labelKey: "nav.terms", Icon: IconCalendar, minRole: "manager" }, | 47 | + Icon: IconUsers, |
| 42 | - { to: "/admin/users", labelKey: "nav.users", Icon: IconUsers, minRole: "admin" }, | 48 | + items: [ |
| 49 | + { to: "/attendance", labelKey: "nav.attendance", Icon: IconCalendar }, | ||
| 50 | + ], | ||
| 51 | + }, | ||
| 52 | + { | ||
| 53 | + id: "classes", | ||
| 54 | + labelKey: "nav.group.classes", | ||
| 55 | + Icon: IconBook, | ||
| 56 | + items: [ | ||
| 57 | + { to: "/courses", labelKey: "nav.courses", Icon: IconBook }, | ||
| 58 | + { to: "/exams", labelKey: "nav.exams", Icon: IconExam }, | ||
| 59 | + { to: "/events", labelKey: "nav.events", Icon: IconCalendar }, | ||
| 60 | + ], | ||
| 61 | + }, | ||
| 62 | + { | ||
| 63 | + id: "grades", | ||
| 64 | + labelKey: "nav.group.grades", | ||
| 65 | + Icon: IconChart, | ||
| 66 | + items: [ | ||
| 67 | + { to: "/marks", labelKey: "nav.marks", Icon: IconChart }, | ||
| 68 | + { to: "/management/student-marks", labelKey: "nav.studentMarks", Icon: IconChart, minRole: "teacher" }, | ||
| 69 | + ], | ||
| 70 | + }, | ||
| 71 | + { | ||
| 72 | + id: "reports", | ||
| 73 | + labelKey: "nav.group.reports", | ||
| 74 | + Icon: IconNote, | ||
| 75 | + minRole: "teacher", | ||
| 76 | + items: [ | ||
| 77 | + { to: "/management/student-attendance", labelKey: "nav.studentAttendance", Icon: IconCalendar, minRole: "teacher" }, | ||
| 78 | + { to: "/work", labelKey: "nav.work", Icon: IconChart, minRole: "teacher" }, | ||
| 79 | + ], | ||
| 80 | + }, | ||
| 81 | + { | ||
| 82 | + id: "settings", | ||
| 83 | + labelKey: "nav.group.settings", | ||
| 84 | + Icon: IconEdit, | ||
| 85 | + minRole: "manager", | ||
| 86 | + items: [ | ||
| 87 | + { to: "/management/settings", labelKey: "nav.settings", Icon: IconEdit, minRole: "manager" }, | ||
| 88 | + { to: "/management/terms", labelKey: "nav.terms", Icon: IconCalendar, minRole: "manager" }, | ||
| 89 | + ], | ||
| 90 | + }, | ||
| 91 | + { | ||
| 92 | + id: "admin", | ||
| 93 | + labelKey: "nav.admin", | ||
| 94 | + Icon: IconUsers, | ||
| 95 | + minRole: "admin", | ||
| 96 | + items: [ | ||
| 97 | + { to: "/admin/users", labelKey: "nav.users", Icon: IconUsers, minRole: "admin" }, | ||
| 98 | + ], | ||
| 99 | + }, | ||
| 43 | ]; | 100 | ]; |
| 44 | 101 | ||
| 45 | -const GUIDE_ITEM: NavItem = { | 102 | +const HOME_ITEM: NavItem = { |
| 46 | - to: "/guide", | 103 | + to: "/", |
| 47 | - labelKey: "nav.guide", | 104 | + labelKey: "nav.home", |
| 48 | - Icon: IconGuide, | 105 | + Icon: IconHome, |
| 106 | + exact: true, | ||
| 49 | }; | 107 | }; |
| 50 | 108 | ||
| 51 | function pathActive(pathname: string, to: string, exact?: boolean) { | 109 | function pathActive(pathname: string, to: string, exact?: boolean) { |
| @@ -57,6 +115,7 @@ function NavLink(props: { | |||
| 57 | item: NavItem; | 115 | item: NavItem; |
| 58 | collapsed?: boolean; | 116 | collapsed?: boolean; |
| 59 | onNavigate?: () => void; | 117 | onNavigate?: () => void; |
| 118 | + standalone?: boolean; | ||
| 60 | }) { | 119 | }) { |
| 61 | const t = useT(); | 120 | const t = useT(); |
| 62 | const pathname = useRouterState({ select: (s) => s.location.pathname }); | 121 | const pathname = useRouterState({ select: (s) => s.location.pathname }); |
| @@ -69,79 +128,145 @@ function NavLink(props: { | |||
| 69 | title={t(props.item.labelKey)} | 128 | title={t(props.item.labelKey)} |
| 70 | aria-current={active() ? "page" : undefined} | 129 | aria-current={active() ? "page" : undefined} |
| 71 | class={cn( | 130 | class={cn( |
| 72 | - "relative flex h-10 w-full items-center rounded-md text-sm font-medium outline-none", | 131 | + "relative flex h-8 w-full items-center rounded-sm outline-none transition-colors duration-150", |
| 73 | - "transition-all duration-150", | 132 | + props.standalone ? "text-[11px] font-semibold uppercase tracking-[0.08em]" : "text-[13px] font-medium", |
| 74 | - props.collapsed ? "justify-center px-0" : "gap-1.5 px-2", | 133 | + props.collapsed ? "justify-center px-0" : props.standalone ? "gap-2 px-2" : "gap-2 pl-7 pr-2", |
| 75 | active() | 134 | active() |
| 76 | - ? "bg-primary/10 text-primary shadow-sm ring-1 ring-primary/20" | 135 | + ? "bg-primary/10 text-foreground" |
| 77 | - : "text-sidebar-foreground/75 hover:bg-muted/70 hover:text-foreground", | 136 | + : "text-sidebar-foreground/75 hover:bg-muted hover:text-foreground", |
| 78 | )} | 137 | )} |
| 79 | > | 138 | > |
| 80 | <Show when={active() && !props.collapsed}> | 139 | <Show when={active() && !props.collapsed}> |
| 81 | <span class="absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-primary" /> | 140 | <span class="absolute left-0 top-1/2 h-5 w-0.5 -translate-y-1/2 rounded-full bg-primary" /> |
| 82 | </Show> | 141 | </Show> |
| 83 | - <span | 142 | + <props.item.Icon class={cn("h-3.5 w-3.5 shrink-0", active() ? "text-primary" : "text-muted-foreground")} /> |
| 84 | - class={cn( | 143 | + <span class={cn("truncate", props.collapsed ? "hidden" : "block min-w-0 flex-1 text-left")}>{t(props.item.labelKey)}</span> |
| 85 | - "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md transition-colors", | ||
| 86 | - active() ? "text-primary" : "text-muted-foreground", | ||
| 87 | - )} | ||
| 88 | - > | ||
| 89 | - <props.item.Icon class="h-4 w-4" /> | ||
| 90 | - </span> | ||
| 91 | - <span | ||
| 92 | - class={cn( | ||
| 93 | - "truncate leading-normal", | ||
| 94 | - props.collapsed ? "hidden" : "block min-w-0 flex-1 text-left", | ||
| 95 | - )} | ||
| 96 | - > | ||
| 97 | - {t(props.item.labelKey)} | ||
| 98 | - </span> | ||
| 99 | </Link> | 144 | </Link> |
| 100 | ); | 145 | ); |
| 101 | } | 146 | } |
| 102 | 147 | ||
| 103 | export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) { | 148 | export function SideNav(props: { onNavigate?: () => void; collapsed?: boolean }) { |
| 104 | const auth = useAuth(); | 149 | const auth = useAuth(); |
| 105 | - | 150 | + const t = useT(); |
| 106 | - const items = createMemo(() => | 151 | + const pathname = useRouterState({ select: (s) => s.location.pathname }); |
| 107 | - MAIN_ITEMS.filter((item) => !item.minRole || hasMinRole(auth.user()?.role, item.minRole)), | 152 | + const visibleGroups = createMemo(() => |
| 153 | + NAV_GROUPS | ||
| 154 | + .filter((group) => !group.minRole || hasMinRole(auth.user()?.role, group.minRole)) | ||
| 155 | + .map((group) => ({ | ||
| 156 | + ...group, | ||
| 157 | + items: group.items.filter((item) => !item.minRole || hasMinRole(auth.user()?.role, item.minRole)), | ||
| 158 | + })) | ||
| 159 | + .filter((group) => group.items.length > 0), | ||
| 108 | ); | 160 | ); |
| 161 | + const activeGroupId = createMemo(() => visibleGroups().find((group) => group.items.some((item) => pathActive(pathname(), item.to, item.exact)))?.id ?? visibleGroups()[0]?.id ?? ""); | ||
| 162 | + const [openGroup, setOpenGroup] = createSignal(activeGroupId()); | ||
| 109 | 163 | ||
| 110 | - const t = useT(); | 164 | + createEffect(() => { |
| 165 | + const active = activeGroupId(); | ||
| 166 | + if (active) setOpenGroup(active); | ||
| 167 | + }); | ||
| 111 | 168 | ||
| 112 | return ( | 169 | return ( |
| 113 | <nav class="flex h-full flex-col" aria-label="Main"> | 170 | <nav class="flex h-full flex-col" aria-label="Main"> |
| 114 | - <div class="flex flex-col gap-0.5 px-2"> | 171 | + <div class="flex flex-col gap-1 px-2"> |
| 115 | - <For each={items()}> | 172 | + <NavLink item={HOME_ITEM} collapsed={props.collapsed} onNavigate={props.onNavigate} standalone /> |
| 116 | - {(item, index) => ( | 173 | + <For each={visibleGroups()}> |
| 117 | - <> | 174 | + {(group, index) => { |
| 118 | - <Show when={item.minRole && !items()[index() - 1]?.minRole}> | 175 | + const open = () => openGroup() === group.id; |
| 119 | - <Show | 176 | + const showManagementDivider = () => !!group.minRole && !visibleGroups()[index() - 1]?.minRole; |
| 120 | - when={!props.collapsed} | 177 | + return ( |
| 121 | - fallback={ | 178 | + <> |
| 122 | - <div class="px-3 pb-1 pt-4"> | 179 | + <Show when={showManagementDivider()}> |
| 123 | - <span class="block h-px bg-border/80" /> | 180 | + <Show |
| 181 | + when={!props.collapsed} | ||
| 182 | + fallback={ | ||
| 183 | + <div class="px-2 py-2"> | ||
| 184 | + <span class="block h-px bg-border" /> | ||
| 185 | + </div> | ||
| 186 | + } | ||
| 187 | + > | ||
| 188 | + <div class="flex items-center gap-2 px-2 pb-1 pt-3"> | ||
| 189 | + <span class="h-px flex-1 bg-border" /> | ||
| 190 | + <span class="text-[10px] font-semibold uppercase tracking-[0.16em] text-muted-foreground"> | ||
| 191 | + {t("nav.admin")} | ||
| 192 | + </span> | ||
| 193 | + <span class="h-px flex-1 bg-border" /> | ||
| 124 | </div> | 194 | </div> |
| 125 | - } | 195 | + </Show> |
| 126 | - > | ||
| 127 | - <div class="flex items-center gap-2 px-2 pb-1 pt-4"> | ||
| 128 | - <span class="h-px flex-1 bg-border/70" /> | ||
| 129 | - <span lang="en" class="text-[10px] font-semibold uppercase tracking-[0.18em] text-muted-foreground/70"> | ||
| 130 | - {t("nav.admin")} | ||
| 131 | - </span> | ||
| 132 | - <span class="h-px flex-1 bg-border/70" /> | ||
| 133 | - </div> | ||
| 134 | </Show> | 196 | </Show> |
| 135 | - </Show> | 197 | + <section> |
| 136 | - <NavLink item={item} collapsed={props.collapsed} onNavigate={props.onNavigate} /> | 198 | + <Show |
| 137 | - </> | 199 | + when={props.collapsed} |
| 138 | - )} | 200 | + fallback={ |
| 201 | + <> | ||
| 202 | + <button | ||
| 203 | + type="button" | ||
| 204 | + class={cn( | ||
| 205 | + "flex h-8 w-full items-center gap-2 rounded-sm px-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground transition-colors duration-150 hover:bg-muted hover:text-foreground", | ||
| 206 | + open() && "text-foreground", | ||
| 207 | + )} | ||
| 208 | + title={t(group.labelKey)} | ||
| 209 | + aria-expanded={open()} | ||
| 210 | + onClick={() => setOpenGroup(open() ? "" : group.id)} | ||
| 211 | + > | ||
| 212 | + <group.Icon class="h-3.5 w-3.5" /> | ||
| 213 | + <span class="min-w-0 flex-1 truncate text-left">{t(group.labelKey)}</span> | ||
| 214 | + <IconChevronRight class={cn("h-3.5 w-3.5 transition-transform duration-150", open() && "rotate-90")} /> | ||
| 215 | + </button> | ||
| 216 | + <Show when={open()}> | ||
| 217 | + <div class="mt-1 grid gap-0.5 overflow-hidden transition-all duration-150"> | ||
| 218 | + <For each={group.items}> | ||
| 219 | + {(item) => <NavLink item={item} onNavigate={props.onNavigate} />} | ||
| 220 | + </For> | ||
| 221 | + </div> | ||
| 222 | + </Show> | ||
| 223 | + </> | ||
| 224 | + } | ||
| 225 | + > | ||
| 226 | + <DropdownMenu placement="right-start" gutter={8}> | ||
| 227 | + <DropdownMenuTrigger | ||
| 228 | + class={cn( | ||
| 229 | + "relative flex h-8 w-full items-center justify-center rounded-sm px-0 text-muted-foreground outline-none transition-colors duration-150 hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[expanded]:bg-muted data-[expanded]:text-foreground", | ||
| 230 | + open() && "text-foreground", | ||
| 231 | + )} | ||
| 232 | + title={t(group.labelKey)} | ||
| 233 | + aria-label={t(group.labelKey)} | ||
| 234 | + > | ||
| 235 | + <group.Icon class="h-3.5 w-3.5" /> | ||
| 236 | + <IconChevronRight class="absolute right-1 h-3 w-3 opacity-55" /> | ||
| 237 | + </DropdownMenuTrigger> | ||
| 238 | + <DropdownMenuContent class="w-56 rounded-lg border-border/80 bg-popover p-1 shadow-soft"> | ||
| 239 | + <p class="px-2 py-1.5 text-[10px] font-medium uppercase tracking-[0.14em] text-muted-foreground"> | ||
| 240 | + {t(group.labelKey)} | ||
| 241 | + </p> | ||
| 242 | + <For each={group.items}> | ||
| 243 | + {(item) => { | ||
| 244 | + const itemActive = () => pathActive(pathname(), item.to, item.exact); | ||
| 245 | + return ( | ||
| 246 | + <DropdownMenuItem | ||
| 247 | + class={cn("rounded-md p-0", itemActive() && "bg-primary/10 text-foreground")} | ||
| 248 | + > | ||
| 249 | + <Link | ||
| 250 | + to={item.to} | ||
| 251 | + onClick={() => props.onNavigate?.()} | ||
| 252 | + class="flex min-w-0 flex-1 items-center gap-2 rounded-md px-2 py-1.5 outline-none" | ||
| 253 | + > | ||
| 254 | + <item.Icon class={cn("h-4 w-4 shrink-0", itemActive() ? "text-primary" : "text-muted-foreground")} /> | ||
| 255 | + <span class="min-w-0 flex-1 truncate">{t(item.labelKey)}</span> | ||
| 256 | + </Link> | ||
| 257 | + </DropdownMenuItem> | ||
| 258 | + ); | ||
| 259 | + }} | ||
| 260 | + </For> | ||
| 261 | + </DropdownMenuContent> | ||
| 262 | + </DropdownMenu> | ||
| 263 | + </Show> | ||
| 264 | + </section> | ||
| 265 | + </> | ||
| 266 | + ); | ||
| 267 | + }} | ||
| 139 | </For> | 268 | </For> |
| 140 | </div> | 269 | </div> |
| 141 | - | ||
| 142 | - <div class="mt-auto border-t border-border px-2 py-1"> | ||
| 143 | - <NavLink item={GUIDE_ITEM} collapsed={props.collapsed} onNavigate={props.onNavigate} /> | ||
| 144 | - </div> | ||
| 145 | </nav> | 270 | </nav> |
| 146 | ); | 271 | ); |
| 147 | } | 272 | } |
src/components/layout/sidebar-account.tsxmodified+23 -10
| @@ -9,7 +9,7 @@ import { | |||
| 9 | DropdownMenuSeparator, | 9 | DropdownMenuSeparator, |
| 10 | DropdownMenuTrigger, | 10 | DropdownMenuTrigger, |
| 11 | } from "@/components/ui/dropdown-menu"; | 11 | } from "@/components/ui/dropdown-menu"; |
| 12 | -import { IconChevronRight, IconGlobe, IconLogout, IconMoon, IconSun } from "@/components/ui/icons"; | 12 | +import { IconChevronRight, IconGlobe, IconGuide, IconLogout, IconMoon, IconSun } from "@/components/ui/icons"; |
| 13 | import { useAuth } from "@/stores/auth-context"; | 13 | import { useAuth } from "@/stores/auth-context"; |
| 14 | import { usePreferences, useT } from "@/stores/preferences-context"; | 14 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 15 | import { cn } from "@/lib/cn"; | 15 | import { cn } from "@/lib/cn"; |
| @@ -36,26 +36,34 @@ export function SidebarAccount(props: { collapsed?: boolean; onLogout: () => voi | |||
| 36 | {(u) => { | 36 | {(u) => { |
| 37 | const name = () => displayName(u()); | 37 | const name = () => displayName(u()); |
| 38 | return ( | 38 | return ( |
| 39 | - <div class={cn("shrink-0 border-t border-border/80 p-2 pb-1.5", props.collapsed && "px-2")}> | 39 | + <div class={cn("shrink-0 border-t border-border/80 p-2", props.collapsed && "px-2 py-2") }> |
| 40 | <DropdownMenu placement="right-end" gutter={8}> | 40 | <DropdownMenu placement="right-end" gutter={8}> |
| 41 | <DropdownMenuTrigger | 41 | <DropdownMenuTrigger |
| 42 | class={cn( | 42 | class={cn( |
| 43 | - "flex w-full items-center rounded-md text-left outline-none transition-colors", | 43 | + "flex w-full items-center text-left outline-none transition-colors", |
| 44 | - "hover:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring data-[expanded]:bg-muted/70", | 44 | + "focus-visible:ring-2 focus-visible:ring-ring", |
| 45 | - props.collapsed ? "h-9 justify-center px-0" : "gap-1.5 px-2", | 45 | + props.collapsed |
| 46 | - props.collapsed ? "" : "h-10", | 46 | + ? "h-9 justify-center rounded-lg px-0 hover:bg-muted/70 data-[expanded]:bg-muted/70" |
| 47 | + : "h-12 gap-2 rounded-lg border border-border/80 bg-card/70 px-2 shadow-sm hover:bg-muted/50 data-[expanded]:bg-muted/50", | ||
| 47 | )} | 48 | )} |
| 48 | aria-label={t("nav.account")} | 49 | aria-label={t("nav.account")} |
| 49 | > | 50 | > |
| 50 | - <span class="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-[11px] font-bold text-primary-foreground"> | 51 | + <span |
| 52 | + class={cn( | ||
| 53 | + "flex shrink-0 items-center justify-center rounded-full bg-primary text-[11px] font-bold text-primary-foreground shadow-sm ring-1 ring-border/70", | ||
| 54 | + props.collapsed ? "h-8 w-8" : "h-8 w-8", | ||
| 55 | + )} | ||
| 56 | + > | ||
| 51 | {initials(name())} | 57 | {initials(name())} |
| 52 | </span> | 58 | </span> |
| 53 | <Show when={!props.collapsed}> | 59 | <Show when={!props.collapsed}> |
| 54 | <span class="min-w-0 flex-1"> | 60 | <span class="min-w-0 flex-1"> |
| 55 | - <span class="block truncate text-sm font-semibold">{name()}</span> | 61 | + <span class="block truncate text-[13px] font-semibold leading-4">{name()}</span> |
| 56 | - <span class="block text-[10px] text-muted-foreground">{t(`role.${u().role}` as MessageKey)}</span> | 62 | + <span class="block truncate text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground"> |
| 63 | + {t(`role.${u().role}` as MessageKey)} | ||
| 64 | + </span> | ||
| 57 | </span> | 65 | </span> |
| 58 | - <IconChevronRight class="h-4 w-4 shrink-0 text-muted-foreground transition-transform data-[expanded]:rotate-90" /> | 66 | + <IconChevronRight class="h-3.5 w-3.5 shrink-0 text-muted-foreground" /> |
| 59 | </Show> | 67 | </Show> |
| 60 | </DropdownMenuTrigger> | 68 | </DropdownMenuTrigger> |
| 61 | 69 | ||
| @@ -78,6 +86,11 @@ export function SidebarAccount(props: { collapsed?: boolean; onLogout: () => voi | |||
| 78 | <span class="text-xs text-muted-foreground">{prefs.locale() === "tr" ? "TR" : "EN"}</span> | 86 | <span class="text-xs text-muted-foreground">{prefs.locale() === "tr" ? "TR" : "EN"}</span> |
| 79 | </DropdownMenuItem> | 87 | </DropdownMenuItem> |
| 80 | <DropdownMenuSeparator /> | 88 | <DropdownMenuSeparator /> |
| 89 | + <DropdownMenuItem class="rounded-md" onSelect={() => void navigate({ to: "/guide" })}> | ||
| 90 | + <IconGuide class="h-4 w-4 shrink-0" /> | ||
| 91 | + <span>{t("nav.guide")}</span> | ||
| 92 | + </DropdownMenuItem> | ||
| 93 | + <DropdownMenuSeparator /> | ||
| 81 | <DropdownMenuItem destructive class="rounded-md" onSelect={() => void props.onLogout()}> | 94 | <DropdownMenuItem destructive class="rounded-md" onSelect={() => void props.onLogout()}> |
| 82 | <IconLogout class="h-4 w-4 shrink-0" /> | 95 | <IconLogout class="h-4 w-4 shrink-0" /> |
| 83 | <span>{t("nav.logout")}</span> | 96 | <span>{t("nav.logout")}</span> |
src/components/ui/icons.tsxmodified+9 -0
| @@ -199,6 +199,15 @@ export function IconMenu(props: IconProps) { | |||
| 199 | ); | 199 | ); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | +export function IconPanelLeft(props: IconProps) { | ||
| 203 | + return ( | ||
| 204 | + <Svg {...props}> | ||
| 205 | + <rect width="18" height="18" x="3" y="3" rx="2" /> | ||
| 206 | + <path d="M9 3v18" /> | ||
| 207 | + </Svg> | ||
| 208 | + ); | ||
| 209 | +} | ||
| 210 | + | ||
| 202 | export function IconBook(props: IconProps) { | 211 | export function IconBook(props: IconProps) { |
| 203 | return ( | 212 | return ( |
| 204 | <Svg {...props}> | 213 | <Svg {...props}> |
src/components/users/user-table.tsxmodified+31 -8
| @@ -11,11 +11,24 @@ import { | |||
| 11 | } from "@/components/ui/table"; | 11 | } from "@/components/ui/table"; |
| 12 | import { Select } from "@/components/ui/select"; | 12 | import { Select } from "@/components/ui/select"; |
| 13 | import { Button } from "@/components/ui/button"; | 13 | import { Button } from "@/components/ui/button"; |
| 14 | +import { Badge } from "@/components/ui/badge"; | ||
| 14 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 15 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 15 | import { IconCheck } from "@/components/ui/icons"; | 16 | import { IconCheck } from "@/components/ui/icons"; |
| 16 | import { ROLES } from "@/lib/roles"; | 17 | import { ROLES } from "@/lib/roles"; |
| 18 | +import { cn } from "@/lib/cn"; | ||
| 17 | import { useT } from "@/stores/preferences-context"; | 19 | import { useT } from "@/stores/preferences-context"; |
| 18 | 20 | ||
| 21 | +function displayName(user: User): string { | ||
| 22 | + return [user.name, user.surname].filter(Boolean).join(" ") || "—"; | ||
| 23 | +} | ||
| 24 | + | ||
| 25 | +function roleTone(role: Role): string { | ||
| 26 | + if (role === "admin") return "border-red-500/30 bg-red-500/10 text-red-700 dark:text-red-300"; | ||
| 27 | + if (role === "manager") return "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300"; | ||
| 28 | + if (role === "teacher") return "border-blue-500/30 bg-blue-500/10 text-blue-700 dark:text-blue-300"; | ||
| 29 | + return "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"; | ||
| 30 | +} | ||
| 31 | + | ||
| 19 | function UserRoleRow(props: { | 32 | function UserRoleRow(props: { |
| 20 | user: User; | 33 | user: User; |
| 21 | currentUserId: string; | 34 | currentUserId: string; |
| @@ -28,12 +41,19 @@ function UserRoleRow(props: { | |||
| 28 | const dirty = () => pendingRole() !== props.user.role; | 41 | const dirty = () => pendingRole() !== props.user.role; |
| 29 | 42 | ||
| 30 | return ( | 43 | return ( |
| 31 | - <TableRow class="h-16"> | 44 | + <TableRow> |
| 32 | <TableCell class="font-medium">{props.user.username}</TableCell> | 45 | <TableCell class="font-medium">{props.user.username}</TableCell> |
| 33 | - <TableCell class="font-mono text-xs text-muted-foreground">{props.user.id}</TableCell> | 46 | + <TableCell>{displayName(props.user)}</TableCell> |
| 34 | - <TableCell class="space-y-2"> | 47 | + <TableCell class="text-muted-foreground">{props.user.email || "—"}</TableCell> |
| 48 | + <TableCell> | ||
| 49 | + <Badge variant="outline" class={cn("mono uppercase tracking-[0.08em]", roleTone(props.user.role))}> | ||
| 50 | + {t(`role.${props.user.role}` as MessageKey)} | ||
| 51 | + </Badge> | ||
| 52 | + </TableCell> | ||
| 53 | + <TableCell class="mono text-xs text-muted-foreground">{props.user.id}</TableCell> | ||
| 54 | + <TableCell class="w-52"> | ||
| 35 | <Select | 55 | <Select |
| 36 | - class="h-10 rounded-md" | 56 | + class="h-8 rounded-sm text-xs" |
| 37 | value={pendingRole()} | 57 | value={pendingRole()} |
| 38 | disabled={isSelf()} | 58 | disabled={isSelf()} |
| 39 | onChange={(e) => setPendingRole(e.currentTarget.value as Role)} | 59 | onChange={(e) => setPendingRole(e.currentTarget.value as Role)} |
| @@ -44,7 +64,7 @@ function UserRoleRow(props: { | |||
| 44 | ))} | 64 | ))} |
| 45 | </Select> | 65 | </Select> |
| 46 | <Show when={!isSelf() && dirty()}> | 66 | <Show when={!isSelf() && dirty()}> |
| 47 | - <Button type="button" size="sm" class="rounded-md" onClick={() => setConfirmOpen(true)}> | 67 | + <Button type="button" size="sm" class="mt-2 h-7 rounded-sm px-2" onClick={() => setConfirmOpen(true)}> |
| 48 | <IconCheck /> | 68 | <IconCheck /> |
| 49 | {t("common.update")} | 69 | {t("common.update")} |
| 50 | </Button> | 70 | </Button> |
| @@ -75,13 +95,16 @@ export function UserTable(props: { | |||
| 75 | }) { | 95 | }) { |
| 76 | const t = useT(); | 96 | const t = useT(); |
| 77 | return ( | 97 | return ( |
| 78 | - <div class="overflow-hidden rounded-lg bg-background/40"> | 98 | + <div class="data-table-wrap"> |
| 79 | - <Table> | 99 | + <Table class="data-table"> |
| 80 | <TableHeader> | 100 | <TableHeader> |
| 81 | <TableRow> | 101 | <TableRow> |
| 82 | <TableHead>{t("admin.username")}</TableHead> | 102 | <TableHead>{t("admin.username")}</TableHead> |
| 103 | + <TableHead>{t("profile.name")}</TableHead> | ||
| 104 | + <TableHead>{t("profile.email")}</TableHead> | ||
| 105 | + <TableHead>{t("admin.role")}</TableHead> | ||
| 83 | <TableHead>{t("admin.id")}</TableHead> | 106 | <TableHead>{t("admin.id")}</TableHead> |
| 84 | - <TableHead class="w-56">{t("admin.role")}</TableHead> | 107 | + <TableHead class="w-52">{t("common.update")}</TableHead> |
| 85 | </TableRow> | 108 | </TableRow> |
| 86 | </TableHeader> | 109 | </TableHeader> |
| 87 | <TableBody> | 110 | <TableBody> |
src/i18n/messages.tsmodified+17 -2
| @@ -25,6 +25,11 @@ export type MessageKey = | |||
| 25 | | "nav.expand" | 25 | | "nav.expand" |
| 26 | | "nav.account" | 26 | | "nav.account" |
| 27 | | "nav.preferences" | 27 | | "nav.preferences" |
| 28 | + | "nav.group.students" | ||
| 29 | + | "nav.group.classes" | ||
| 30 | + | "nav.group.grades" | ||
| 31 | + | "nav.group.reports" | ||
| 32 | + | "nav.group.settings" | ||
| 28 | | "common.loading" | 33 | | "common.loading" |
| 29 | | "common.cancel" | 34 | | "common.cancel" |
| 30 | | "common.save" | 35 | | "common.save" |
| @@ -449,6 +454,11 @@ const en: Dict = { | |||
| 449 | "nav.expand": "Expand sidebar", | 454 | "nav.expand": "Expand sidebar", |
| 450 | "nav.account": "Account", | 455 | "nav.account": "Account", |
| 451 | "nav.preferences": "Preferences", | 456 | "nav.preferences": "Preferences", |
| 457 | + "nav.group.students": "Students", | ||
| 458 | + "nav.group.classes": "Classes", | ||
| 459 | + "nav.group.grades": "Grades", | ||
| 460 | + "nav.group.reports": "Reports", | ||
| 461 | + "nav.group.settings": "Settings", | ||
| 452 | "common.loading": "Loading…", | 462 | "common.loading": "Loading…", |
| 453 | "common.cancel": "Cancel", | 463 | "common.cancel": "Cancel", |
| 454 | "common.save": "Save", | 464 | "common.save": "Save", |
| @@ -731,7 +741,7 @@ const en: Dict = { | |||
| 731 | "role.student": "Student", | 741 | "role.student": "Student", |
| 732 | "role.teacher": "Teacher", | 742 | "role.teacher": "Teacher", |
| 733 | "role.manager": "Manager", | 743 | "role.manager": "Manager", |
| 734 | - "role.admin": "Admin", | 744 | + "role.admin": "ADMIN", |
| 735 | "courses.title": "Courses", | 745 | "courses.title": "Courses", |
| 736 | "courses.subtitle": "Classes, enrollment, and course exams live here.", | 746 | "courses.subtitle": "Classes, enrollment, and course exams live here.", |
| 737 | "courses.create": "New course", | 747 | "courses.create": "New course", |
| @@ -886,6 +896,11 @@ const tr: Dict = { | |||
| 886 | "nav.expand": "Kenar çubuğunu genişlet", | 896 | "nav.expand": "Kenar çubuğunu genişlet", |
| 887 | "nav.account": "Hesap", | 897 | "nav.account": "Hesap", |
| 888 | "nav.preferences": "Tercihler", | 898 | "nav.preferences": "Tercihler", |
| 899 | + "nav.group.students": "Öğrenciler", | ||
| 900 | + "nav.group.classes": "Sınıflar", | ||
| 901 | + "nav.group.grades": "Notlar", | ||
| 902 | + "nav.group.reports": "Raporlar", | ||
| 903 | + "nav.group.settings": "Ayarlar", | ||
| 889 | "common.loading": "Yükleniyor…", | 904 | "common.loading": "Yükleniyor…", |
| 890 | "common.cancel": "Vazgeç", | 905 | "common.cancel": "Vazgeç", |
| 891 | "common.save": "Kaydet", | 906 | "common.save": "Kaydet", |
| @@ -1168,7 +1183,7 @@ const tr: Dict = { | |||
| 1168 | "role.student": "Öğrenci", | 1183 | "role.student": "Öğrenci", |
| 1169 | "role.teacher": "Öğretmen", | 1184 | "role.teacher": "Öğretmen", |
| 1170 | "role.manager": "Yönetici", | 1185 | "role.manager": "Yönetici", |
| 1171 | - "role.admin": "Admin", | 1186 | + "role.admin": "ADMIN", |
| 1172 | "courses.title": "Dersler", | 1187 | "courses.title": "Dersler", |
| 1173 | "courses.subtitle": "Sınıflar, kayıt ve ders sınavları burada.", | 1188 | "courses.subtitle": "Sınıflar, kayıt ve ders sınavları burada.", |
| 1174 | "courses.create": "Yeni ders", | 1189 | "courses.create": "Yeni ders", |
src/index.cssmodified+113 -86
| @@ -6,66 +6,83 @@ | |||
| 6 | 6 | ||
| 7 | @layer base { | 7 | @layer base { |
| 8 | :root { | 8 | :root { |
| 9 | - --background: 150 20% 98%; | 9 | + --ui-bg: 180 7% 97%; |
| 10 | - --foreground: 168 35% 10%; | 10 | + --ui-surface-1: 0 0% 100%; |
| 11 | - --card: 0 0% 100%; | 11 | + --ui-surface-2: 180 8% 95%; |
| 12 | - --card-foreground: 168 35% 10%; | 12 | + --ui-surface-3: 180 7% 91%; |
| 13 | - --popover: 0 0% 100%; | 13 | + --ui-border-1: 180 7% 86%; |
| 14 | - --popover-foreground: 168 35% 10%; | 14 | + --ui-border-2: 180 6% 79%; |
| 15 | - --primary: 163 72% 28%; | 15 | + --ui-text-1: 180 11% 7%; |
| 16 | - --primary-foreground: 150 40% 98%; | 16 | + --ui-text-2: 180 6% 31%; |
| 17 | - --secondary: 156 25% 94%; | 17 | + --ui-text-3: 180 4% 49%; |
| 18 | - --secondary-foreground: 168 35% 14%; | 18 | + --ui-accent: 217 91% 60%; |
| 19 | - --muted: 150 16% 94%; | 19 | + --ui-accent-muted: 214 95% 93%; |
| 20 | - --muted-foreground: 168 10% 40%; | 20 | + --ui-success: 142 72% 29%; |
| 21 | - --accent: 168 45% 92%; | 21 | + --ui-success-muted: 138 76% 97%; |
| 22 | - --accent-foreground: 163 72% 18%; | 22 | + --ui-warning: 32 95% 44%; |
| 23 | - --destructive: 0 72% 51%; | 23 | + --ui-warning-muted: 48 96% 89%; |
| 24 | - --destructive-foreground: 0 0% 98%; | 24 | + --ui-danger: 0 74% 42%; |
| 25 | - --border: 160 14% 88%; | 25 | + --ui-danger-muted: 0 93% 94%; |
| 26 | - --input: 160 14% 88%; | 26 | + --ui-info: 200 98% 33%; |
| 27 | - --ring: 163 72% 28%; | 27 | + --ui-info-muted: 204 94% 94%; |
| 28 | - --radius: 0.875rem; | 28 | + --space-1: 0.25rem; |
| 29 | - --success: 152 60% 36%; | 29 | + --space-2: 0.5rem; |
| 30 | - --warning: 38 92% 50%; | 30 | + --space-3: 0.75rem; |
| 31 | - --info: 210 80% 48%; | 31 | + --space-4: 1rem; |
| 32 | - --surface-elevated: 0 0% 100%; | 32 | + --space-5: 1.25rem; |
| 33 | - --sidebar: 160 25% 97%; | 33 | + --space-6: 1.5rem; |
| 34 | - --sidebar-foreground: 168 20% 20%; | 34 | + --space-8: 2rem; |
| 35 | - --hero-from: 163 55% 92%; | 35 | + --background: var(--ui-bg); |
| 36 | - --hero-to: 190 50% 94%; | 36 | + --foreground: var(--ui-text-1); |
| 37 | - --glow: 163 72% 40%; | 37 | + --card: var(--ui-surface-1); |
| 38 | + --card-foreground: var(--ui-text-1); | ||
| 39 | + --popover: var(--ui-surface-1); | ||
| 40 | + --popover-foreground: var(--ui-text-1); | ||
| 41 | + --primary: var(--ui-accent); | ||
| 42 | + --primary-foreground: 0 0% 100%; | ||
| 43 | + --secondary: var(--ui-surface-2); | ||
| 44 | + --secondary-foreground: var(--ui-text-1); | ||
| 45 | + --muted: var(--ui-surface-2); | ||
| 46 | + --muted-foreground: var(--ui-text-2); | ||
| 47 | + --accent: var(--ui-accent-muted); | ||
| 48 | + --accent-foreground: 217 91% 28%; | ||
| 49 | + --destructive: var(--ui-danger); | ||
| 50 | + --destructive-foreground: 0 0% 100%; | ||
| 51 | + --border: var(--ui-border-1); | ||
| 52 | + --input: var(--ui-border-1); | ||
| 53 | + --ring: var(--ui-accent); | ||
| 54 | + --radius: 0.625rem; | ||
| 55 | + --success: var(--ui-success); | ||
| 56 | + --warning: var(--ui-warning); | ||
| 57 | + --info: var(--ui-info); | ||
| 58 | + --surface-elevated: var(--ui-surface-1); | ||
| 59 | + --sidebar: var(--ui-surface-1); | ||
| 60 | + --sidebar-foreground: var(--ui-text-2); | ||
| 38 | } | 61 | } |
| 39 | 62 | ||
| 40 | [data-kb-theme="dark"] { | 63 | [data-kb-theme="dark"] { |
| 41 | - --background: 220 9% 6%; | 64 | + --ui-bg: 210 12% 5%; |
| 42 | - --foreground: 220 12% 92%; | 65 | + --ui-surface-1: 200 10% 8%; |
| 43 | - --card: 220 8% 9%; | 66 | + --ui-surface-2: 200 10% 11%; |
| 44 | - --card-foreground: 220 12% 92%; | 67 | + --ui-surface-3: 200 10% 16%; |
| 45 | - --popover: 220 8% 11%; | 68 | + --ui-border-1: 200 10% 18%; |
| 46 | - --popover-foreground: 220 12% 92%; | 69 | + --ui-border-2: 200 10% 24%; |
| 47 | - --primary: 220 88% 62%; | 70 | + --ui-text-1: 180 14% 94%; |
| 48 | - --primary-foreground: 220 20% 98%; | 71 | + --ui-text-2: 180 8% 67%; |
| 49 | - --secondary: 220 7% 15%; | 72 | + --ui-text-3: 190 6% 48%; |
| 50 | - --secondary-foreground: 220 10% 88%; | 73 | + --ui-accent: 213 94% 68%; |
| 51 | - --muted: 220 7% 13%; | 74 | + --ui-accent-muted: 213 47% 17%; |
| 52 | - --muted-foreground: 220 7% 62%; | 75 | + --ui-success: 142 69% 58%; |
| 53 | - --accent: 220 9% 17%; | 76 | + --ui-success-muted: 142 39% 10%; |
| 54 | - --accent-foreground: 220 15% 96%; | 77 | + --ui-warning: 38 92% 50%; |
| 55 | - --destructive: 0 70% 58%; | 78 | + --ui-warning-muted: 35 64% 13%; |
| 56 | - --destructive-foreground: 0 0% 98%; | 79 | + --ui-danger: 0 91% 71%; |
| 57 | - --border: 220 8% 18%; | 80 | + --ui-danger-muted: 0 50% 14%; |
| 58 | - --input: 220 8% 18%; | 81 | + --ui-info: 199 89% 63%; |
| 59 | - --ring: 220 88% 62%; | 82 | + --ui-info-muted: 200 50% 13%; |
| 60 | - --success: 128 48% 55%; | 83 | + --primary-foreground: 210 20% 98%; |
| 61 | - --warning: 38 90% 56%; | 84 | + --accent-foreground: 213 94% 86%; |
| 62 | - --info: 210 80% 60%; | 85 | + --destructive-foreground: 0 0% 100%; |
| 63 | - --surface-elevated: 220 8% 12%; | ||
| 64 | - --sidebar: 220 10% 4%; | ||
| 65 | - --sidebar-foreground: 220 10% 86%; | ||
| 66 | - --hero-from: 220 10% 13%; | ||
| 67 | - --hero-to: 220 8% 10%; | ||
| 68 | - --glow: 220 88% 54%; | ||
| 69 | } | 86 | } |
| 70 | 87 | ||
| 71 | * { | 88 | * { |
| @@ -78,10 +95,6 @@ | |||
| 78 | 95 | ||
| 79 | body { | 96 | body { |
| 80 | @apply min-h-screen bg-background font-sans text-foreground antialiased; | 97 | @apply min-h-screen bg-background font-sans text-foreground antialiased; |
| 81 | - background-image: | ||
| 82 | - radial-gradient(ellipse 80% 50% at 10% -10%, hsl(var(--glow) / 0.10), transparent), | ||
| 83 | - radial-gradient(ellipse 60% 40% at 100% 0%, hsl(var(--info) / 0.05), transparent); | ||
| 84 | - background-attachment: fixed; | ||
| 85 | } | 98 | } |
| 86 | 99 | ||
| 87 | ::selection { | 100 | ::selection { |
| @@ -91,47 +104,61 @@ | |||
| 91 | 104 | ||
| 92 | @layer components { | 105 | @layer components { |
| 93 | .font-display { | 106 | .font-display { |
| 94 | - font-family: "Fraunces", Georgia, serif; | 107 | + font-family: "DM Sans", system-ui, sans-serif; |
| 95 | } | 108 | } |
| 96 | 109 | ||
| 97 | .surface-card { | 110 | .surface-card { |
| 98 | - @apply rounded-xl border bg-card text-card-foreground shadow-sm; | 111 | + @apply rounded-md border bg-card text-card-foreground shadow-none; |
| 99 | } | 112 | } |
| 100 | 113 | ||
| 101 | [data-kb-theme="dark"] .surface-card { | 114 | [data-kb-theme="dark"] .surface-card { |
| 102 | @apply shadow-none; | 115 | @apply shadow-none; |
| 103 | - border-color: hsl(var(--border) / 0.82); | 116 | + border-color: hsl(var(--border)); |
| 104 | - background: | ||
| 105 | - linear-gradient(180deg, hsl(var(--card) / 0.98), hsl(var(--card) / 0.92)), | ||
| 106 | - radial-gradient(circle at 0 0, hsl(var(--primary) / 0.06), transparent 35%); | ||
| 107 | } | 117 | } |
| 108 | 118 | ||
| 109 | - .hero-panel { | 119 | + .stat-tile { |
| 110 | - background: linear-gradient(135deg, hsl(var(--hero-from)), hsl(var(--hero-to))); | 120 | + @apply surface-card relative overflow-hidden p-4 transition-colors duration-150 hover:border-primary/35; |
| 111 | } | 121 | } |
| 112 | 122 | ||
| 113 | - .stat-tile { | 123 | + .focus-ring { |
| 114 | - @apply surface-card relative overflow-hidden p-5 transition-all duration-200 hover:-translate-y-0.5 hover:border-primary/25; | 124 | + @apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background; |
| 115 | } | 125 | } |
| 116 | 126 | ||
| 117 | - [data-kb-theme="dark"] .stat-tile { | 127 | + .data-shell { |
| 118 | - background: | 128 | + @apply rounded-lg border border-border bg-card; |
| 119 | - linear-gradient(180deg, hsl(var(--surface-elevated) / 0.96), hsl(var(--card) / 0.88)), | ||
| 120 | - radial-gradient(circle at 100% 0, hsl(var(--primary) / 0.09), transparent 34%); | ||
| 121 | } | 129 | } |
| 122 | 130 | ||
| 123 | - .stat-tile::after { | 131 | + .data-table-wrap { |
| 124 | - content: ""; | 132 | + @apply max-h-[62vh] overflow-auto rounded-lg border border-border bg-card; |
| 125 | - position: absolute; | ||
| 126 | - inset: auto -20% -40% auto; | ||
| 127 | - width: 8rem; | ||
| 128 | - height: 8rem; | ||
| 129 | - border-radius: var(--radius); | ||
| 130 | - background: hsl(var(--primary) / 0.08); | ||
| 131 | - pointer-events: none; | ||
| 132 | } | 133 | } |
| 133 | 134 | ||
| 134 | - .focus-ring { | 135 | + .data-table { |
| 135 | - @apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background; | 136 | + @apply w-full caption-bottom text-[13px]; |
| 137 | + } | ||
| 138 | + | ||
| 139 | + .data-table thead { | ||
| 140 | + @apply sticky top-0 z-10 border-b border-border bg-muted text-muted-foreground; | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + .data-table th { | ||
| 144 | + @apply h-9 whitespace-nowrap px-3 text-left text-[11px] font-semibold uppercase tracking-[0.08em]; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + .data-table td { | ||
| 148 | + @apply h-9 whitespace-nowrap px-3 py-1.5 align-middle; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + .data-table tbody tr { | ||
| 152 | + @apply border-b border-border/80 hover:bg-muted/60; | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + .data-table tbody tr:nth-child(even) { | ||
| 156 | + background-color: hsl(var(--muted) / 0.28); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + .num, | ||
| 160 | + .mono { | ||
| 161 | + font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; | ||
| 162 | + font-variant-numeric: tabular-nums; | ||
| 136 | } | 163 | } |
| 137 | } | 164 | } |
src/pages/admin-users-page.tsxmodified+34 -11
| @@ -1,4 +1,4 @@ | |||
| 1 | -import { Show, Suspense, createMemo, createResource, createSignal } from "solid-js"; | 1 | +import { For, Show, Suspense, createMemo, createResource, createSignal } from "solid-js"; |
| 2 | import { getUsers } from "@/api/getUsers"; | 2 | import { getUsers } from "@/api/getUsers"; |
| 3 | import { patchUserRole } from "@/api/patchUserRole"; | 3 | import { patchUserRole } from "@/api/patchUserRole"; |
| 4 | import { formatApiError } from "@/api/client"; | 4 | import { formatApiError } from "@/api/client"; |
| @@ -8,8 +8,11 @@ import { PageHeader } from "@/components/layout/page-header"; | |||
| 8 | import { UserSearchSelect } from "@/components/users/user-search-select"; | 8 | import { UserSearchSelect } from "@/components/users/user-search-select"; |
| 9 | import { UserTable } from "@/components/users/user-table"; | 9 | import { UserTable } from "@/components/users/user-table"; |
| 10 | import { PageSpinner } from "@/components/ui/page-spinner"; | 10 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 11 | +import { Badge } from "@/components/ui/badge"; | ||
| 11 | import { useAuth } from "@/stores/auth-context"; | 12 | import { useAuth } from "@/stores/auth-context"; |
| 12 | import { useT } from "@/stores/preferences-context"; | 13 | import { useT } from "@/stores/preferences-context"; |
| 14 | +import type { MessageKey } from "@/i18n/messages"; | ||
| 15 | +import { ROLES } from "@/lib/roles"; | ||
| 13 | 16 | ||
| 14 | export default function AdminUsersPage() { | 17 | export default function AdminUsersPage() { |
| 15 | return ( | 18 | return ( |
| @@ -31,6 +34,7 @@ function AdminUsersContent() { | |||
| 31 | if (!id) return list; | 34 | if (!id) return list; |
| 32 | return list.filter((user) => user.id === id); | 35 | return list.filter((user) => user.id === id); |
| 33 | }); | 36 | }); |
| 37 | + const roleCount = (role: Role) => users()?.filter((user) => user.role === role).length ?? 0; | ||
| 34 | 38 | ||
| 35 | const onRoleChange = async (userId: string, role: Role) => { | 39 | const onRoleChange = async (userId: string, role: Role) => { |
| 36 | setError(""); | 40 | setError(""); |
| @@ -44,19 +48,29 @@ function AdminUsersContent() { | |||
| 44 | 48 | ||
| 45 | return ( | 49 | return ( |
| 46 | <div class="space-y-6"> | 50 | <div class="space-y-6"> |
| 47 | - <PageHeader | 51 | + <div class="space-y-2"> |
| 48 | - accent="violet" | 52 | + <div class="flex flex-wrap items-center gap-1 text-xs text-muted-foreground"> |
| 49 | - eyebrow={t("nav.users")} | 53 | + <span>{t("nav.group.students")}</span> |
| 50 | - title={t("admin.title")} | 54 | + <span>/</span> |
| 51 | - description={t("admin.subtitle")} | 55 | + <span>{t("nav.users")}</span> |
| 52 | - /> | 56 | + </div> |
| 57 | + <PageHeader accent="violet" eyebrow={t("nav.users")} title={t("admin.title")} description={t("admin.subtitle")} /> | ||
| 58 | + </div> | ||
| 53 | 59 | ||
| 54 | {error() && <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p>} | 60 | {error() && <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive">{error()}</p>} |
| 55 | 61 | ||
| 56 | - <div class="surface-card space-y-4 p-5"> | 62 | + <section class="grid gap-3 sm:grid-cols-2 xl:grid-cols-5"> |
| 57 | - <div> | 63 | + <Metric label={t("common.all")} value={users()?.length ?? 0} /> |
| 58 | - <h2 class="font-display text-lg font-semibold">{t("nav.users")}</h2> | 64 | + <For each={ROLES}>{(role) => <Metric label={t(`role.${role}` as MessageKey)} value={roleCount(role)} />}</For> |
| 59 | - <p class="mt-1 text-sm text-muted-foreground">{t("admin.subtitle")}</p> | 65 | + </section> |
| 66 | + | ||
| 67 | + <div class="data-shell space-y-4 p-4"> | ||
| 68 | + <div class="flex flex-wrap items-center justify-between gap-3"> | ||
| 69 | + <div> | ||
| 70 | + <h2 class="font-display text-lg font-semibold">{t("nav.users")}</h2> | ||
| 71 | + <p class="mt-1 text-sm text-muted-foreground">{visibleUsers().length} / {users()?.length ?? 0}</p> | ||
| 72 | + </div> | ||
| 73 | + <Badge variant="outline" class="mono rounded-sm uppercase tracking-[0.08em]">Directory</Badge> | ||
| 60 | </div> | 74 | </div> |
| 61 | <UserSearchSelect | 75 | <UserSearchSelect |
| 62 | id="admin-user-search" | 76 | id="admin-user-search" |
| @@ -89,3 +103,12 @@ function AdminUsersContent() { | |||
| 89 | </div> | 103 | </div> |
| 90 | ); | 104 | ); |
| 91 | } | 105 | } |
| 106 | + | ||
| 107 | +function Metric(props: { label: string; value: number }) { | ||
| 108 | + return ( | ||
| 109 | + <article class="data-shell p-4"> | ||
| 110 | + <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{props.label}</p> | ||
| 111 | + <p class="mono mt-2 text-2xl font-semibold tabular-nums">{props.value}</p> | ||
| 112 | + </article> | ||
| 113 | + ); | ||
| 114 | +} | ||