⚡ cut page-load requests and sweep UI defects across the app
Browse files at this commitf04b93a726bf4f5ed7f3c521905ef45b853b559cParent: c513a0c- perf
- ⚡ cut page-load requests and sweep UI defects across the app
146 changed files +1911 -1072
- .claude/skills/ui-conventions/SKILL.md +5 -4
- docs/ui/ui-redesign-tokens.md +9 -4
- src/components/ai/insights-board.tsx +3 -1
- src/components/ai/note-studio-panel.tsx +1 -1
- src/components/ai/studio-output-library.test.tsx +7 -7
- src/components/ai/studio-output-library.tsx +21 -22
- src/components/appointments/publish-slots-form.tsx +2 -2
- src/components/attendance/attendance-report-view.tsx +20 -10
- src/components/classes/blueprint-panel.tsx +11 -4
- src/components/classes/blueprints-tab.tsx +28 -14
- src/components/classes/class-edit-panel.tsx +12 -3
- src/components/courses/course-edit-panel.tsx +3 -2
- src/components/courses/course-offerings-panel.tsx +12 -6
- src/components/courses/course-subjects-panel.tsx +19 -8
- src/components/courses/offering-panel.tsx +20 -3
- src/components/dashboard/quick-link-column.tsx +1 -1
- src/components/events/attendance-table.tsx +12 -13
- src/components/events/event-roll-call.tsx +17 -18
- src/components/exams/bank-question-picker.tsx +1 -1
- src/components/exams/exam-audience-panel.tsx +3 -0
- src/components/exams/exam-questions-panel.tsx +29 -31
- src/components/exams/exam-room-ws.tsx +12 -10
- src/components/exams/grade-form.tsx +1 -1
- src/components/exams/question-form.tsx +10 -8
- src/components/homework/course-homework-panel.tsx +14 -5
- src/components/homework/homework-report-view.tsx +12 -6
- src/components/homework/homework-submission-panel.tsx +46 -20
- src/components/homework/homework-submissions-panel.tsx +13 -7
- src/components/insights/insight-run-report.tsx +14 -20
- src/components/insights/insight-runs-table.tsx +44 -6
- src/components/insights/insight-students-table.tsx +22 -11
- src/components/instances/exam-weights-editor.tsx +1 -1
- src/components/instances/subject-set-editor.tsx +6 -2
- src/components/instances/weekly-plan-table.tsx +1 -1
- src/components/layout/app-shell.tsx +7 -3
- src/components/layout/celebi-composer.tsx +2 -2
- src/components/layout/celebi-panel.tsx +7 -7
- src/components/layout/command-palette.tsx +6 -5
- src/components/layout/mobile-quick-actions.tsx +4 -1
- src/components/layout/nav-items.ts +24 -3
- src/components/layout/notification-center.tsx +4 -1
- src/components/layout/notification-feed.ts +6 -1
- src/components/layout/notification-list.tsx +3 -3
- src/components/layout/page-center.tsx +18 -3
- src/components/layout/page-header.tsx +4 -1
- src/components/layout/page-load-error.tsx +1 -1
- src/components/layout/record-not-found.tsx +1 -1
- src/components/layout/theme-mode-control.tsx +5 -5
- src/components/marks/karne-view.tsx +2 -2
- src/components/marks/marks-report-view.tsx +17 -10
- src/components/meals/meal-menu-row.tsx +1 -1
- src/components/meals/meal-service-table.tsx +6 -4
- src/components/meals/meal-student-record-panel.tsx +4 -1
- src/components/meals/meal-tag-checkboxes.tsx +1 -1
- src/components/meals/meal-walk-in-panel.tsx +1 -1
- src/components/messages/gmail-compose-box.tsx +7 -5
- src/components/messages/gmail-mail-detail.tsx +32 -20
- src/components/messages/gmail-mail-row.tsx +28 -11
- src/components/notes/note-card.tsx +17 -16
- src/components/notes/note-document.tsx +14 -14
- src/components/notes/note-files-panel.tsx +5 -5
- src/components/notes/note-import-panel.tsx +21 -11
- src/components/notes/podcast-panel.tsx +4 -8
- src/components/notes/rag-outputs-panel.tsx +1 -1
- src/components/pomodoro/pomodoro-log-view.tsx +5 -7
- src/components/question-generation/generated-question-card.tsx +3 -3
- src/components/rag/rag-composer.tsx +1 -1
- src/components/rag/rag-copy.ts +4 -0
- src/components/rag/rag-message-row.tsx +7 -2
- src/components/rag/rag-study-actions.tsx +4 -3
- src/components/rag/rag-study-panel.tsx +22 -3
- src/components/rag/rag-thread-list.tsx +20 -5
- src/components/sessions/course-sessions-panel.tsx +22 -13
- src/components/sessions/session-roll-call.tsx +16 -10
- src/components/system/not-found-page.tsx +4 -3
- src/components/ui/chart-line.tsx +33 -15
- src/components/ui/combobox.tsx +1 -0
- src/components/ui/data-section.tsx +7 -6
- src/components/ui/data-table-search.tsx +2 -2
- src/components/ui/data-table.tsx +11 -54
- src/components/ui/dialog.tsx +32 -7
- src/components/ui/dropdown-menu.tsx +4 -4
- src/components/ui/searchable-select.tsx +9 -0
- src/components/ui/side-panel.tsx +1 -1
- src/components/ui/table-row-actions.tsx +2 -2
- src/components/users/account-profile-dialog.tsx +12 -8
- src/components/users/roster-person-cell.tsx +3 -2
- src/components/users/user-avatar.tsx +4 -1
- src/components/users/user-table.tsx +3 -2
- src/components/whiteboard/board-bulk-invite.tsx +5 -4
- src/components/whiteboard/board-settings-panel.tsx +12 -9
- src/components/whiteboard/whiteboard-canvas.tsx +10 -7
- src/i18n/locales/en.ts +32 -8
- src/i18n/locales/tr.ts +35 -11
- src/i18n/messages.ts +24 -0
- src/index.css +7 -3
- src/lib/instance-labels.test.ts +25 -9
- src/lib/instance-labels.ts +105 -26
- src/lib/instance-options.ts +16 -30
- src/lib/scroll-restore.ts +59 -0
- src/pages/admin-user-detail-page.tsx +9 -7
- src/pages/appointments-page.tsx +23 -9
- src/pages/bank-question-detail-page.tsx +16 -23
- src/pages/builder-login-page.tsx +6 -6
- src/pages/builder-school-detail-page.tsx +4 -4
- src/pages/builder-schools-page.tsx +6 -3
- src/pages/calendar-page.tsx +77 -37
- src/pages/class-detail-page.tsx +8 -6
- src/pages/classes-page.tsx +23 -11
- src/pages/courses-page.test.tsx +2 -2
- src/pages/dashboard-page.test.tsx +2 -0
- src/pages/dashboard-page.tsx +19 -2
- src/pages/event-detail-page.tsx +3 -3
- src/pages/events-page.tsx +2 -5
- src/pages/exam-detail-page.tsx +9 -21
- src/pages/exam-room-page.tsx +7 -3
- src/pages/exams-page.tsx +9 -7
- src/pages/guide-page.tsx +17 -16
- src/pages/homework-detail-page.tsx +11 -7
- src/pages/homework-page.tsx +14 -7
- src/pages/license-modules-page.tsx +7 -3
- src/pages/live-monitor-page.tsx +29 -31
- src/pages/login-page.tsx +7 -7
- src/pages/marks-page.tsx +4 -2
- src/pages/messages-page.tsx +49 -15
- src/pages/my-students-page.tsx +26 -13
- src/pages/notes-page.tsx +26 -36
- src/pages/payment-statement-page.tsx +5 -1
- src/pages/payments-page.tsx +5 -3
- src/pages/pomodoro-page.tsx +25 -7
- src/pages/profile-page.tsx +3 -1
- src/pages/question-bank-page.tsx +2 -0
- src/pages/question-detail-page.tsx +7 -7
- src/pages/question-generation-page.tsx +22 -10
- src/pages/questions-page.tsx +31 -12
- src/pages/register-page.tsx +8 -8
- src/pages/settings-page.tsx +3 -2
- src/pages/staff-work-page.tsx +12 -8
- src/pages/student-attendance-page.tsx +11 -9
- src/pages/student-marks-page.tsx +64 -20
- src/pages/student-pomodoro-page.tsx +11 -9
- src/pages/students-roster-page.tsx +5 -3
- src/pages/teachers-roster-page.tsx +5 -3
- src/pages/terms-page.tsx +1 -1
- src/pages/whiteboards-page.tsx +16 -2
- src/pages/work-log-page.tsx +13 -18
.claude/skills/ui-conventions/SKILL.mdmodified+5 -4
| @@ -38,9 +38,9 @@ Active project reference docs (read the relevant one before changing that area): | |||
| 38 | 38 | ||
| 39 | ## Buttons | 39 | ## Buttons |
| 40 | 40 | ||
| 41 | -- Header create actions: compact icon+label, consistent size and current radius. | 41 | +- **Pill standard (2026-09-26):** every toolbar / header control — search, filter chips, action buttons, "Sütunlar", the "İşlem" row-action trigger — is a pill: `rounded-full`, `text-[13px]`, `h-8` from `sm`, `h-10` below `sm` and on touch. Use `TOOLBAR_CONTROL` (one control) / `TOOLBAR_SLOT` (wrapper sizing nested buttons+links) / `TOOLBAR_CARD` from `src/components/ui/data-toolbar.tsx`. DataTable `actions`/`filters`, DataSection/DataToolbar slots and PageHeader `actions` already apply it — pass plain `<Button size="sm">` and never add `rounded-lg`/`rounded-md`/`h-9` overrides. |
| 42 | -- Page header primary create/add: `size="sm" class="min-w-[7.5rem] rounded-lg"`. Secondary/import: `variant="outline"` with the same size/class. | 42 | +- Primary create/add is the default (filled) variant; secondary/import is `variant="outline"`. Filled buttons carry a transparent border with `bg-clip-padding` — never a border in the fill's own colour (it makes the button look bigger than its outlined neighbours). |
| 43 | -- Section/sub-panel header actions: `variant="outline" size="sm" class="rounded-lg"` unless matching a page header button. | 43 | +- An active filter chip (a `DropdownSelect` with `labelPrefix` whose value is not its first option) gets `data-filter-active` and a primary border. |
| 44 | - Actions inside sub-panels must not duplicate section headers — primary create/add/assign actions go in the header `actions` prop of the parent disclosure or page header. | 44 | - Actions inside sub-panels must not duplicate section headers — primary create/add/assign actions go in the header `actions` prop of the parent disclosure or page header. |
| 45 | 45 | ||
| 46 | ## Tables | 46 | ## Tables |
| @@ -48,7 +48,8 @@ Active project reference docs (read the relevant one before changing that area): | |||
| 48 | - Application tables must use `src/components/ui/data-table.tsx` `DataTable`. | 48 | - Application tables must use `src/components/ui/data-table.tsx` `DataTable`. |
| 49 | - Actions columns stay fixed at `w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap` to prevent localized headers like `"İŞLEMLER"` from changing their size. | 49 | - Actions columns stay fixed at `w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap` to prevent localized headers like `"İŞLEMLER"` from changing their size. |
| 50 | - Table-page headers fold into the `DataTable` title/description/actions area; do not render a separate `PageHeader` above table-primary pages. | 50 | - Table-page headers fold into the `DataTable` title/description/actions area; do not render a separate `PageHeader` above table-primary pages. |
| 51 | -- Search inputs, dropdown filters, filter buttons, and column controls share the same compact height/radius (`h-8 rounded-lg`, `text-[13px]`) unless the shared component changes the standard globally. Page-header primary actions may stay `h-9`. | 51 | +- Every list toolbar is one card (`TOOLBAR_CARD`), even when "Sütunlar" is its only control; its controls follow the pill standard above. |
| 52 | +- Lists have no page numbers: server lists fetch as you scroll (`createInfiniteList` + DataTable `infinite`, or `InfiniteSentinel` for card lists), only when the backend applies every filter the list offers (sorting is off there); client tables reveal 50 rows at a time. Back from a detail page restores rows and scroll (`restoreKey`, `createScrollRestore`). | ||
| 52 | - Pages/domain components must not import or render `Table` primitives directly; only the `DataTable` wrapper and table primitive files may. | 53 | - Pages/domain components must not import or render `Table` primitives directly; only the `DataTable` wrapper and table primitive files may. |
| 53 | - Every list page uses one card: optional `Tabs` above, then `section.data-shell` holding the `DataTable` (its `title`/`description`/`actions`). Card-grid lists use `DataSection` from `src/components/ui/data-section.tsx` for the same header. No standalone `PageHeader`/`h1` above a list, and no row counts in descriptions (the pager shows them). | 54 | - Every list page uses one card: optional `Tabs` above, then `section.data-shell` holding the `DataTable` (its `title`/`description`/`actions`). Card-grid lists use `DataSection` from `src/components/ui/data-section.tsx` for the same header. No standalone `PageHeader`/`h1` above a list, and no row counts in descriptions (the pager shows them). |
| 54 | 55 | ||
docs/ui/ui-redesign-tokens.mdmodified+9 -4
| @@ -78,7 +78,7 @@ display-font, translucent surface, or custom shadow rules. | |||
| 78 | ## DataTable | 78 | ## DataTable |
| 79 | 79 | ||
| 80 | - Table shell: `rounded-xl border-border-line bg-surface-base` | 80 | - Table shell: `rounded-xl border-border-line bg-surface-base` |
| 81 | -- Header: sticky, `text-xs` medium **Title Case** (no uppercase transform), | 81 | +- Header: sticky under the 49px top bar, centred, `text-xs` medium **Title Case** (no uppercase transform), |
| 82 | `tracking-normal`, muted foreground/background | 82 | `tracking-normal`, muted foreground/background |
| 83 | - Body: flat rows (no zebra), restrained hover, `tabular-nums` cells so digits | 83 | - Body: flat rows (no zebra), restrained hover, `tabular-nums` cells so digits |
| 84 | align vertically without a monospace font | 84 | align vertically without a monospace font |
| @@ -87,9 +87,14 @@ display-font, translucent surface, or custom shadow rules. | |||
| 87 | right, and inherits the exact opaque row surface | 87 | right, and inherits the exact opaque row surface |
| 88 | - Data columns fill the available table width at a consistent proportional width. | 88 | - Data columns fill the available table width at a consistent proportional width. |
| 89 | Column resizing is not offered (no resize handles, no width persistence) | 89 | Column resizing is not offered (no resize handles, no width persistence) |
| 90 | -- Search / filter / column controls: compact `h-8 rounded-lg` + `text-[13px]` (not pill) | 90 | +- Toolbar controls (search, filter chips, actions, "Sütunlar") are pills: |
| 91 | -- Pagination includes range, optional page-size selector, previous/next, and page | 91 | + `rounded-full` + `text-[13px]`, `h-8` from `sm`, `h-10` below `sm` and on |
| 92 | - count | 92 | + touch screens (`TOOLBAR_CONTROL` / `TOOLBAR_SLOT` / `TOOLBAR_CARD` in |
| 93 | + `src/components/ui/data-toolbar.tsx`). Every list toolbar is one card. | ||
| 94 | +- Filled buttons carry a transparent border with `bg-clip-padding`, so they | ||
| 95 | + match an outlined pill's height; a border never matches its fill colour. | ||
| 96 | +- No page numbers: server lists fetch as you scroll (`createInfiniteList` + | ||
| 97 | + `infinite`), client lists reveal 50 rows at a time. Empty cells show `—`. | ||
| 93 | - `storageKey` remains optional. When provided, only column visibility persists | 98 | - `storageKey` remains optional. When provided, only column visibility persists |
| 94 | under `hezarfen.table.<storageKey>`. | 99 | under `hezarfen.table.<storageKey>`. |
| 95 | - Application tables use `DataTable`; page/domain components do not render table | 100 | - Application tables use `DataTable`; page/domain components do not render table |
src/components/ai/insights-board.tsxmodified+3 -1
| @@ -36,7 +36,9 @@ export function InsightsBoard() { | |||
| 36 | const [flashMessage, flash] = createFlash(); | 36 | const [flashMessage, flash] = createFlash(); |
| 37 | 37 | ||
| 38 | const [selfInsight, { refetch: refetchSelfInsight }] = createResource( | 38 | const [selfInsight, { refetch: refetchSelfInsight }] = createResource( |
| 39 | - () => auth.user()?.id ?? null, | 39 | + // Only a student (their analysis) or a teacher (their recommendations) |
| 40 | + // is shown this read; other roles never render it, so never ask. | ||
| 41 | + () => (role() === "student" || role() === "teacher" ? auth.user()?.id ?? null : null), | ||
| 40 | async () => getMyInsight(), | 42 | async () => getMyInsight(), |
| 41 | ); | 43 | ); |
| 42 | const [students, { refetch: refetchStudents }] = createResource( | 44 | const [students, { refetch: refetchStudents }] = createResource( |
src/components/ai/note-studio-panel.tsxmodified+1 -1
| @@ -175,7 +175,7 @@ export function NoteStudioDetail(props: { noteId: string; episode?: string }) { | |||
| 175 | <div class="flex min-h-12 shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border-hairline pb-3 lg:px-6 lg:pb-0"> | 175 | <div class="flex min-h-12 shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border-hairline pb-3 lg:px-6 lg:pb-0"> |
| 176 | <Link | 176 | <Link |
| 177 | to="/ai/studio" | 177 | to="/ai/studio" |
| 178 | - class={cn(buttonVariants({ variant: "ghost", size: "sm" }), "-ml-2 h-8 gap-1 rounded-lg text-muted-foreground")} | 178 | + class={cn(buttonVariants({ variant: "ghost", size: "sm" }), "-ml-2 h-10 gap-1 rounded-lg text-muted-foreground sm:h-8 touch:h-10")} |
| 179 | > | 179 | > |
| 180 | <IconChevronLeft class="h-4 w-4" /> | 180 | <IconChevronLeft class="h-4 w-4" /> |
| 181 | {t("aiStudio.backToLibrary")} | 181 | {t("aiStudio.backToLibrary")} |
src/components/ai/studio-output-library.test.tsxmodified+7 -7
| @@ -99,25 +99,25 @@ describe("StudioOutputLibrary", () => { | |||
| 99 | expect(current.length).toBe(2); | 99 | expect(current.length).toBe(2); |
| 100 | }); | 100 | }); |
| 101 | 101 | ||
| 102 | - it("pages a long history ten rows at a time", async () => { | 102 | + it("reveals a long history fifty rows at a time", async () => { |
| 103 | podcastApi.listPodcastJobs.mockResolvedValue(page( | 103 | podcastApi.listPodcastJobs.mockResolvedValue(page( |
| 104 | - Array.from({ length: 12 }, (_, index) => | 104 | + Array.from({ length: 52 }, (_, index) => |
| 105 | podcast({ job_id: `job-${index}`, source_title: `Bölüm ${index + 1}`, source_id: `other-${index}`, created_at: Date.UTC(2026, 0, 1, index), finished_at: Date.UTC(2026, 0, 1, index) }), | 105 | podcast({ job_id: `job-${index}`, source_title: `Bölüm ${index + 1}`, source_id: `other-${index}`, created_at: Date.UTC(2026, 0, 1, index), finished_at: Date.UTC(2026, 0, 1, index) }), |
| 106 | ), | 106 | ), |
| 107 | )); | 107 | )); |
| 108 | courseNotesApi.getCourseNoteRag.mockResolvedValue(page([])); | 108 | courseNotesApi.getCourseNoteRag.mockResolvedValue(page([])); |
| 109 | renderLibrary(); | 109 | renderLibrary(); |
| 110 | 110 | ||
| 111 | - // Newest first: episode 12 leads page one, episode 2 closes it. | 111 | + // Newest first: episode 52 leads, episode 3 closes the first fifty. |
| 112 | - await waitFor(() => expect(screen.getByText("Bölüm 12")).toBeTruthy()); | 112 | + await waitFor(() => expect(screen.getByText("Bölüm 52")).toBeTruthy()); |
| 113 | expect(screen.getByText("Bölüm 3")).toBeTruthy(); | 113 | expect(screen.getByText("Bölüm 3")).toBeTruthy(); |
| 114 | expect(screen.queryByText("Bölüm 2")).toBeNull(); | 114 | expect(screen.queryByText("Bölüm 2")).toBeNull(); |
| 115 | - expect(screen.getByText("1-10 / 12")).toBeTruthy(); | ||
| 116 | 115 | ||
| 117 | - fireEvent.click(screen.getByRole("button", { name: "Sonraki" })); | 116 | + // jsdom has no IntersectionObserver, so the next rows wait for a button. |
| 117 | + fireEvent.click(screen.getByRole("button", { name: "Devamını yükle" })); | ||
| 118 | expect(screen.getByText("Bölüm 2")).toBeTruthy(); | 118 | expect(screen.getByText("Bölüm 2")).toBeTruthy(); |
| 119 | expect(screen.getByText("Bölüm 1")).toBeTruthy(); | 119 | expect(screen.getByText("Bölüm 1")).toBeTruthy(); |
| 120 | - expect(screen.queryByText("Bölüm 12")).toBeNull(); | 120 | + expect(screen.getByText("Bölüm 52")).toBeTruthy(); |
| 121 | }); | 121 | }); |
| 122 | 122 | ||
| 123 | it("opens an episode's note page with that episode picked", async () => { | 123 | it("opens an episode's note page with that episode picked", async () => { |
src/components/ai/studio-output-library.tsxmodified+21 -22
| @@ -6,10 +6,9 @@ import type { PodcastJobSummary } from "@/api/client"; | |||
| 6 | import { Badge } from "@/components/ui/badge"; | 6 | import { Badge } from "@/components/ui/badge"; |
| 7 | import { EmptyInline } from "@/components/ui/empty-inline"; | 7 | import { EmptyInline } from "@/components/ui/empty-inline"; |
| 8 | import { IconSparkles, IconWaveform } from "@/components/ui/icons"; | 8 | import { IconSparkles, IconWaveform } from "@/components/ui/icons"; |
| 9 | +import { InfiniteSentinel } from "@/components/ui/infinite-sentinel"; | ||
| 9 | import { PageSpinner } from "@/components/ui/page-spinner"; | 10 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 10 | -import { TablePagination } from "@/components/ui/table-pagination"; | ||
| 11 | import { cn } from "@/lib/cn"; | 11 | import { cn } from "@/lib/cn"; |
| 12 | -import { createResponsivePageSize } from "@/lib/create-page-size"; | ||
| 13 | import { formatDateTime } from "@/lib/format"; | 12 | import { formatDateTime } from "@/lib/format"; |
| 14 | import { usePreferences, useT } from "@/stores/preferences-context"; | 13 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 15 | 14 | ||
| @@ -35,7 +34,8 @@ type StudioArtifact = { | |||
| 35 | }; | 34 | }; |
| 36 | 35 | ||
| 37 | const LIBRARY_LIMIT = 100; | 36 | const LIBRARY_LIMIT = 100; |
| 38 | -const LIBRARY_PAGE_SIZE = 10; | 37 | +/** Client lists reveal this many rows at a time, like client DataTables. */ |
| 38 | +const LIBRARY_REVEAL = 50; | ||
| 39 | 39 | ||
| 40 | export function StudioOutputLibrary(props: { | 40 | export function StudioOutputLibrary(props: { |
| 41 | notes: StudioLibraryNote[]; | 41 | notes: StudioLibraryNote[]; |
| @@ -114,19 +114,14 @@ export function StudioOutputLibrary(props: { | |||
| 114 | return rows.sort((a, b) => b.at - a.at); | 114 | return rows.sort((a, b) => b.at - a.at); |
| 115 | }); | 115 | }); |
| 116 | 116 | ||
| 117 | - // The history is merged here from two sources, so it pages in memory. | 117 | + // The history is merged here from two sources, so it is revealed in |
| 118 | - const [page, setPage] = createSignal(0); | 118 | + // memory as the reader scrolls — the app's client-list standard. |
| 119 | - const pageSize = createResponsivePageSize(LIBRARY_PAGE_SIZE); | 119 | + const [shown, setShown] = createSignal(LIBRARY_REVEAL); |
| 120 | const total = () => items()?.length ?? 0; | 120 | const total = () => items()?.length ?? 0; |
| 121 | - const pageCount = createMemo(() => Math.max(1, Math.ceil(total() / pageSize()))); | 121 | + const pageItems = createMemo(() => (items() ?? []).slice(0, shown())); |
| 122 | - const pageItems = createMemo(() => (items() ?? []).slice(page() * pageSize(), (page() + 1) * pageSize())); | ||
| 123 | createEffect(() => { | 122 | createEffect(() => { |
| 124 | source(); | 123 | source(); |
| 125 | - pageSize(); | 124 | + setShown(LIBRARY_REVEAL); |
| 126 | - setPage(0); | ||
| 127 | - }); | ||
| 128 | - createEffect(() => { | ||
| 129 | - if (page() > pageCount() - 1) setPage(pageCount() - 1); | ||
| 130 | }); | 125 | }); |
| 131 | 126 | ||
| 132 | const open = (item: StudioArtifact) => { | 127 | const open = (item: StudioArtifact) => { |
| @@ -180,6 +175,11 @@ export function StudioOutputLibrary(props: { | |||
| 180 | <span class="block truncate text-sm font-medium text-text-strong">{item.title}</span> | 175 | <span class="block truncate text-sm font-medium text-text-strong">{item.title}</span> |
| 181 | <span class="mt-0.5 block truncate text-xs text-muted-foreground"> | 176 | <span class="mt-0.5 block truncate text-xs text-muted-foreground"> |
| 182 | {item.courseTitle} | 177 | {item.courseTitle} |
| 178 | + {/* Phones fold the date under the title so the title keeps the row's width. */} | ||
| 179 | + <span class="tabular-nums sm:hidden"> | ||
| 180 | + {item.courseTitle ? " · " : ""} | ||
| 181 | + {formatDateTime(item.at, locale())} | ||
| 182 | + </span> | ||
| 183 | </span> | 183 | </span> |
| 184 | </span> | 184 | </span> |
| 185 | <span class="hidden shrink-0 items-center gap-1.5 sm:flex"> | 185 | <span class="hidden shrink-0 items-center gap-1.5 sm:flex"> |
| @@ -207,7 +207,7 @@ export function StudioOutputLibrary(props: { | |||
| 207 | )} | 207 | )} |
| 208 | </Show> | 208 | </Show> |
| 209 | </span> | 209 | </span> |
| 210 | - <span class="shrink-0 text-xs tabular-nums text-muted-foreground"> | 210 | + <span class="hidden shrink-0 text-xs tabular-nums text-muted-foreground sm:block"> |
| 211 | {formatDateTime(item.at, locale())} | 211 | {formatDateTime(item.at, locale())} |
| 212 | </span> | 212 | </span> |
| 213 | </button> | 213 | </button> |
| @@ -215,15 +215,14 @@ export function StudioOutputLibrary(props: { | |||
| 215 | )} | 215 | )} |
| 216 | </For> | 216 | </For> |
| 217 | </ul> | 217 | </ul> |
| 218 | - <Show when={pageCount() > 1}> | 218 | + <Show when={total() > LIBRARY_REVEAL}> |
| 219 | - <div class="border-t border-border-hairline p-2"> | 219 | + <div class="flex flex-col items-start gap-2 border-t border-border-hairline px-4 py-3"> |
| 220 | - <TablePagination | 220 | + <InfiniteSentinel |
| 221 | - pageIndex={page()} | 221 | + hasMore={shown() < total()} |
| 222 | - pageCount={pageCount()} | 222 | + loading={false} |
| 223 | - pageSize={pageSize()} | 223 | + shown={Math.min(shown(), total())} |
| 224 | total={total()} | 224 | total={total()} |
| 225 | - onPageChange={setPage} | 225 | + onLoadMore={() => setShown((count) => count + LIBRARY_REVEAL)} |
| 226 | - class="border-0 bg-transparent" | ||
| 227 | /> | 226 | /> |
| 228 | </div> | 227 | </div> |
| 229 | </Show> | 228 | </Show> |
src/components/appointments/publish-slots-form.tsxmodified+2 -2
| @@ -130,7 +130,7 @@ export function PublishSlotsForm(props: { | |||
| 130 | </div> | 130 | </div> |
| 131 | 131 | ||
| 132 | <div class="space-y-3 rounded-lg border border-violet-500/15 bg-violet-500/3 p-4"> | 132 | <div class="space-y-3 rounded-lg border border-violet-500/15 bg-violet-500/3 p-4"> |
| 133 | - <label class="flex items-center gap-2 text-sm font-medium"> | 133 | + <label class="flex min-h-10 cursor-pointer items-center gap-2 text-sm font-medium sm:min-h-0"> |
| 134 | <input | 134 | <input |
| 135 | type="checkbox" | 135 | type="checkbox" |
| 136 | class="h-4 w-4 rounded border-border" | 136 | class="h-4 w-4 rounded border-border" |
| @@ -139,7 +139,7 @@ export function PublishSlotsForm(props: { | |||
| 139 | /> | 139 | /> |
| 140 | <span>{t("appointments.repeatWeekly")}</span> | 140 | <span>{t("appointments.repeatWeekly")}</span> |
| 141 | </label> | 141 | </label> |
| 142 | - <p class="text-xs text-muted-foreground">{t("appointments.repeatWeeklyHelp")}</p> | 142 | + <p class="-mt-2 pl-6 text-xs text-muted-foreground sm:-mt-1.5">{t("appointments.repeatWeeklyHelp")}</p> |
| 143 | <Show when={repeatWeekly()}> | 143 | <Show when={repeatWeekly()}> |
| 144 | <div class="space-y-1.5 pt-1"> | 144 | <div class="space-y-1.5 pt-1"> |
| 145 | <Label for="slot-until">{t("appointments.until")}</Label> | 145 | <Label for="slot-until">{t("appointments.until")}</Label> |
src/components/attendance/attendance-report-view.tsxmodified+20 -10
| @@ -46,15 +46,21 @@ export function AttendanceReportView(props: { report: AttendanceReport; compact? | |||
| 46 | id: "course", | 46 | id: "course", |
| 47 | accessorFn: (row) => row.course.title, | 47 | accessorFn: (row) => row.course.title, |
| 48 | header: t("nav.courses"), | 48 | header: t("nav.courses"), |
| 49 | + // The name gets the room; six short count columns share the rest. Equal | ||
| 50 | + // widths cut every name to "Mate…" in the side panel. | ||
| 51 | + size: 260, | ||
| 52 | + minSize: 140, | ||
| 49 | meta: { stickyLeft: true }, | 53 | meta: { stickyLeft: true }, |
| 50 | cell: (cell) => ( | 54 | cell: (cell) => ( |
| 51 | - <Link to="/courses/$id" params={{ id: cell.row.original.course.id }} class="block truncate font-medium hover:text-primary-text hover:underline"> | 55 | + <Link to="/courses/$id" params={{ id: cell.row.original.course.id }} title={cell.row.original.course.title} class="block truncate font-medium hover:text-primary-text hover:underline"> |
| 52 | {cell.row.original.course.title} | 56 | {cell.row.original.course.title} |
| 53 | </Link> | 57 | </Link> |
| 54 | ), | 58 | ), |
| 55 | }, | 59 | }, |
| 56 | ...ATTENDANCE_STATUSES.map((status, index) => ({ | 60 | ...ATTENDANCE_STATUSES.map((status, index) => ({ |
| 57 | id: status.value, | 61 | id: status.value, |
| 62 | + size: 72, | ||
| 63 | + minSize: 48, | ||
| 58 | header: () => <span title={t(status.detailKey)}>{compact() ? t(status.key).slice(0, 1) : t(status.key)}</span>, | 64 | header: () => <span title={t(status.detailKey)}>{compact() ? t(status.key).slice(0, 1) : t(status.key)}</span>, |
| 59 | meta: { align: "right" as const, divider: index === 0 ? ("left" as const) : undefined }, | 65 | meta: { align: "right" as const, divider: index === 0 ? ("left" as const) : undefined }, |
| 60 | cell: (cell) => ( | 66 | cell: (cell) => ( |
| @@ -65,12 +71,16 @@ export function AttendanceReportView(props: { report: AttendanceReport; compact? | |||
| 65 | } satisfies ColumnDef<CourseAttendanceRow>)), | 71 | } satisfies ColumnDef<CourseAttendanceRow>)), |
| 66 | { | 72 | { |
| 67 | id: "total", | 73 | id: "total", |
| 74 | + size: 72, | ||
| 75 | + minSize: 48, | ||
| 68 | header: () => <span>{compact() ? "Σ" : t("common.all")}</span>, | 76 | header: () => <span>{compact() ? "Σ" : t("common.all")}</span>, |
| 69 | meta: { align: "right", cellClass: "" }, | 77 | meta: { align: "right", cellClass: "" }, |
| 70 | cell: (cell) => cell.row.original.counts.total, | 78 | cell: (cell) => cell.row.original.counts.total, |
| 71 | }, | 79 | }, |
| 72 | { | 80 | { |
| 73 | id: "rate", | 81 | id: "rate", |
| 82 | + size: 80, | ||
| 83 | + minSize: 56, | ||
| 74 | header: () => <span>%</span>, | 84 | header: () => <span>%</span>, |
| 75 | meta: { align: "right", cellClass: "font-semibold" }, | 85 | meta: { align: "right", cellClass: "font-semibold" }, |
| 76 | cell: (cell) => percent(cell.row.original.counts.rate), | 86 | cell: (cell) => percent(cell.row.original.counts.rate), |
| @@ -79,20 +89,20 @@ export function AttendanceReportView(props: { report: AttendanceReport; compact? | |||
| 79 | 89 | ||
| 80 | return ( | 90 | return ( |
| 81 | <div class="min-w-0 space-y-4"> | 91 | <div class="min-w-0 space-y-4"> |
| 82 | - <dl class="grid grid-cols-1 gap-3 sm:grid-cols-4"> | 92 | + <dl class="grid grid-cols-2 gap-3 sm:grid-cols-4"> |
| 83 | - <div class={cn("rounded-lg border border-border bg-card p-4 shadow-xs", compact() && "p-3 shadow-none")}> | 93 | + <div class={cn("rounded-xl border border-border bg-card p-4 shadow-xs", compact() && "p-3 shadow-none")}> |
| 84 | <dt class="text-xs font-medium text-muted-foreground">{t("attendance.overallRate")}</dt> | 94 | <dt class="text-xs font-medium text-muted-foreground">{t("attendance.overallRate")}</dt> |
| 85 | <dd class={cn("mt-2 text-3xl font-semibold tabular-nums", compact() && "text-2xl")}>{percent(combined().rate)}</dd> | 95 | <dd class={cn("mt-2 text-3xl font-semibold tabular-nums", compact() && "text-2xl")}>{percent(combined().rate)}</dd> |
| 86 | </div> | 96 | </div> |
| 87 | - <div class={cn("rounded-lg border border-border bg-card p-4 shadow-xs", compact() && "p-3 shadow-none")}> | 97 | + <div class={cn("rounded-xl border border-border bg-card p-4 shadow-xs", compact() && "p-3 shadow-none")}> |
| 88 | <dt class="text-xs font-medium text-muted-foreground">{t("attendance.totalAbsence")}</dt> | 98 | <dt class="text-xs font-medium text-muted-foreground">{t("attendance.totalAbsence")}</dt> |
| 89 | <dd class={cn("mt-2 text-3xl font-semibold tabular-nums", compact() && "text-2xl")}>{combined().totalAbsence}</dd> | 99 | <dd class={cn("mt-2 text-3xl font-semibold tabular-nums", compact() && "text-2xl")}>{combined().totalAbsence}</dd> |
| 90 | </div> | 100 | </div> |
| 91 | - <div class={cn("rounded-lg border border-border bg-card p-4 shadow-xs", compact() && "p-3 shadow-none")}> | 101 | + <div class={cn("rounded-xl border border-border bg-card p-4 shadow-xs", compact() && "p-3 shadow-none")}> |
| 92 | <dt class="text-xs font-medium text-muted-foreground">{t("status.excused")}</dt> | 102 | <dt class="text-xs font-medium text-muted-foreground">{t("status.excused")}</dt> |
| 93 | <dd class={cn("mt-2 text-3xl font-semibold tabular-nums", compact() && "text-2xl")}>{combined().excused}</dd> | 103 | <dd class={cn("mt-2 text-3xl font-semibold tabular-nums", compact() && "text-2xl")}>{combined().excused}</dd> |
| 94 | </div> | 104 | </div> |
| 95 | - <div class={cn("rounded-lg border border-border bg-card p-4 shadow-xs", compact() && "p-3 shadow-none")}> | 105 | + <div class={cn("rounded-xl border border-border bg-card p-4 shadow-xs", compact() && "p-3 shadow-none")}> |
| 96 | <dt class="text-xs font-medium text-muted-foreground">{t("status.absent")}</dt> | 106 | <dt class="text-xs font-medium text-muted-foreground">{t("status.absent")}</dt> |
| 97 | <dd class={cn("mt-2 text-3xl font-semibold tabular-nums", compact() && "text-2xl")}>{combined().absent}</dd> | 107 | <dd class={cn("mt-2 text-3xl font-semibold tabular-nums", compact() && "text-2xl")}>{combined().absent}</dd> |
| 98 | </div> | 108 | </div> |
| @@ -101,13 +111,13 @@ export function AttendanceReportView(props: { report: AttendanceReport; compact? | |||
| 101 | <div class={cn("grid gap-3", !compact() && "lg:grid-cols-2")}> | 111 | <div class={cn("grid gap-3", !compact() && "lg:grid-cols-2")}> |
| 102 | <For each={blocks()}> | 112 | <For each={blocks()}> |
| 103 | {(block) => ( | 113 | {(block) => ( |
| 104 | - <article class="rounded-lg border border-border bg-card p-4 shadow-xs"> | 114 | + <article class="rounded-xl border border-border bg-card p-4 shadow-xs"> |
| 105 | <header class="flex items-end justify-between gap-3"> | 115 | <header class="flex items-end justify-between gap-3"> |
| 106 | <div> | 116 | <div> |
| 107 | <p class="text-xs font-medium text-muted-foreground">{block.title}</p> | 117 | <p class="text-xs font-medium text-muted-foreground">{block.title}</p> |
| 108 | <p class="mt-1 text-2xl font-semibold tabular-nums">{percent(block.counts.rate)}</p> | 118 | <p class="mt-1 text-2xl font-semibold tabular-nums">{percent(block.counts.rate)}</p> |
| 109 | </div> | 119 | </div> |
| 110 | - <p class="text-xs text-muted-foreground">{block.counts.total} {t("common.all").toLocaleLowerCase()}</p> | 120 | + <p class="text-xs text-muted-foreground">{t("attendance.recordCount", { count: block.counts.total })}</p> |
| 111 | </header> | 121 | </header> |
| 112 | <div class="mt-3 h-2 overflow-hidden rounded-full bg-muted"> | 122 | <div class="mt-3 h-2 overflow-hidden rounded-full bg-muted"> |
| 113 | <div class={cn("h-full rounded-full", block.color)} style={{ width: rateWidth(block.counts.rate) }} /> | 123 | <div class={cn("h-full rounded-full", block.color)} style={{ width: rateWidth(block.counts.rate) }} /> |
| @@ -137,7 +147,7 @@ export function AttendanceReportView(props: { report: AttendanceReport; compact? | |||
| 137 | {/* Devamsızlık is counted in *days*, not marks: two absences in one | 147 | {/* Devamsızlık is counted in *days*, not marks: two absences in one |
| 138 | calendar day count once, which is what the regulation counts. */} | 148 | calendar day count once, which is what the regulation counts. */} |
| 139 | <Show when={(props.report.devamsizlik ?? []).length > 0}> | 149 | <Show when={(props.report.devamsizlik ?? []).length > 0}> |
| 140 | - <section class="rounded-lg border border-border bg-card p-4 shadow-xs"> | 150 | + <section class="rounded-xl border border-border bg-card p-4 shadow-xs"> |
| 141 | <h3 class="text-base font-semibold">{t("attendance.devamsizlik")}</h3> | 151 | <h3 class="text-base font-semibold">{t("attendance.devamsizlik")}</h3> |
| 142 | <div class="mt-3 grid gap-2 sm:grid-cols-2"> | 152 | <div class="mt-3 grid gap-2 sm:grid-cols-2"> |
| 143 | <For each={props.report.devamsizlik ?? []}> | 153 | <For each={props.report.devamsizlik ?? []}> |
| @@ -176,7 +186,7 @@ export function AttendanceReportView(props: { report: AttendanceReport; compact? | |||
| 176 | </section> | 186 | </section> |
| 177 | </Show> | 187 | </Show> |
| 178 | 188 | ||
| 179 | - <section class="rounded-lg border border-border bg-card p-4 shadow-xs"> | 189 | + <section class="rounded-xl border border-border bg-card p-4 shadow-xs"> |
| 180 | <h3 class="text-base font-semibold">{t("attendance.courseBreakdown")}</h3> | 190 | <h3 class="text-base font-semibold">{t("attendance.courseBreakdown")}</h3> |
| 181 | <div class="mt-3"> | 191 | <div class="mt-3"> |
| 182 | <Show | 192 | <Show |
src/components/classes/blueprint-panel.tsxmodified+11 -4
| @@ -116,7 +116,10 @@ export function BlueprintPanel(props: { | |||
| 116 | </Show> | 116 | </Show> |
| 117 | 117 | ||
| 118 | <div class="space-y-1.5"> | 118 | <div class="space-y-1.5"> |
| 119 | - <Label for="bp-grade">{t("classBlueprints.grade")}</Label> | 119 | + <Label for="bp-grade"> |
| 120 | + {t("classBlueprints.grade")} | ||
| 121 | + <Show when={!editing()}><span class="ml-0.5 text-destructive-text">*</span></Show> | ||
| 122 | + </Label> | ||
| 120 | <GradeLevelSelect | 123 | <GradeLevelSelect |
| 121 | id="bp-grade" | 124 | id="bp-grade" |
| 122 | value={gradeLevel()} | 125 | value={gradeLevel()} |
| @@ -168,13 +171,17 @@ export function BlueprintPanel(props: { | |||
| 168 | </div> | 171 | </div> |
| 169 | 172 | ||
| 170 | <Show when={error()}> | 173 | <Show when={error()}> |
| 171 | - <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> | 174 | + <Alert variant="destructive">{error()}</Alert> |
| 172 | </Show> | 175 | </Show> |
| 173 | 176 | ||
| 174 | - <div class="flex justify-end"> | 177 | + {/* Save + Cancel on a hairline, like the class create and edit panels. */} |
| 175 | - <Button type="submit" class="w-full sm:w-auto" disabled={pending() || gradeLevel() === null}> | 178 | + <div class="flex gap-2 border-t border-border-hairline pt-4"> |
| 179 | + <Button type="submit" disabled={pending() || gradeLevel() === null}> | ||
| 176 | {t("common.save")} | 180 | {t("common.save")} |
| 177 | </Button> | 181 | </Button> |
| 182 | + <Button type="button" variant="outline" onClick={() => props.onOpenChange(false)}> | ||
| 183 | + {t("common.cancel")} | ||
| 184 | + </Button> | ||
| 178 | </div> | 185 | </div> |
| 179 | </form> | 186 | </form> |
| 180 | </SidePanel> | 187 | </SidePanel> |
src/components/classes/blueprints-tab.tsxmodified+28 -14
| @@ -8,7 +8,10 @@ import { formatApiError, type BlueprintResult, type BlueprintSectionStatus, type | |||
| 8 | import { BlueprintPanel } from "@/components/classes/blueprint-panel"; | 8 | import { BlueprintPanel } from "@/components/classes/blueprint-panel"; |
| 9 | import { BlueprintSkippedReport } from "@/components/classes/blueprint-skipped-report"; | 9 | import { BlueprintSkippedReport } from "@/components/classes/blueprint-skipped-report"; |
| 10 | import { Alert } from "@/components/ui/alert"; | 10 | import { Alert } from "@/components/ui/alert"; |
| 11 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 11 | import { Button } from "@/components/ui/button"; | 12 | import { Button } from "@/components/ui/button"; |
| 13 | +import { TOOLBAR_CONTROL } from "@/components/ui/data-toolbar"; | ||
| 14 | +import { cn } from "@/lib/cn"; | ||
| 12 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 15 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 13 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 16 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 14 | import { IconClipboardCheck, IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; | 17 | import { IconClipboardCheck, IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; |
| @@ -43,7 +46,11 @@ export function BlueprintsTab(props: { | |||
| 43 | const [courses] = createResource(enabled, async () => (await getCourses({ limit: 200 })).items); | 46 | const [courses] = createResource(enabled, async () => (await getCourses({ limit: 200 })).items); |
| 44 | const [limits] = createResource(enabled, () => getLimits()); | 47 | const [limits] = createResource(enabled, () => getLimits()); |
| 45 | 48 | ||
| 46 | - const courseTitle = (id: string) => courses.latest?.find((c) => c.id === id)?.title ?? id; | 49 | + // `.latest` rethrows a failed read; these keep one failure from throwing |
| 50 | + // the whole page out (the list shows ErrorAlert, the rest fall back). | ||
| 51 | + const courseList = () => (courses.error ? [] : courses.latest ?? []); | ||
| 52 | + const limitData = () => (limits.error ? undefined : limits.latest); | ||
| 53 | + const courseTitle = (id: string) => courseList().find((c) => c.id === id)?.title ?? id; | ||
| 47 | 54 | ||
| 48 | const columns = createMemo<ColumnDef<ClassBlueprint>[]>(() => [ | 55 | const columns = createMemo<ColumnDef<ClassBlueprint>[]>(() => [ |
| 49 | { | 56 | { |
| @@ -56,6 +63,8 @@ export function BlueprintsTab(props: { | |||
| 56 | { | 63 | { |
| 57 | id: "count", | 64 | id: "count", |
| 58 | accessorFn: (row) => t("classBlueprints.courseCount", { count: row.courses.length }), | 65 | accessorFn: (row) => t("classBlueprints.courseCount", { count: row.courses.length }), |
| 66 | + // The label is text ("10 ders" sorts before "3 ders"); order by the count. | ||
| 67 | + sortingFn: (a, b) => a.original.courses.length - b.original.courses.length, | ||
| 59 | header: t("classBlueprints.courseCountColumn"), | 68 | header: t("classBlueprints.courseCountColumn"), |
| 60 | }, | 69 | }, |
| 61 | { | 70 | { |
| @@ -63,7 +72,7 @@ export function BlueprintsTab(props: { | |||
| 63 | accessorFn: (row) => { | 72 | accessorFn: (row) => { |
| 64 | const names = row.courses.slice(0, 3).map(courseTitle); | 73 | const names = row.courses.slice(0, 3).map(courseTitle); |
| 65 | const rest = row.courses.length - names.length; | 74 | const rest = row.courses.length - names.length; |
| 66 | - return rest > 0 ? `${names.join(", ")} +${rest}` : names.join(", ") || "—"; | 75 | + return rest > 0 ? `${names.join(", ")} +${rest}` : names.join(", "); |
| 67 | }, | 76 | }, |
| 68 | header: t("classBlueprints.courses"), | 77 | header: t("classBlueprints.courses"), |
| 69 | meta: { cellClass: "text-muted-foreground" }, | 78 | meta: { cellClass: "text-muted-foreground" }, |
| @@ -90,17 +99,17 @@ export function BlueprintsTab(props: { | |||
| 90 | setPanelOpen(true); | 99 | setPanelOpen(true); |
| 91 | }, | 100 | }, |
| 92 | }, | 101 | }, |
| 102 | + { | ||
| 103 | + label: t("classBlueprints.status"), | ||
| 104 | + icon: <IconClipboardCheck class="h-4 w-4" />, | ||
| 105 | + onSelect: () => void checkStatus(cell.row.original.grade_level), | ||
| 106 | + }, | ||
| 93 | { | 107 | { |
| 94 | label: t("classBlueprints.delete"), | 108 | label: t("classBlueprints.delete"), |
| 95 | icon: <IconTrash class="h-4 w-4" />, | 109 | icon: <IconTrash class="h-4 w-4" />, |
| 96 | destructive: true, | 110 | destructive: true, |
| 97 | onSelect: () => setDeleting(cell.row.original), | 111 | onSelect: () => setDeleting(cell.row.original), |
| 98 | }, | 112 | }, |
| 99 | - { | ||
| 100 | - label: t("classBlueprints.status"), | ||
| 101 | - icon: <IconClipboardCheck class="h-4 w-4" />, | ||
| 102 | - onSelect: () => void checkStatus(cell.row.original.grade_level), | ||
| 103 | - }, | ||
| 104 | ]} | 113 | ]} |
| 105 | /> | 114 | /> |
| 106 | ), | 115 | ), |
| @@ -156,7 +165,7 @@ export function BlueprintsTab(props: { | |||
| 156 | }, | 165 | }, |
| 157 | { | 166 | { |
| 158 | id: "missing", | 167 | id: "missing", |
| 159 | - accessorFn: (row) => row.missing.map(courseTitle).join(", ") || "—", | 168 | + accessorFn: (row) => row.missing.map(courseTitle).join(", "), |
| 160 | header: t("classBlueprints.statusMissing"), | 169 | header: t("classBlueprints.statusMissing"), |
| 161 | meta: { cellClass: "text-muted-foreground" }, | 170 | meta: { cellClass: "text-muted-foreground" }, |
| 162 | }, | 171 | }, |
| @@ -180,7 +189,7 @@ export function BlueprintsTab(props: { | |||
| 180 | <Show when={skipped().length > 0}> | 189 | <Show when={skipped().length > 0}> |
| 181 | <Alert class="flex flex-wrap items-center justify-between gap-3 border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200"> | 190 | <Alert class="flex flex-wrap items-center justify-between gap-3 border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200"> |
| 182 | <span class="min-w-0 flex-1">{t("classBlueprints.skippedSummary", { count: skipped().length })}</span> | 191 | <span class="min-w-0 flex-1">{t("classBlueprints.skippedSummary", { count: skipped().length })}</span> |
| 183 | - <Button type="button" size="sm" variant="outline" class="shrink-0 rounded-lg" onClick={() => setReportOpen(true)}> | 192 | + <Button type="button" size="sm" variant="outline" class={cn(TOOLBAR_CONTROL, "shrink-0 px-3.5")} onClick={() => setReportOpen(true)}> |
| 184 | {t("classBlueprints.skippedDetails")} | 193 | {t("classBlueprints.skippedDetails")} |
| 185 | </Button> | 194 | </Button> |
| 186 | </Alert> | 195 | </Alert> |
| @@ -188,11 +197,16 @@ export function BlueprintsTab(props: { | |||
| 188 | 197 | ||
| 189 | {/* The list is read through `.latest`, so a refetch after a save never | 198 | {/* The list is read through `.latest`, so a refetch after a save never |
| 190 | re-suspends the tab; the skeleton only covers the first load. */} | 199 | re-suspends the tab; the skeleton only covers the first load. */} |
| 191 | - <Show when={!list.loading || list.latest} fallback={<DataTableSkeleton />}> | 200 | + <Show when={list.error}> |
| 201 | + <ErrorAlert message={formatApiError(list.error)} onRetry={() => void refetch()} /> | ||
| 202 | + </Show> | ||
| 203 | + <Show when={!list.error && (!list.loading || list.latest)} fallback={<Show when={!list.error}><DataTableSkeleton /></Show>}> | ||
| 192 | <DataTable | 204 | <DataTable |
| 193 | columns={columns()} | 205 | columns={columns()} |
| 194 | data={list.latest ?? []} | 206 | data={list.latest ?? []} |
| 195 | filterColumn="grade" | 207 | filterColumn="grade" |
| 208 | + filterPlaceholder={t("classBlueprints.searchPlaceholder")} | ||
| 209 | + filterHint={t("search.hint.blueprints")} | ||
| 196 | enablePagination | 210 | enablePagination |
| 197 | pageSize={10} | 211 | pageSize={10} |
| 198 | title={t("classBlueprints.title")} | 212 | title={t("classBlueprints.title")} |
| @@ -221,10 +235,10 @@ export function BlueprintsTab(props: { | |||
| 221 | if (!open) setEditing(null); | 235 | if (!open) setEditing(null); |
| 222 | }} | 236 | }} |
| 223 | blueprint={editing()} | 237 | blueprint={editing()} |
| 224 | - courses={courses.latest ?? []} | 238 | + courses={courseList()} |
| 225 | - maxCourses={limits.latest?.course.max_class_courses ?? 50} | 239 | + maxCourses={limitData()?.course.max_class_courses ?? 50} |
| 226 | - minGradeLevel={limits.latest?.course.min_grade_level} | 240 | + minGradeLevel={limitData()?.course.min_grade_level} |
| 227 | - maxGradeLevel={limits.latest?.course.max_grade_level} | 241 | + maxGradeLevel={limitData()?.course.max_grade_level} |
| 228 | onSaved={(result) => void handleSaved(result)} | 242 | onSaved={(result) => void handleSaved(result)} |
| 229 | /> | 243 | /> |
| 230 | 244 | ||
src/components/classes/class-edit-panel.tsxmodified+12 -3
| @@ -33,6 +33,7 @@ export function ClassEditPanel(props: { | |||
| 33 | const [yearId, setYearId] = createSignal(""); | 33 | const [yearId, setYearId] = createSignal(""); |
| 34 | const [teacherId, setTeacherId] = createSignal(""); | 34 | const [teacherId, setTeacherId] = createSignal(""); |
| 35 | const [error, setError] = createSignal(""); | 35 | const [error, setError] = createSignal(""); |
| 36 | + const [nameError, setNameError] = createSignal(""); | ||
| 36 | const [pending, setPending] = createSignal(false); | 37 | const [pending, setPending] = createSignal(false); |
| 37 | 38 | ||
| 38 | // Seed the form each time it opens, from the row it opens for. | 39 | // Seed the form each time it opens, from the row it opens for. |
| @@ -44,6 +45,7 @@ export function ClassEditPanel(props: { | |||
| 44 | setYearId(c.year ?? ""); | 45 | setYearId(c.year ?? ""); |
| 45 | setTeacherId(c.teacher?.id ?? ""); | 46 | setTeacherId(c.teacher?.id ?? ""); |
| 46 | setError(""); | 47 | setError(""); |
| 48 | + setNameError(""); | ||
| 47 | }); | 49 | }); |
| 48 | 50 | ||
| 49 | const submit = async (event: SubmitEvent) => { | 51 | const submit = async (event: SubmitEvent) => { |
| @@ -51,6 +53,13 @@ export function ClassEditPanel(props: { | |||
| 51 | const c = props.cls; | 53 | const c = props.cls; |
| 52 | if (!c || pending()) return; | 54 | if (!c || pending()) return; |
| 53 | setError(""); | 55 | setError(""); |
| 56 | + // Same rule as the create form: a blank name is caught under the field, | ||
| 57 | + // not sent for the backend to reject. | ||
| 58 | + if (!name().trim()) { | ||
| 59 | + setNameError(t("form.fieldRequired")); | ||
| 60 | + document.getElementById("edit-class-name")?.focus(); | ||
| 61 | + return; | ||
| 62 | + } | ||
| 54 | setPending(true); | 63 | setPending(true); |
| 55 | try { | 64 | try { |
| 56 | const saved = await patchClassById(c.id, { name: name().trim(), ...(gradeLevel() !== null ? { grade_level: gradeLevel()! } : {}), year: yearId() || null, teacher_id: teacherId() || null }); | 65 | const saved = await patchClassById(c.id, { name: name().trim(), ...(gradeLevel() !== null ? { grade_level: gradeLevel()! } : {}), year: yearId() || null, teacher_id: teacherId() || null }); |
| @@ -65,15 +74,15 @@ export function ClassEditPanel(props: { | |||
| 65 | 74 | ||
| 66 | return ( | 75 | return ( |
| 67 | <SidePanel guardUnsaved open={props.open && !!props.cls} onOpenChange={props.onOpenChange} title={t("common.edit")} description={props.cls?.name}> | 76 | <SidePanel guardUnsaved open={props.open && !!props.cls} onOpenChange={props.onOpenChange} title={t("common.edit")} description={props.cls?.name}> |
| 68 | - <form class="space-y-4" onSubmit={submit}> | 77 | + <form class="space-y-4" noValidate onSubmit={submit}> |
| 69 | <div class="space-y-3"> | 78 | <div class="space-y-3"> |
| 70 | - <div class="space-y-1.5"><Label for="edit-class-name">{t("classGroups.className")}</Label><Input id="edit-class-name" maxlength={props.maxNameLen} value={name()} onInput={(e) => setName(e.currentTarget.value)} /></div> | 79 | + <div class="space-y-1.5"><Label for="edit-class-name">{t("classGroups.className")}<span class="ml-0.5 text-destructive-text">*</span></Label><Input id="edit-class-name" required aria-required="true" maxlength={props.maxNameLen} value={name()} error={nameError()} onInput={(e) => { setName(e.currentTarget.value); setNameError(""); }} /></div> |
| 71 | <div class="space-y-1.5"><Label for="edit-class-grade">{t("classGroups.grade")}</Label><GradeLevelSelect id="edit-class-grade" value={gradeLevel()} min={props.minGradeLevel} max={props.maxGradeLevel} onChange={setGradeLevel} /></div> | 80 | <div class="space-y-1.5"><Label for="edit-class-grade">{t("classGroups.grade")}</Label><GradeLevelSelect id="edit-class-grade" value={gradeLevel()} min={props.minGradeLevel} max={props.maxGradeLevel} onChange={setGradeLevel} /></div> |
| 72 | <div class="space-y-1.5"><Label for="edit-class-year">{t("academicYears.year")}</Label><Select id="edit-class-year" value={yearId()} onChange={(e) => setYearId(e.currentTarget.value)}><option value="">{t("academicYears.unassigned")}</option><For each={props.years}>{(year) => <option value={year.id}>{year.name}</option>}</For></Select></div> | 81 | <div class="space-y-1.5"><Label for="edit-class-year">{t("academicYears.year")}</Label><Select id="edit-class-year" value={yearId()} onChange={(e) => setYearId(e.currentTarget.value)}><option value="">{t("academicYears.unassigned")}</option><For each={props.years}>{(year) => <option value={year.id}>{year.name}</option>}</For></Select></div> |
| 73 | <UserSearchSelect id="edit-class-teacher" label={t("classGroups.homeroomTeacher")} value={teacherId()} initialUser={props.cls?.teacher} onChange={setTeacherId} placeholder={t("classGroups.selectTeacher")} role="teacher" /> | 82 | <UserSearchSelect id="edit-class-teacher" label={t("classGroups.homeroomTeacher")} value={teacherId()} initialUser={props.cls?.teacher} onChange={setTeacherId} placeholder={t("classGroups.selectTeacher")} role="teacher" /> |
| 74 | </div> | 83 | </div> |
| 75 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> | 84 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> |
| 76 | - <div class="flex gap-2 border-t pt-4"><Button type="submit" disabled={pending()}>{t("common.save")}</Button><Button type="button" variant="outline" onClick={() => props.onOpenChange(false)}>{t("common.cancel")}</Button></div> | 85 | + <div class="flex gap-2 border-t border-border-hairline pt-4"><Button type="submit" disabled={pending()}>{t("common.save")}</Button><Button type="button" variant="outline" onClick={() => props.onOpenChange(false)}>{t("common.cancel")}</Button></div> |
| 77 | </form> | 86 | </form> |
| 78 | </SidePanel> | 87 | </SidePanel> |
| 79 | ); | 88 | ); |
src/components/courses/course-edit-panel.tsxmodified+3 -2
| @@ -8,6 +8,7 @@ import { Label } from "@/components/ui/label"; | |||
| 8 | import { Select } from "@/components/ui/select"; | 8 | import { Select } from "@/components/ui/select"; |
| 9 | import { SidePanel } from "@/components/ui/side-panel"; | 9 | import { SidePanel } from "@/components/ui/side-panel"; |
| 10 | import { Textarea } from "@/components/ui/textarea"; | 10 | import { Textarea } from "@/components/ui/textarea"; |
| 11 | +import { courseKindLabel } from "@/lib/course-kind"; | ||
| 11 | import { useT } from "@/stores/preferences-context"; | 12 | import { useT } from "@/stores/preferences-context"; |
| 12 | 13 | ||
| 13 | const COURSE_KINDS: CourseKind[] = ["course", "study", "club"]; | 14 | const COURSE_KINDS: CourseKind[] = ["course", "study", "club"]; |
| @@ -41,8 +42,8 @@ export function CourseEditPanel(props: { | |||
| 41 | setError(""); | 42 | setError(""); |
| 42 | }); | 43 | }); |
| 43 | 44 | ||
| 44 | - const kindLabel = (value: CourseKind) => | 45 | + // One row's kind: the singular label, as in the list's "Tür" column. |
| 45 | - value === "study" ? t("courses.kind.study") : value === "club" ? t("courses.kind.club") : t("courses.kind.course"); | 46 | + const kindLabel = (value: CourseKind) => courseKindLabel(value, t); |
| 46 | 47 | ||
| 47 | const submit = async (event: SubmitEvent) => { | 48 | const submit = async (event: SubmitEvent) => { |
| 48 | event.preventDefault(); | 49 | event.preventDefault(); |
src/components/courses/course-offerings-panel.tsxmodified+12 -6
| @@ -11,6 +11,7 @@ import { Alert } from "@/components/ui/alert"; | |||
| 11 | import { Button } from "@/components/ui/button"; | 11 | import { Button } from "@/components/ui/button"; |
| 12 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 12 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 13 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 13 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 14 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 14 | import { IconEdit, IconEye, IconPlus, IconTrash } from "@/components/ui/icons"; | 15 | import { IconEdit, IconEye, IconPlus, IconTrash } from "@/components/ui/icons"; |
| 15 | import { TableRowActions } from "@/components/ui/table-row-actions"; | 16 | import { TableRowActions } from "@/components/ui/table-row-actions"; |
| 16 | import { createFlash } from "@/lib/flash"; | 17 | import { createFlash } from "@/lib/flash"; |
| @@ -47,7 +48,9 @@ export function CourseOfferingsPanel(props: { courseId: string; courseTitle: str | |||
| 47 | id: "grade", | 48 | id: "grade", |
| 48 | accessorFn: (row) => row.grade_level, | 49 | accessorFn: (row) => row.grade_level, |
| 49 | header: t("classGroups.grade"), | 50 | header: t("classGroups.grade"), |
| 50 | - meta: { cellClass: "font-medium whitespace-nowrap" }, | 51 | + // The table has no header row of its own (DataTable draws none), so |
| 52 | + // the note on inherited, muted values rides on the first column. | ||
| 53 | + meta: { cellClass: "font-medium whitespace-nowrap", headerInfo: t("offerings.help") }, | ||
| 51 | cell: (cell) => gradeLevelLabel(cell.row.original.grade_level, t), | 54 | cell: (cell) => gradeLevelLabel(cell.row.original.grade_level, t), |
| 52 | }, | 55 | }, |
| 53 | { | 56 | { |
| @@ -95,12 +98,14 @@ export function CourseOfferingsPanel(props: { courseId: string; courseTitle: str | |||
| 95 | <div class="space-y-3"> | 98 | <div class="space-y-3"> |
| 96 | <Show when={flash()}><Alert variant="success">{flash()}</Alert></Show> | 99 | <Show when={flash()}><Alert variant="success">{flash()}</Alert></Show> |
| 97 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> | 100 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> |
| 98 | - <Show when={!offerings.loading || offerings.latest} fallback={<DataTableSkeleton />}> | 101 | + <Show when={offerings.error}> |
| 102 | + <ErrorAlert message={formatApiError(offerings.error)} onRetry={() => void refetch()} /> | ||
| 103 | + </Show> | ||
| 104 | + <Show when={!offerings.error && (!offerings.loading || offerings.latest)} fallback={<Show when={!offerings.error}><DataTableSkeleton /></Show>}> | ||
| 99 | <DataTable | 105 | <DataTable |
| 100 | columns={columns()} | 106 | columns={columns()} |
| 101 | data={offerings.latest ?? []} | 107 | data={offerings.latest ?? []} |
| 102 | title={t("offerings.tab")} | 108 | title={t("offerings.tab")} |
| 103 | - description={t("offerings.help")} | ||
| 104 | empty={t("offerings.empty")} | 109 | empty={t("offerings.empty")} |
| 105 | onRowClick={(offering) => open(offering)} | 110 | onRowClick={(offering) => open(offering)} |
| 106 | actions={ | 111 | actions={ |
| @@ -124,9 +129,10 @@ export function CourseOfferingsPanel(props: { courseId: string; courseTitle: str | |||
| 124 | courseTitle={props.courseTitle} | 129 | courseTitle={props.courseTitle} |
| 125 | offering={selected()} | 130 | offering={selected()} |
| 126 | canEdit={props.canEdit} | 131 | canEdit={props.canEdit} |
| 127 | - courseSubjects={subjects.latest ?? []} | 132 | + courseSubjects={subjects.error ? [] : subjects.latest ?? []} |
| 128 | - examKinds={(settings.latest?.exam_kinds ?? []).map((kind) => kind.name)} | 133 | + courseSubjectsLoading={subjects.loading && !subjects.latest} |
| 129 | - limits={limits.latest ?? undefined} | 134 | + examKinds={((settings.error ? undefined : settings.latest)?.exam_kinds ?? []).map((kind) => kind.name)} |
| 135 | + limits={(limits.error ? undefined : limits.latest) ?? undefined} | ||
| 130 | onSaved={async (saved) => { | 136 | onSaved={async (saved) => { |
| 131 | const created = selected() === null; | 137 | const created = selected() === null; |
| 132 | await refetch(); | 138 | await refetch(); |
src/components/courses/course-subjects-panel.tsxmodified+19 -8
| @@ -11,6 +11,7 @@ import { Alert } from "@/components/ui/alert"; | |||
| 11 | import { Button } from "@/components/ui/button"; | 11 | import { Button } from "@/components/ui/button"; |
| 12 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 12 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 13 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 13 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 14 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 14 | import { IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; | 15 | import { IconEdit, IconPlus, IconTrash } from "@/components/ui/icons"; |
| 15 | import { Input } from "@/components/ui/input"; | 16 | import { Input } from "@/components/ui/input"; |
| 16 | import { Label } from "@/components/ui/label"; | 17 | import { Label } from "@/components/ui/label"; |
| @@ -31,13 +32,18 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea | |||
| 31 | const [removeSubject, setRemoveSubject] = createSignal<Subject | null>(null); | 32 | const [removeSubject, setRemoveSubject] = createSignal<Subject | null>(null); |
| 32 | const [name, setName] = createSignal(""); | 33 | const [name, setName] = createSignal(""); |
| 33 | const [description, setDescription] = createSignal(""); | 34 | const [description, setDescription] = createSignal(""); |
| 35 | + // The form keeps its own error so a failed save shows inside the panel, | ||
| 36 | + // not a second time on the page behind it. | ||
| 37 | + const [formError, setFormError] = createSignal(""); | ||
| 34 | const [error, setError] = createSignal(""); | 38 | const [error, setError] = createSignal(""); |
| 35 | const [pending, setPending] = createSignal(false); | 39 | const [pending, setPending] = createSignal(false); |
| 36 | const [flash, setFlash] = createFlash(); | 40 | const [flash, setFlash] = createFlash(); |
| 37 | const [search, setSearch] = createSignal(""); | 41 | const [search, setSearch] = createSignal(""); |
| 38 | const visibleSubjects = createMemo(() => { | 42 | const visibleSubjects = createMemo(() => { |
| 39 | const query = search().trim(); | 43 | const query = search().trim(); |
| 40 | - return query ? (subjects() ?? []).filter((subject) => matchesSearch(query, subject.name, subject.description)) : subjects() ?? []; | 44 | + // An errored resource throws on read; the ErrorAlert stands in for it. |
| 45 | + const rows = subjects.error ? [] : subjects() ?? []; | ||
| 46 | + return query ? rows.filter((subject) => matchesSearch(query, subject.name, subject.description)) : rows; | ||
| 41 | }); | 47 | }); |
| 42 | const columns = createMemo<ColumnDef<Subject>[]>(() => [ | 48 | const columns = createMemo<ColumnDef<Subject>[]>(() => [ |
| 43 | { | 49 | { |
| @@ -78,6 +84,7 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea | |||
| 78 | const subject = editing(); | 84 | const subject = editing(); |
| 79 | setName(subject?.name ?? ""); | 85 | setName(subject?.name ?? ""); |
| 80 | setDescription(subject?.description ?? ""); | 86 | setDescription(subject?.description ?? ""); |
| 87 | + setFormError(""); | ||
| 81 | }); | 88 | }); |
| 82 | 89 | ||
| 83 | const openEdit = (subject: Subject) => { | 90 | const openEdit = (subject: Subject) => { |
| @@ -92,7 +99,7 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea | |||
| 92 | 99 | ||
| 93 | const save = async (event: SubmitEvent) => { | 100 | const save = async (event: SubmitEvent) => { |
| 94 | event.preventDefault(); | 101 | event.preventDefault(); |
| 95 | - setError(""); | 102 | + setFormError(""); |
| 96 | setPending(true); | 103 | setPending(true); |
| 97 | try { | 104 | try { |
| 98 | const body = { name: name().trim(), description: description().trim() }; | 105 | const body = { name: name().trim(), description: description().trim() }; |
| @@ -104,7 +111,7 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea | |||
| 104 | await refetch(); | 111 | await refetch(); |
| 105 | setFlash(subject ? t("common.saved") : t("common.created")); | 112 | setFlash(subject ? t("common.saved") : t("common.created")); |
| 106 | } catch (err) { | 113 | } catch (err) { |
| 107 | - setError(formatApiError(err)); | 114 | + setFormError(formatApiError(err)); |
| 108 | } finally { | 115 | } finally { |
| 109 | setPending(false); | 116 | setPending(false); |
| 110 | } | 117 | } |
| @@ -118,14 +125,14 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea | |||
| 118 | <SidePanel guardUnsaved open={props.createOpen} onOpenChange={setPanelOpen} title={editing() ? t("subjects.edit") : t("subjects.add")} description={t("subjects.help")}> | 125 | <SidePanel guardUnsaved open={props.createOpen} onOpenChange={setPanelOpen} title={editing() ? t("subjects.edit") : t("subjects.add")} description={t("subjects.help")}> |
| 119 | <form class="space-y-3" onSubmit={(event) => void save(event)}> | 126 | <form class="space-y-3" onSubmit={(event) => void save(event)}> |
| 120 | <div class="space-y-1.5"> | 127 | <div class="space-y-1.5"> |
| 121 | - <Label for="subject-name">{t("subjects.name")}</Label> | 128 | + <Label for="subject-name">{t("subjects.name")}<span class="ml-0.5 text-destructive-text">*</span></Label> |
| 122 | <Input id="subject-name" required maxlength={200} value={name()} onInput={(event) => setName(event.currentTarget.value)} /> | 129 | <Input id="subject-name" required maxlength={200} value={name()} onInput={(event) => setName(event.currentTarget.value)} /> |
| 123 | </div> | 130 | </div> |
| 124 | <div class="space-y-1.5"> | 131 | <div class="space-y-1.5"> |
| 125 | <Label for="subject-description">{t("form.description")}</Label> | 132 | <Label for="subject-description">{t("form.description")}</Label> |
| 126 | <Textarea id="subject-description" maxlength={2000} rows={3} value={description()} onInput={(event) => setDescription(event.currentTarget.value)} /> | 133 | <Textarea id="subject-description" maxlength={2000} rows={3} value={description()} onInput={(event) => setDescription(event.currentTarget.value)} /> |
| 127 | </div> | 134 | </div> |
| 128 | - {error() && <p class="text-sm text-destructive-text">{error()}</p>} | 135 | + <Show when={formError()}><Alert variant="destructive">{formError()}</Alert></Show> |
| 129 | <div class="flex flex-wrap gap-2"> | 136 | <div class="flex flex-wrap gap-2"> |
| 130 | <Button type="submit" class="rounded-lg" disabled={pending()}> | 137 | <Button type="submit" class="rounded-lg" disabled={pending()}> |
| 131 | {editing() ? t("common.update") : t("common.create")} | 138 | {editing() ? t("common.update") : t("common.create")} |
| @@ -161,19 +168,22 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea | |||
| 161 | }} | 168 | }} |
| 162 | /> | 169 | /> |
| 163 | 170 | ||
| 164 | - {error() && <p class="rounded-xl bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p>} | 171 | + <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> |
| 172 | + <Show when={subjects.error}> | ||
| 173 | + <ErrorAlert message={formatApiError(subjects.error)} onRetry={() => void refetch()} /> | ||
| 174 | + </Show> | ||
| 165 | 175 | ||
| 166 | {/* The table draws its toolbar (search, add, columns) and grid as two | 176 | {/* The table draws its toolbar (search, add, columns) and grid as two |
| 167 | sibling cards, like the list pages; no frame around them. */} | 177 | sibling cards, like the list pages; no frame around them. */} |
| 168 | <Suspense fallback={<DataTableSkeleton />}> | 178 | <Suspense fallback={<DataTableSkeleton />}> |
| 179 | + <Show when={!subjects.error}> | ||
| 169 | <DataTable | 180 | <DataTable |
| 170 | columns={columns()} | 181 | columns={columns()} |
| 171 | data={visibleSubjects()} | 182 | data={visibleSubjects()} |
| 172 | searchValue={search()} | 183 | searchValue={search()} |
| 173 | onSearchInput={setSearch} | 184 | onSearchInput={setSearch} |
| 174 | filterPlaceholder={t("common.searchPlaceholder")} | 185 | filterPlaceholder={t("common.searchPlaceholder")} |
| 175 | - enablePagination | 186 | + filterHint={t("search.hint.subjects")} |
| 176 | - pageSize={10} | ||
| 177 | empty={t("subjects.empty")} | 187 | empty={t("subjects.empty")} |
| 178 | emptyIllustration="courses" | 188 | emptyIllustration="courses" |
| 179 | actions={props.canManage ? ( | 189 | actions={props.canManage ? ( |
| @@ -182,6 +192,7 @@ export function CourseSubjectsPanel(props: { courseId: string; canManage: boolea | |||
| 182 | </Button> | 192 | </Button> |
| 183 | ) : undefined} | 193 | ) : undefined} |
| 184 | /> | 194 | /> |
| 195 | + </Show> | ||
| 185 | </Suspense> | 196 | </Suspense> |
| 186 | </div> | 197 | </div> |
| 187 | ); | 198 | ); |
src/components/courses/offering-panel.tsxmodified+20 -3
| @@ -22,6 +22,7 @@ import { WeeklyPlanTable } from "@/components/instances/weekly-plan-table"; | |||
| 22 | import { InfoTip } from "@/components/ui/info-tip"; | 22 | import { InfoTip } from "@/components/ui/info-tip"; |
| 23 | import { WeeklySlotForm } from "@/components/instances/weekly-slot-form"; | 23 | import { WeeklySlotForm } from "@/components/instances/weekly-slot-form"; |
| 24 | import { Alert } from "@/components/ui/alert"; | 24 | import { Alert } from "@/components/ui/alert"; |
| 25 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 25 | import { Button } from "@/components/ui/button"; | 26 | import { Button } from "@/components/ui/button"; |
| 26 | import { IconPlus } from "@/components/ui/icons"; | 27 | import { IconPlus } from "@/components/ui/icons"; |
| 27 | import { Input } from "@/components/ui/input"; | 28 | import { Input } from "@/components/ui/input"; |
| @@ -47,6 +48,8 @@ export function OfferingPanel(props: { | |||
| 47 | offering: Offering | null; | 48 | offering: Offering | null; |
| 48 | canEdit: boolean; | 49 | canEdit: boolean; |
| 49 | courseSubjects: Subject[]; | 50 | courseSubjects: Subject[]; |
| 51 | + /** The catalog subjects are still loading: the picker waits instead of saying all are taken. */ | ||
| 52 | + courseSubjectsLoading?: boolean; | ||
| 50 | examKinds: string[]; | 53 | examKinds: string[]; |
| 51 | limits?: Limits; | 54 | limits?: Limits; |
| 52 | onSaved: (offering: Offering) => void | Promise<void>; | 55 | onSaved: (offering: Offering) => void | Promise<void>; |
| @@ -67,6 +70,10 @@ export function OfferingPanel(props: { | |||
| 67 | const [subjects, { refetch: refetchSubjects }] = createResource(editingId, (id) => getOfferingSubjects(id)); | 70 | const [subjects, { refetch: refetchSubjects }] = createResource(editingId, (id) => getOfferingSubjects(id)); |
| 68 | const [slots, { refetch: refetchSlots }] = createResource(editingId, (id) => getOfferingWeeklyPlan(id)); | 71 | const [slots, { refetch: refetchSlots }] = createResource(editingId, (id) => getOfferingWeeklyPlan(id)); |
| 69 | const [weights, { refetch: refetchWeights }] = createResource(editingId, async (id) => (await getOfferingExamWeights(id)).weights); | 72 | const [weights, { refetch: refetchWeights }] = createResource(editingId, async (id) => (await getOfferingExamWeights(id)).weights); |
| 73 | + // An errored resource throws on read; each section shows its own retry. | ||
| 74 | + const subjectRows = () => (subjects.error ? [] : subjects.latest ?? []); | ||
| 75 | + const slotRows = () => (slots.error ? [] : slots.latest ?? []); | ||
| 76 | + const weightRows = () => (weights.error ? [] : weights.latest ?? []); | ||
| 70 | 77 | ||
| 71 | createEffect(() => { | 78 | createEffect(() => { |
| 72 | if (!props.open) return; | 79 | if (!props.open) return; |
| @@ -188,8 +195,12 @@ export function OfferingPanel(props: { | |||
| 188 | <h3 class="text-sm font-semibold">{t("instances.subjectsTitle")}</h3> | 195 | <h3 class="text-sm font-semibold">{t("instances.subjectsTitle")}</h3> |
| 189 | <InfoTip text={t("offerings.subjectsHelp")} label={t("common.infoAbout", { item: t("instances.subjectsTitle") })} /> | 196 | <InfoTip text={t("offerings.subjectsHelp")} label={t("common.infoAbout", { item: t("instances.subjectsTitle") })} /> |
| 190 | </div> | 197 | </div> |
| 198 | + <Show when={subjects.error}> | ||
| 199 | + <ErrorAlert message={formatApiError(subjects.error)} onRetry={() => void refetchSubjects()} /> | ||
| 200 | + </Show> | ||
| 191 | <SubjectSetEditor | 201 | <SubjectSetEditor |
| 192 | - selected={subjects.latest ?? []} | 202 | + loading={(subjects.loading && !subjects.latest) || props.courseSubjectsLoading} |
| 203 | + selected={subjectRows()} | ||
| 193 | available={props.courseSubjects} | 204 | available={props.courseSubjects} |
| 194 | canEdit={props.canEdit} | 205 | canEdit={props.canEdit} |
| 195 | onAdd={async (subjectId) => { await postOfferingSubject(offering().id, subjectId); await refetchSubjects(); }} | 206 | onAdd={async (subjectId) => { await postOfferingSubject(offering().id, subjectId); await refetchSubjects(); }} |
| @@ -202,8 +213,11 @@ export function OfferingPanel(props: { | |||
| 202 | <h3 class="text-sm font-semibold">{t("weeklyPlan.title")}</h3> | 213 | <h3 class="text-sm font-semibold">{t("weeklyPlan.title")}</h3> |
| 203 | <InfoTip text={t("offerings.weeklyPlanHelp")} label={t("common.infoAbout", { item: t("weeklyPlan.title") })} /> | 214 | <InfoTip text={t("offerings.weeklyPlanHelp")} label={t("common.infoAbout", { item: t("weeklyPlan.title") })} /> |
| 204 | </div> | 215 | </div> |
| 216 | + <Show when={slots.error}> | ||
| 217 | + <ErrorAlert message={formatApiError(slots.error)} onRetry={() => void refetchSlots()} /> | ||
| 218 | + </Show> | ||
| 205 | <WeeklyPlanTable | 219 | <WeeklyPlanTable |
| 206 | - slots={slots.latest ?? []} | 220 | + slots={slotRows()} |
| 207 | onRemove={props.canEdit ? (slot: WeeklySlot) => void guard(async () => { await deleteOfferingWeeklySlotById(offering().id, slot.id); await refetchSlots(); }) : undefined} | 221 | onRemove={props.canEdit ? (slot: WeeklySlot) => void guard(async () => { await deleteOfferingWeeklySlotById(offering().id, slot.id); await refetchSlots(); }) : undefined} |
| 208 | actions={ | 222 | actions={ |
| 209 | <Show when={props.canEdit}> | 223 | <Show when={props.canEdit}> |
| @@ -221,8 +235,11 @@ export function OfferingPanel(props: { | |||
| 221 | <h3 class="text-sm font-semibold">{t("instances.examWeightsTitle")}</h3> | 235 | <h3 class="text-sm font-semibold">{t("instances.examWeightsTitle")}</h3> |
| 222 | <InfoTip text={t("offerings.weightsHelp")} label={t("common.infoAbout", { item: t("instances.examWeightsTitle") })} /> | 236 | <InfoTip text={t("offerings.weightsHelp")} label={t("common.infoAbout", { item: t("instances.examWeightsTitle") })} /> |
| 223 | </div> | 237 | </div> |
| 238 | + <Show when={weights.error}> | ||
| 239 | + <ErrorAlert message={formatApiError(weights.error)} onRetry={() => void refetchWeights()} /> | ||
| 240 | + </Show> | ||
| 224 | <ExamWeightsEditor | 241 | <ExamWeightsEditor |
| 225 | - weights={weights.latest ?? []} | 242 | + weights={weightRows()} |
| 226 | kinds={props.examKinds} | 243 | kinds={props.examKinds} |
| 227 | canEdit={props.canEdit} | 244 | canEdit={props.canEdit} |
| 228 | editing={weightEditing()} | 245 | editing={weightEditing()} |
src/components/dashboard/quick-link-column.tsxmodified+1 -1
| @@ -31,7 +31,7 @@ export function QuickLinkColumn(props: QuickLinkColumnProps) { | |||
| 31 | <button | 31 | <button |
| 32 | type="button" | 32 | type="button" |
| 33 | onClick={() => props.onOpen(row)} | 33 | onClick={() => props.onOpen(row)} |
| 34 | - class="flex w-full items-center gap-2.5 border-t border-border-hairline py-2.5 text-left first:border-t-0" | 34 | + class="-mx-2 flex w-[calc(100%+1rem)] items-center gap-2.5 border-t border-border-hairline px-2 py-2.5 text-left outline-hidden transition-colors first:border-t-0 hover:bg-surface-tint focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring" |
| 35 | > | 35 | > |
| 36 | <row.Icon class="h-[15px] w-[15px] shrink-0 text-text-subtle" /> | 36 | <row.Icon class="h-[15px] w-[15px] shrink-0 text-text-subtle" /> |
| 37 | <span class="min-w-0 flex-1 truncate text-sm text-text-default">{row.primary}</span> | 37 | <span class="min-w-0 flex-1 truncate text-sm text-text-default">{row.primary}</span> |
src/components/events/attendance-table.tsxmodified+12 -13
| @@ -3,6 +3,7 @@ import type { ColumnDef } from "@tanstack/solid-table"; | |||
| 3 | import type { Attendance } from "@/api/client"; | 3 | import type { Attendance } from "@/api/client"; |
| 4 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 4 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 5 | import { DataTable } from "@/components/ui/data-table"; | 5 | import { DataTable } from "@/components/ui/data-table"; |
| 6 | +import { EmptyState } from "@/components/ui/empty-state"; | ||
| 6 | import { IconTrash } from "@/components/ui/icons"; | 7 | import { IconTrash } from "@/components/ui/icons"; |
| 7 | import { TableRowActions } from "@/components/ui/table-row-actions"; | 8 | import { TableRowActions } from "@/components/ui/table-row-actions"; |
| 8 | import { Badge } from "@/components/ui/badge"; | 9 | import { Badge } from "@/components/ui/badge"; |
| @@ -21,7 +22,7 @@ export function AttendanceTable(props: { | |||
| 21 | onRemove?: (userId: string) => Promise<void>; | 22 | onRemove?: (userId: string) => Promise<void>; |
| 22 | }) { | 23 | }) { |
| 23 | const t = useT(); | 24 | const t = useT(); |
| 24 | - const [targetUser, setTargetUser] = createSignal<string | null>(null); | 25 | + const [target, setTarget] = createSignal<Attendance | null>(null); |
| 25 | const columns = createMemo<ColumnDef<Attendance>[]>(() => [ | 26 | const columns = createMemo<ColumnDef<Attendance>[]>(() => [ |
| 26 | { | 27 | { |
| 27 | id: "attendee", | 28 | id: "attendee", |
| @@ -64,7 +65,7 @@ export function AttendanceTable(props: { | |||
| 64 | label: t("common.remove"), | 65 | label: t("common.remove"), |
| 65 | icon: <IconTrash class="h-4 w-4" />, | 66 | icon: <IconTrash class="h-4 w-4" />, |
| 66 | destructive: true, | 67 | destructive: true, |
| 67 | - onSelect: () => setTargetUser(personId(cell.row.original.user)), | 68 | + onSelect: () => setTarget(cell.row.original), |
| 68 | }, | 69 | }, |
| 69 | ]} | 70 | ]} |
| 70 | /> | 71 | /> |
| @@ -78,27 +79,25 @@ export function AttendanceTable(props: { | |||
| 78 | <Show | 79 | <Show |
| 79 | when={props.rows.length > 0} | 80 | when={props.rows.length > 0} |
| 80 | fallback={ | 81 | fallback={ |
| 81 | - <p class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground"> | 82 | + <EmptyState kind="people" title={props.emptyLabel ?? t("events.noAttendance")} /> |
| 82 | - {props.emptyLabel ?? t("events.noAttendance")} | ||
| 83 | - </p> | ||
| 84 | } | 83 | } |
| 85 | > | 84 | > |
| 86 | - <DataTable columns={columns()} data={props.rows} filterColumn="attendee" enablePagination pageSize={10} /> | 85 | + <DataTable columns={columns()} data={props.rows} filterColumn="attendee" filterHint={t("events.attendanceSearchHint")} enablePagination /> |
| 87 | </Show> | 86 | </Show> |
| 88 | 87 | ||
| 89 | <ConfirmDialog | 88 | <ConfirmDialog |
| 90 | - open={targetUser() != null} | 89 | + open={target() != null} |
| 91 | onOpenChange={(open) => { | 90 | onOpenChange={(open) => { |
| 92 | - if (!open) setTargetUser(null); | 91 | + if (!open) setTarget(null); |
| 93 | }} | 92 | }} |
| 94 | title={t("confirm.deleteTitle")} | 93 | title={t("confirm.deleteTitle")} |
| 95 | variant="destructive" | 94 | variant="destructive" |
| 96 | - summary={t("confirm.removeAttendance", { user: targetUser() ?? "" })} | 95 | + summary={t("confirm.removeAttendance", { user: target() ? personLabel(target()!.user) : "" })} |
| 97 | onConfirm={async () => { | 96 | onConfirm={async () => { |
| 98 | - const userId = targetUser(); | 97 | + const row = target(); |
| 99 | - if (!userId) return; | 98 | + if (!row) return; |
| 100 | - await props.onRemove?.(userId); | 99 | + await props.onRemove?.(personId(row.user)); |
| 101 | - setTargetUser(null); | 100 | + setTarget(null); |
| 102 | }} | 101 | }} |
| 103 | /> | 102 | /> |
| 104 | </> | 103 | </> |
src/components/events/event-roll-call.tsxmodified+17 -18
| @@ -11,7 +11,7 @@ import { TOOLBAR_CONTROL } from "@/components/ui/data-toolbar"; | |||
| 11 | import { EmptyState } from "@/components/ui/empty-state"; | 11 | import { EmptyState } from "@/components/ui/empty-state"; |
| 12 | import { InfoTip } from "@/components/ui/info-tip"; | 12 | import { InfoTip } from "@/components/ui/info-tip"; |
| 13 | import { IconCheck } from "@/components/ui/icons"; | 13 | import { IconCheck } from "@/components/ui/icons"; |
| 14 | -import { TablePagination } from "@/components/ui/table-pagination"; | 14 | +import { InfiniteSentinel } from "@/components/ui/infinite-sentinel"; |
| 15 | import { ATTENDANCE_STATUSES, getAttendanceStatusMeta } from "@/lib/attendance-status"; | 15 | import { ATTENDANCE_STATUSES, getAttendanceStatusMeta } from "@/lib/attendance-status"; |
| 16 | import { cn } from "@/lib/cn"; | 16 | import { cn } from "@/lib/cn"; |
| 17 | import { | 17 | import { |
| @@ -24,7 +24,8 @@ import { personLabel } from "@/lib/person"; | |||
| 24 | import { matchesSearch } from "@/lib/search-text"; | 24 | import { matchesSearch } from "@/lib/search-text"; |
| 25 | import { useT } from "@/stores/preferences-context"; | 25 | import { useT } from "@/stores/preferences-context"; |
| 26 | 26 | ||
| 27 | -const PAGE_SIZE = 20; | 27 | +/** Rows drawn at first and added each time the reader nears the end. */ |
| 28 | +const REVEAL_STEP = 50; | ||
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 30 | * Event roll call as one roster: every expected attendee (resolved by the | 31 | * Event roll call as one roster: every expected attendee (resolved by the |
| @@ -64,7 +65,7 @@ export function EventRollCall(props: { | |||
| 64 | const [summary, setSummary] = createSignal<{ kind: "success" | "destructive"; text: string } | null>(null); | 65 | const [summary, setSummary] = createSignal<{ kind: "success" | "destructive"; text: string } | null>(null); |
| 65 | const [query, setQuery] = createSignal(""); | 66 | const [query, setQuery] = createSignal(""); |
| 66 | const [onlyUnmarked, setOnlyUnmarked] = createSignal(false); | 67 | const [onlyUnmarked, setOnlyUnmarked] = createSignal(false); |
| 67 | - const [page, setPage] = createSignal(0); | 68 | + const [revealed, setRevealed] = createSignal(REVEAL_STEP); |
| 68 | 69 | ||
| 69 | const effective = (userId: string) => draft()[userId] ?? saved()[userId] ?? undefined; | 70 | const effective = (userId: string) => draft()[userId] ?? saved()[userId] ?? undefined; |
| 70 | const changes = createMemo(() => rollCallChanges(saved(), draft())); | 71 | const changes = createMemo(() => rollCallChanges(saved(), draft())); |
| @@ -86,12 +87,10 @@ export function EventRollCall(props: { | |||
| 86 | return !q || matchesSearch(q, personLabel(row.user), row.user.username, row.user.student_number); | 87 | return !q || matchesSearch(q, personLabel(row.user), row.user.username, row.user.student_number); |
| 87 | }); | 88 | }); |
| 88 | }); | 89 | }); |
| 89 | - const pageCount = () => Math.max(1, Math.ceil(visible().length / PAGE_SIZE)); | 90 | + // The roster is already in memory: no page numbers, the list just draws |
| 90 | - createEffect(on([query, onlyUnmarked], () => setPage(0), { defer: true })); | 91 | + // more rows as the reader scrolls (the app's client-list standard). |
| 91 | - createEffect(() => { | 92 | + createEffect(on([query, onlyUnmarked], () => setRevealed(REVEAL_STEP), { defer: true })); |
| 92 | - if (page() >= pageCount()) setPage(pageCount() - 1); | 93 | + const pageRows = createMemo(() => visible().slice(0, revealed())); |
| 93 | - }); | ||
| 94 | - const pageRows = createMemo(() => visible().slice(page() * PAGE_SIZE, (page() + 1) * PAGE_SIZE)); | ||
| 95 | 94 | ||
| 96 | const busy = () => progress() != null; | 95 | const busy = () => progress() != null; |
| 97 | const locked = () => !props.open || busy(); | 96 | const locked = () => !props.open || busy(); |
| @@ -224,7 +223,7 @@ export function EventRollCall(props: { | |||
| 224 | type="button" | 223 | type="button" |
| 225 | size="sm" | 224 | size="sm" |
| 226 | variant="outline" | 225 | variant="outline" |
| 227 | - class={cn(TOOLBAR_CONTROL, "px-3.5")} | 226 | + class={cn(TOOLBAR_CONTROL, "px-3.5", onlyUnmarked() && "border-primary text-primary-text")} |
| 228 | aria-pressed={onlyUnmarked()} | 227 | aria-pressed={onlyUnmarked()} |
| 229 | onClick={() => setOnlyUnmarked((value) => !value)} | 228 | onClick={() => setOnlyUnmarked((value) => !value)} |
| 230 | > | 229 | > |
| @@ -283,7 +282,7 @@ export function EventRollCall(props: { | |||
| 283 | aria-checked={selected()} | 282 | aria-checked={selected()} |
| 284 | disabled={locked()} | 283 | disabled={locked()} |
| 285 | class={cn( | 284 | class={cn( |
| 286 | - "h-9 min-w-0 rounded-lg border px-2.5 text-xs font-semibold transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60", | 285 | + "h-10 min-w-0 rounded-lg border px-2.5 text-xs sm:h-9 touch:h-10 font-semibold transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60", |
| 287 | selected() | 286 | selected() |
| 288 | ? getAttendanceStatusMeta(status)?.class ?? "border-primary bg-primary/10 text-primary-text" | 287 | ? getAttendanceStatusMeta(status)?.class ?? "border-primary bg-primary/10 text-primary-text" |
| 289 | : "border-border-line bg-surface-base text-muted-foreground hover:bg-muted/60 hover:text-foreground", | 288 | : "border-border-line bg-surface-base text-muted-foreground hover:bg-muted/60 hover:text-foreground", |
| @@ -302,12 +301,12 @@ export function EventRollCall(props: { | |||
| 302 | </For> | 301 | </For> |
| 303 | </ul> | 302 | </ul> |
| 304 | </Show> | 303 | </Show> |
| 305 | - <TablePagination | 304 | + <InfiniteSentinel |
| 306 | - pageIndex={page()} | 305 | + hasMore={pageRows().length < visible().length} |
| 307 | - pageCount={pageCount()} | 306 | + loading={false} |
| 308 | - pageSize={PAGE_SIZE} | 307 | + shown={pageRows().length} |
| 309 | total={visible().length} | 308 | total={visible().length} |
| 310 | - onPageChange={setPage} | 309 | + onLoadMore={() => setRevealed((count) => count + REVEAL_STEP)} |
| 311 | /> | 310 | /> |
| 312 | 311 | ||
| 313 | <Show when={summary()}> | 312 | <Show when={summary()}> |
| @@ -323,14 +322,14 @@ export function EventRollCall(props: { | |||
| 323 | : t("events.rollCall.noChanges")} | 322 | : t("events.rollCall.noChanges")} |
| 324 | </p> | 323 | </p> |
| 325 | <Show when={changes().length > 0 && !busy()}> | 324 | <Show when={changes().length > 0 && !busy()}> |
| 326 | - <Button type="button" variant="ghost" size="sm" class="h-9 rounded-lg" onClick={() => { setDraft({}); setRowErrors({}); setSummary(null); }}> | 325 | + <Button type="button" variant="ghost" size="sm" class="h-10 rounded-lg sm:h-9 touch:h-10" onClick={() => { setDraft({}); setRowErrors({}); setSummary(null); }}> |
| 327 | {t("events.rollCall.discard")} | 326 | {t("events.rollCall.discard")} |
| 328 | </Button> | 327 | </Button> |
| 329 | </Show> | 328 | </Show> |
| 330 | <Button | 329 | <Button |
| 331 | type="button" | 330 | type="button" |
| 332 | size="sm" | 331 | size="sm" |
| 333 | - class="h-9 min-w-[7.5rem] rounded-lg" | 332 | + class="h-10 min-w-[7.5rem] rounded-lg sm:h-9 touch:h-10" |
| 334 | disabled={locked() || changes().length === 0} | 333 | disabled={locked() || changes().length === 0} |
| 335 | onClick={() => void save()} | 334 | onClick={() => void save()} |
| 336 | > | 335 | > |
src/components/exams/bank-question-picker.tsxmodified+1 -1
| @@ -65,7 +65,7 @@ export function BankQuestionPicker(props: { | |||
| 65 | 65 | ||
| 66 | return ( | 66 | return ( |
| 67 | <div class="space-y-3"> | 67 | <div class="space-y-3"> |
| 68 | - <p class="rounded-lg border border-amber-500/20 bg-amber-500/8 px-3 py-2 text-xs text-muted-foreground"> | 68 | + <p class="rounded-lg border border-warning/20 bg-warning/10 px-3 py-2 text-xs text-muted-foreground"> |
| 69 | {t("bank.copyNotice")} | 69 | {t("bank.copyNotice")} |
| 70 | </p> | 70 | </p> |
| 71 | 71 | ||
src/components/exams/exam-audience-panel.tsxmodified+3 -0
| @@ -174,6 +174,9 @@ export function ExamAudiencePanel(props: { | |||
| 174 | <Show when={error()}> | 174 | <Show when={error()}> |
| 175 | <Alert variant="destructive">{error()}</Alert> | 175 | <Alert variant="destructive">{error()}</Alert> |
| 176 | </Show> | 176 | </Show> |
| 177 | + {/* DataTable no longer draws its title block, and this line is the only | ||
| 178 | + place the tab says what sharing does. */} | ||
| 179 | + <p class="text-sm text-muted-foreground">{t("exams.audience.description")}</p> | ||
| 177 | <Suspense fallback={<DataTableSkeleton columns={2} rows={3} />}> | 180 | <Suspense fallback={<DataTableSkeleton columns={2} rows={3} />}> |
| 178 | <Show when={!audience.error} fallback={<Alert variant="destructive">{formatApiError(audience.error)}</Alert>}> | 181 | <Show when={!audience.error} fallback={<Alert variant="destructive">{formatApiError(audience.error)}</Alert>}> |
| 179 | <DataTable | 182 | <DataTable |
src/components/exams/exam-questions-panel.tsxmodified+29 -31
| @@ -17,6 +17,7 @@ import { postExamQuestion } from "@/api/exams"; | |||
| 17 | import { ApiError, formatApiError } from "@/api/client"; | 17 | import { ApiError, formatApiError } from "@/api/client"; |
| 18 | import type { ExamQuestion } from "@/api/client"; | 18 | import type { ExamQuestion } from "@/api/client"; |
| 19 | import { Alert } from "@/components/ui/alert"; | 19 | import { Alert } from "@/components/ui/alert"; |
| 20 | +import { EmptyInline } from "@/components/ui/empty-inline"; | ||
| 20 | import { Badge } from "@/components/ui/badge"; | 21 | import { Badge } from "@/components/ui/badge"; |
| 21 | import { Button } from "@/components/ui/button"; | 22 | import { Button } from "@/components/ui/button"; |
| 22 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 23 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| @@ -127,7 +128,12 @@ export function ExamQuestionsPanel(props: { | |||
| 127 | // has not been saved to it, so it must not offer "save another copy". | 128 | // has not been saved to it, so it must not offer "save another copy". |
| 128 | const isSavedToBank = (question: ExamQuestion) => Boolean(question.banked_as) || bankedIds().includes(question.id); | 129 | const isSavedToBank = (question: ExamQuestion) => Boolean(question.banked_as) || bankedIds().includes(question.id); |
| 129 | const isFromBank = (question: ExamQuestion) => Boolean(question.from_bank); | 130 | const isFromBank = (question: ExamQuestion) => Boolean(question.from_bank); |
| 130 | - const subjectName = (subjectId: string) => catalogSubjects()?.find((subject) => subject.id === subjectId)?.name ?? subjectId; | 131 | + // Either list may name the subject; an unnamed one drops its badge rather |
| 132 | + // than print a raw id. | ||
| 133 | + const subjectName = (subjectId: string) => | ||
| 134 | + sectionSubjects()?.find((subject) => subject.id === subjectId)?.name ?? | ||
| 135 | + catalogSubjects()?.find((subject) => subject.id === subjectId)?.name ?? | ||
| 136 | + null; | ||
| 131 | const totalPages = createMemo(() => Math.max(1, Math.ceil(questionList().length / QUESTION_PAGE_SIZE))); | 137 | const totalPages = createMemo(() => Math.max(1, Math.ceil(questionList().length / QUESTION_PAGE_SIZE))); |
| 132 | const safePage = createMemo(() => Math.min(page(), totalPages() - 1)); | 138 | const safePage = createMemo(() => Math.min(page(), totalPages() - 1)); |
| 133 | const pageItems = createMemo(() => { | 139 | const pageItems = createMemo(() => { |
| @@ -351,30 +357,20 @@ export function ExamQuestionsPanel(props: { | |||
| 351 | /> | 357 | /> |
| 352 | </SidePanel> | 358 | </SidePanel> |
| 353 | 359 | ||
| 354 | - {error() && <p class="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p>} | 360 | + <Show when={error()}> |
| 361 | + <Alert variant="destructive">{error()}</Alert> | ||
| 362 | + </Show> | ||
| 355 | 363 | ||
| 356 | <Suspense fallback={<PageSpinner />}> | 364 | <Suspense fallback={<PageSpinner />}> |
| 357 | <Show | 365 | <Show |
| 358 | when={questionList().length > 0} | 366 | when={questionList().length > 0} |
| 359 | fallback={ | 367 | fallback={ |
| 360 | - <div class="rounded-xl border border-dashed border-border-line bg-surface-overlay p-6 text-center"> | 368 | + // The add actions already sit in the header above; the empty |
| 361 | - <p class="text-sm text-muted-foreground">{t("questions.empty")}</p> | 369 | + // state only says so, it does not repeat them. |
| 362 | - <Show when={!props.readOnly}> | 370 | + <EmptyInline |
| 363 | - <Button | 371 | + class="rounded-xl border border-dashed border-border-line bg-surface-overlay" |
| 364 | - type="button" | 372 | + title={t("questions.empty")} |
| 365 | - variant="outline" | 373 | + /> |
| 366 | - size="sm" | ||
| 367 | - class="mt-3 gap-1.5" | ||
| 368 | - onClick={() => { | ||
| 369 | - setEditing(null); | ||
| 370 | - setFormOpen(true); | ||
| 371 | - }} | ||
| 372 | - > | ||
| 373 | - <IconPlus class="h-4 w-4" /> | ||
| 374 | - {t("questions.add")} | ||
| 375 | - </Button> | ||
| 376 | - </Show> | ||
| 377 | - </div> | ||
| 378 | } | 374 | } |
| 379 | > | 375 | > |
| 380 | <div class="space-y-3"> | 376 | <div class="space-y-3"> |
| @@ -388,17 +384,19 @@ export function ExamQuestionsPanel(props: { | |||
| 388 | <span class="font-mono text-xs font-semibold text-muted-foreground"> | 384 | <span class="font-mono text-xs font-semibold text-muted-foreground"> |
| 389 | #{safePage() * QUESTION_PAGE_SIZE + index() + 1} | 385 | #{safePage() * QUESTION_PAGE_SIZE + index() + 1} |
| 390 | </span> | 386 | </span> |
| 391 | - <Badge variant="outline" class="capitalize"> | 387 | + <Badge variant="outline"> |
| 392 | {q.kind === "choice" ? t("questions.kind.choice") : t("questions.kind.text")} | 388 | {q.kind === "choice" ? t("questions.kind.choice") : t("questions.kind.text")} |
| 393 | </Badge> | 389 | </Badge> |
| 394 | - <Badge variant="secondary">{subjectName(q.subject)}</Badge> | 390 | + <Show when={subjectName(q.subject)}> |
| 391 | + {(name) => <Badge variant="secondary">{name()}</Badge>} | ||
| 392 | + </Show> | ||
| 395 | <Badge variant="outline" class="font-mono"> | 393 | <Badge variant="outline" class="font-mono"> |
| 396 | {q.points} {t("questions.points")} | 394 | {q.points} {t("questions.points")} |
| 397 | </Badge> | 395 | </Badge> |
| 398 | {/* One badge per direction: a question can be both (added | 396 | {/* One badge per direction: a question can be both (added |
| 399 | from the bank, then saved back), so they stack. */} | 397 | from the bank, then saved back), so they stack. */} |
| 400 | <Show when={isFromBank(q)}> | 398 | <Show when={isFromBank(q)}> |
| 401 | - <Badge variant="outline" class="gap-1 border-brand/40 text-brand"> | 399 | + <Badge variant="outline" class="gap-1 border-primary/40 text-primary-text"> |
| 402 | <IconArchive class="h-3 w-3" /> | 400 | <IconArchive class="h-3 w-3" /> |
| 403 | {t("bank.fromBankBadge")} | 401 | {t("bank.fromBankBadge")} |
| 404 | </Badge> | 402 | </Badge> |
| @@ -422,7 +420,7 @@ export function ExamQuestionsPanel(props: { | |||
| 422 | type="button" | 420 | type="button" |
| 423 | variant="ghost" | 421 | variant="ghost" |
| 424 | size="sm" | 422 | size="sm" |
| 425 | - class="h-7 w-fit text-xs text-destructive-text" | 423 | + class="h-7 w-fit text-xs text-destructive-text touch:h-10" |
| 426 | disabled={imagePending() === `${q.id}:question`} | 424 | disabled={imagePending() === `${q.id}:question`} |
| 427 | onClick={() => void removeQuestionImage(q)} | 425 | onClick={() => void removeQuestionImage(q)} |
| 428 | > | 426 | > |
| @@ -458,7 +456,7 @@ export function ExamQuestionsPanel(props: { | |||
| 458 | type="button" | 456 | type="button" |
| 459 | variant="ghost" | 457 | variant="ghost" |
| 460 | size="sm" | 458 | size="sm" |
| 461 | - class="h-7 px-2 text-xs text-destructive-text" | 459 | + class="h-7 px-2 text-xs text-destructive-text touch:h-10" |
| 462 | disabled={imagePending() === `${q.id}:choice:${choice.id}`} | 460 | disabled={imagePending() === `${q.id}:choice:${choice.id}`} |
| 463 | onClick={() => void removeChoiceImage(q, choice.id)} | 461 | onClick={() => void removeChoiceImage(q, choice.id)} |
| 464 | > | 462 | > |
| @@ -481,7 +479,7 @@ export function ExamQuestionsPanel(props: { | |||
| 481 | type="button" | 479 | type="button" |
| 482 | variant="outline" | 480 | variant="outline" |
| 483 | size="sm" | 481 | size="sm" |
| 484 | - class="h-8 gap-1.5 px-2.5 text-xs" | 482 | + class="h-8 gap-1.5 px-2.5 text-xs touch:h-10" |
| 485 | disabled={banking() === q.id} | 483 | disabled={banking() === q.id} |
| 486 | onClick={() => (isSavedToBank(q) ? setConfirmBank(q) : void saveToBank(q))} | 484 | onClick={() => (isSavedToBank(q) ? setConfirmBank(q) : void saveToBank(q))} |
| 487 | > | 485 | > |
| @@ -498,7 +496,7 @@ export function ExamQuestionsPanel(props: { | |||
| 498 | type="button" | 496 | type="button" |
| 499 | variant="outline" | 497 | variant="outline" |
| 500 | size="sm" | 498 | size="sm" |
| 501 | - class="h-8 gap-1.5 px-2.5 text-xs" | 499 | + class="h-8 gap-1.5 px-2.5 text-xs touch:h-10" |
| 502 | disabled={banking() === q.id} | 500 | disabled={banking() === q.id} |
| 503 | onClick={() => setConfirmRefresh(q)} | 501 | onClick={() => setConfirmRefresh(q)} |
| 504 | > | 502 | > |
| @@ -511,7 +509,7 @@ export function ExamQuestionsPanel(props: { | |||
| 511 | type="button" | 509 | type="button" |
| 512 | variant="outline" | 510 | variant="outline" |
| 513 | size="sm" | 511 | size="sm" |
| 514 | - class="h-8 px-2.5 text-xs" | 512 | + class="h-8 px-2.5 text-xs touch:h-10" |
| 515 | onClick={() => setEditing(q)} | 513 | onClick={() => setEditing(q)} |
| 516 | > | 514 | > |
| 517 | {t("common.edit")} | 515 | {t("common.edit")} |
| @@ -520,7 +518,7 @@ export function ExamQuestionsPanel(props: { | |||
| 520 | type="button" | 518 | type="button" |
| 521 | variant="ghost" | 519 | variant="ghost" |
| 522 | size="sm" | 520 | size="sm" |
| 523 | - class="h-8 w-8 p-0 text-destructive-text" | 521 | + class="h-8 w-8 p-0 text-destructive-text touch:h-10 touch:w-10" |
| 524 | onClick={() => setRemoveQuestion(q)} | 522 | onClick={() => setRemoveQuestion(q)} |
| 525 | aria-label={t("common.delete")} | 523 | aria-label={t("common.delete")} |
| 526 | > | 524 | > |
| @@ -541,7 +539,7 @@ export function ExamQuestionsPanel(props: { | |||
| 541 | type="button" | 539 | type="button" |
| 542 | variant="outline" | 540 | variant="outline" |
| 543 | size="sm" | 541 | size="sm" |
| 544 | - class="h-8 gap-1 rounded-lg text-xs" | 542 | + class="h-8 gap-1 rounded-lg text-xs touch:h-10" |
| 545 | disabled={safePage() <= 0} | 543 | disabled={safePage() <= 0} |
| 546 | onClick={() => setPage((p) => Math.max(0, p - 1))} | 544 | onClick={() => setPage((p) => Math.max(0, p - 1))} |
| 547 | > | 545 | > |
| @@ -555,7 +553,7 @@ export function ExamQuestionsPanel(props: { | |||
| 555 | type="button" | 553 | type="button" |
| 556 | variant="outline" | 554 | variant="outline" |
| 557 | size="sm" | 555 | size="sm" |
| 558 | - class="h-8 gap-1 rounded-lg text-xs" | 556 | + class="h-8 gap-1 rounded-lg text-xs touch:h-10" |
| 559 | disabled={safePage() >= totalPages() - 1} | 557 | disabled={safePage() >= totalPages() - 1} |
| 560 | onClick={() => setPage((p) => Math.min(totalPages() - 1, p + 1))} | 558 | onClick={() => setPage((p) => Math.min(totalPages() - 1, p + 1))} |
| 561 | > | 559 | > |
src/components/exams/exam-room-ws.tsxmodified+12 -10
| @@ -457,9 +457,9 @@ export function ExamRoomWS(props: { exam: Exam }) { | |||
| 457 | </div> | 457 | </div> |
| 458 | </Match> | 458 | </Match> |
| 459 | <Match when={att().status === "expired"}> | 459 | <Match when={att().status === "expired"}> |
| 460 | - <div class="rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3"> | 460 | + <div class="rounded-lg border border-warning/30 bg-warning/10 px-4 py-3"> |
| 461 | <div class="flex items-start gap-3"> | 461 | <div class="flex items-start gap-3"> |
| 462 | - <IconAlert class="mt-0.5 h-5 w-5 shrink-0 text-amber-500" /> | 462 | + <IconAlert class="mt-0.5 h-5 w-5 shrink-0 text-warning-text" /> |
| 463 | <div class="min-w-0 space-y-1"> | 463 | <div class="min-w-0 space-y-1"> |
| 464 | <p class="text-sm font-semibold text-foreground">{t("attempt.expired")}</p> | 464 | <p class="text-sm font-semibold text-foreground">{t("attempt.expired")}</p> |
| 465 | <p class="text-sm text-muted-foreground">{t("attempt.closed")}</p> | 465 | <p class="text-sm text-muted-foreground">{t("attempt.closed")}</p> |
| @@ -468,9 +468,9 @@ export function ExamRoomWS(props: { exam: Exam }) { | |||
| 468 | </div> | 468 | </div> |
| 469 | </Match> | 469 | </Match> |
| 470 | <Match when={attemptStatus() === "left"}> | 470 | <Match when={attemptStatus() === "left"}> |
| 471 | - <div class="rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3"> | 471 | + <div class="rounded-lg border border-warning/30 bg-warning/10 px-4 py-3"> |
| 472 | <div class="flex items-start gap-3"> | 472 | <div class="flex items-start gap-3"> |
| 473 | - <IconAlert class="mt-0.5 h-5 w-5 shrink-0 text-amber-500" /> | 473 | + <IconAlert class="mt-0.5 h-5 w-5 shrink-0 text-warning-text" /> |
| 474 | <div class="min-w-0 space-y-1"> | 474 | <div class="min-w-0 space-y-1"> |
| 475 | <p class="text-sm font-semibold text-foreground">{t("attempt.left")}</p> | 475 | <p class="text-sm font-semibold text-foreground">{t("attempt.left")}</p> |
| 476 | <p class="text-sm text-muted-foreground">{t("attempt.closed")}</p> | 476 | <p class="text-sm text-muted-foreground">{t("attempt.closed")}</p> |
| @@ -553,7 +553,7 @@ export function ExamRoomWS(props: { exam: Exam }) { | |||
| 553 | <div> | 553 | <div> |
| 554 | <h3 class="text-sm font-semibold">{t("questions.title")}</h3> | 554 | <h3 class="text-sm font-semibold">{t("questions.title")}</h3> |
| 555 | <p class="mt-1 text-xs text-muted-foreground"> | 555 | <p class="mt-1 text-xs text-muted-foreground"> |
| 556 | - {attempt()?.answered ?? 0} / {attempt()?.question_count ?? questions().length} {t("attempt.progress").toLowerCase()} | 556 | + {attempt()?.answered ?? 0} / {attempt()?.question_count ?? questions().length} {t("attempt.progress").toLocaleLowerCase(locale())} |
| 557 | </p> | 557 | </p> |
| 558 | </div> | 558 | </div> |
| 559 | <div class="grid grid-cols-4 gap-1.5"> | 559 | <div class="grid grid-cols-4 gap-1.5"> |
| @@ -562,10 +562,11 @@ export function ExamRoomWS(props: { exam: Exam }) { | |||
| 562 | <button | 562 | <button |
| 563 | type="button" | 563 | type="button" |
| 564 | class={cn( | 564 | class={cn( |
| 565 | - "inline-flex h-8 items-center justify-center rounded-md border text-xs font-medium transition-colors hover:bg-accent", | 565 | + "inline-flex h-8 items-center justify-center rounded-md border text-xs font-medium transition-colors hover:bg-accent touch:h-10", |
| 566 | question.answer ? "border-primary/35 bg-primary/10 text-primary-text hover:bg-primary/15" : "bg-background", | 566 | question.answer ? "border-primary/35 bg-primary/10 text-primary-text hover:bg-primary/15" : "bg-background", |
| 567 | activeQuestionIndex() === index() && "ring-2 ring-primary/60", | 567 | activeQuestionIndex() === index() && "ring-2 ring-primary/60", |
| 568 | )} | 568 | )} |
| 569 | + aria-current={activeQuestionIndex() === index() ? "step" : undefined} | ||
| 569 | onClick={() => setActiveQuestionIndex(index())} | 570 | onClick={() => setActiveQuestionIndex(index())} |
| 570 | > | 571 | > |
| 571 | {index() + 1} | 572 | {index() + 1} |
| @@ -574,7 +575,7 @@ export function ExamRoomWS(props: { exam: Exam }) { | |||
| 574 | </For> | 575 | </For> |
| 575 | </div> | 576 | </div> |
| 576 | <Show when={canWrite()}> | 577 | <Show when={canWrite()}> |
| 577 | - <Button type="button" variant="destructive" class="h-9 w-full rounded-md" disabled={pending()} onClick={() => setFinishOpen(true)}> | 578 | + <Button type="button" variant="destructive" class="h-9 w-full rounded-md touch:h-10" disabled={pending()} onClick={() => setFinishOpen(true)}> |
| 578 | {t("attempt.finish")} | 579 | {t("attempt.finish")} |
| 579 | </Button> | 580 | </Button> |
| 580 | </Show> | 581 | </Show> |
| @@ -635,7 +636,7 @@ function AttemptSummaryWS(props: { attempt: ExamAttempt; status?: string; remain | |||
| 635 | <p class="text-xs text-muted-foreground">{t("attempt.attempt")}</p> | 636 | <p class="text-xs text-muted-foreground">{t("attempt.attempt")}</p> |
| 636 | <p class="mt-1 font-medium tabular-nums">{attemptLabel()}</p> | 637 | <p class="mt-1 font-medium tabular-nums">{attemptLabel()}</p> |
| 637 | </div> | 638 | </div> |
| 638 | - <div class={remainingWarn() ? "h-full rounded-lg border border-amber-500/40 bg-amber-500/10 p-3" : "h-full rounded-lg border bg-background/60 p-3"}> | 639 | + <div class={remainingWarn() ? "h-full rounded-lg border border-warning/40 bg-warning/10 p-3" : "h-full rounded-lg border bg-background/60 p-3"}> |
| 639 | <p class="text-xs text-muted-foreground">{t("attempt.remaining")}</p> | 640 | <p class="text-xs text-muted-foreground">{t("attempt.remaining")}</p> |
| 640 | <p class="mt-1 font-mono text-lg font-semibold tabular-nums">{formatRemaining(props.remainingMs)}</p> | 641 | <p class="mt-1 font-mono text-lg font-semibold tabular-nums">{formatRemaining(props.remainingMs)}</p> |
| 641 | </div> | 642 | </div> |
| @@ -668,7 +669,7 @@ function AttemptSummaryWS(props: { attempt: ExamAttempt; status?: string; remain | |||
| 668 | </div> | 669 | </div> |
| 669 | </Show> | 670 | </Show> |
| 670 | <Show when={props.attempt.left_at != null}> | 671 | <Show when={props.attempt.left_at != null}> |
| 671 | - <div class="h-full rounded-lg border border-amber-500/40 bg-amber-500/10 p-3"> | 672 | + <div class="h-full rounded-lg border border-warning/40 bg-warning/10 p-3"> |
| 672 | <p class="text-xs text-muted-foreground">{t("attempt.left")}</p> | 673 | <p class="text-xs text-muted-foreground">{t("attempt.left")}</p> |
| 673 | <p class="mt-1 font-medium">{formatDateTime(props.attempt.left_at, locale())}</p> | 674 | <p class="mt-1 font-medium">{formatDateTime(props.attempt.left_at, locale())}</p> |
| 674 | </div> | 675 | </div> |
| @@ -679,6 +680,7 @@ function AttemptSummaryWS(props: { attempt: ExamAttempt; status?: string; remain | |||
| 679 | 680 | ||
| 680 | function AttemptFocusBar(props: { attempt: ExamAttempt; status?: string; remainingMs: number | null; wsState: WsState }) { | 681 | function AttemptFocusBar(props: { attempt: ExamAttempt; status?: string; remainingMs: number | null; wsState: WsState }) { |
| 681 | const t = useT(); | 682 | const t = useT(); |
| 683 | + const { locale } = usePreferences(); | ||
| 682 | const progressPct = () => | 684 | const progressPct = () => |
| 683 | props.attempt.question_count <= 0 | 685 | props.attempt.question_count <= 0 |
| 684 | ? 0 | 686 | ? 0 |
| @@ -696,7 +698,7 @@ function AttemptFocusBar(props: { attempt: ExamAttempt; status?: string; remaini | |||
| 696 | <span class="font-medium text-foreground">{statusLabel()}</span> | 698 | <span class="font-medium text-foreground">{statusLabel()}</span> |
| 697 | <span class="mono font-semibold tabular-nums text-foreground">{formatRemaining(props.remainingMs)}</span> | 699 | <span class="mono font-semibold tabular-nums text-foreground">{formatRemaining(props.remainingMs)}</span> |
| 698 | <span> | 700 | <span> |
| 699 | - {props.attempt.answered} / {props.attempt.question_count} {t("attempt.progress").toLowerCase()} | 701 | + {props.attempt.answered} / {props.attempt.question_count} {t("attempt.progress").toLocaleLowerCase(locale())} |
| 700 | </span> | 702 | </span> |
| 701 | <span class="ml-auto inline-flex items-center gap-1.5"> | 703 | <span class="ml-auto inline-flex items-center gap-1.5"> |
| 702 | <span class={props.wsState === "connected" ? "h-2 w-2 rounded-full bg-success" : "h-2 w-2 rounded-full bg-warning"} /> | 704 | <span class={props.wsState === "connected" ? "h-2 w-2 rounded-full bg-success" : "h-2 w-2 rounded-full bg-warning"} /> |
src/components/exams/grade-form.tsxmodified+1 -1
| @@ -41,7 +41,7 @@ export function GradeForm(props: { | |||
| 41 | const uid = userId().trim(); | 41 | const uid = userId().trim(); |
| 42 | const m = Number(mark()); | 42 | const m = Number(mark()); |
| 43 | if (!uid) { | 43 | if (!uid) { |
| 44 | - setError(t("form.studentId")); | 44 | + setError(t("form.selectStudent")); |
| 45 | return; | 45 | return; |
| 46 | } | 46 | } |
| 47 | if (!Number.isInteger(m) || m < 0 || m > 100) { | 47 | if (!Number.isInteger(m) || m < 0 || m > 100) { |
src/components/exams/question-form.tsxmodified+10 -8
| @@ -345,17 +345,19 @@ export function QuestionForm(props: { | |||
| 345 | </div> | 345 | </div> |
| 346 | <div> | 346 | <div> |
| 347 | <Label class="mb-1 block text-xs font-semibold text-muted-foreground">{t("questions.kind")}</Label> | 347 | <Label class="mb-1 block text-xs font-semibold text-muted-foreground">{t("questions.kind")}</Label> |
| 348 | - <div class="flex gap-0.5 rounded-md border bg-muted/40 p-0.5"> | 348 | + {/* h-9 like the subject select and points field beside it. */} |
| 349 | + <div role="group" aria-label={t("questions.kind")} class="flex h-9 gap-0.5 rounded-md border bg-muted/40 p-0.5"> | ||
| 349 | <For each={QUESTION_KINDS}> | 350 | <For each={QUESTION_KINDS}> |
| 350 | {(k) => ( | 351 | {(k) => ( |
| 351 | <button | 352 | <button |
| 352 | type="button" | 353 | type="button" |
| 353 | class={cn( | 354 | class={cn( |
| 354 | - "h-7 rounded-sm px-2.5 text-xs font-semibold transition-colors", | 355 | + "rounded-sm px-2.5 text-xs font-semibold transition-colors", |
| 355 | kind() === k | 356 | kind() === k |
| 356 | ? "bg-primary text-primary-foreground shadow-2xs" | 357 | ? "bg-primary text-primary-foreground shadow-2xs" |
| 357 | : "text-muted-foreground hover:text-foreground", | 358 | : "text-muted-foreground hover:text-foreground", |
| 358 | )} | 359 | )} |
| 360 | + aria-pressed={kind() === k} | ||
| 359 | onClick={() => setKind(k)} | 361 | onClick={() => setKind(k)} |
| 360 | > | 362 | > |
| 361 | {k === "choice" ? t("questions.kind.choice") : t("questions.kind.text")} | 363 | {k === "choice" ? t("questions.kind.choice") : t("questions.kind.text")} |
| @@ -386,7 +388,7 @@ export function QuestionForm(props: { | |||
| 386 | <Label class="text-sm font-semibold">{t("questions.choices")}</Label> | 388 | <Label class="text-sm font-semibold">{t("questions.choices")}</Label> |
| 387 | <p class="mt-0.5 text-xs text-muted-foreground">{t("questions.correctHint")}</p> | 389 | <p class="mt-0.5 text-xs text-muted-foreground">{t("questions.correctHint")}</p> |
| 388 | </div> | 390 | </div> |
| 389 | - <Button type="button" variant="outline" size="sm" class="h-7 gap-1 text-xs" disabled={rows().length >= BANK_QUESTION_LIMITS.maxChoices} onClick={addChoice}> | 391 | + <Button type="button" variant="outline" size="sm" class="h-7 gap-1 text-xs touch:h-10" disabled={rows().length >= BANK_QUESTION_LIMITS.maxChoices} onClick={addChoice}> |
| 390 | <IconPlus class="h-3.5 w-3.5" /> | 392 | <IconPlus class="h-3.5 w-3.5" /> |
| 391 | {t("questions.addChoice")} | 393 | {t("questions.addChoice")} |
| 392 | </Button> | 394 | </Button> |
| @@ -403,16 +405,16 @@ export function QuestionForm(props: { | |||
| 403 | data-choice-id={row().id} | 405 | data-choice-id={row().id} |
| 404 | class={cn( | 406 | class={cn( |
| 405 | "flex items-start gap-2 rounded-md border p-2 transition-colors", | 407 | "flex items-start gap-2 rounded-md border p-2 transition-colors", |
| 406 | - isCorrect() ? "border-emerald-400/60 bg-emerald-50/60" : "border-border bg-background", | 408 | + isCorrect() ? "border-success/60 bg-success/10" : "border-border bg-background", |
| 407 | )} | 409 | )} |
| 408 | > | 410 | > |
| 409 | <button | 411 | <button |
| 410 | type="button" | 412 | type="button" |
| 411 | class={cn( | 413 | class={cn( |
| 412 | - "mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-xs font-bold transition-colors", | 414 | + "mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded text-xs font-bold transition-colors touch:h-10 touch:w-10", |
| 413 | isCorrect() | 415 | isCorrect() |
| 414 | - ? "bg-emerald-600 text-white shadow-2xs" | 416 | + ? "bg-success text-white shadow-2xs" |
| 415 | - : "border bg-background text-muted-foreground hover:border-emerald-400 hover:text-emerald-600", | 417 | + : "border bg-background text-muted-foreground hover:border-success hover:text-success-text", |
| 416 | )} | 418 | )} |
| 417 | onClick={() => setCorrect(row().id)} | 419 | onClick={() => setCorrect(row().id)} |
| 418 | title={t("questions.correct")} | 420 | title={t("questions.correct")} |
| @@ -453,7 +455,7 @@ export function QuestionForm(props: { | |||
| 453 | variant="ghost" | 455 | variant="ghost" |
| 454 | size="sm" | 456 | size="sm" |
| 455 | disabled={rows().length <= BANK_QUESTION_LIMITS.minChoices} | 457 | disabled={rows().length <= BANK_QUESTION_LIMITS.minChoices} |
| 456 | - class="mt-0.5 h-6 w-6 p-0 text-muted-foreground hover:text-destructive-text" | 458 | + class="mt-0.5 h-6 w-6 p-0 text-muted-foreground hover:text-destructive-text touch:h-10 touch:w-10" |
| 457 | onClick={() => removeChoice(row().id)} | 459 | onClick={() => removeChoice(row().id)} |
| 458 | aria-label={t("common.delete")} | 460 | aria-label={t("common.delete")} |
| 459 | > | 461 | > |
src/components/homework/course-homework-panel.tsxmodified+14 -5
| @@ -73,8 +73,11 @@ export function CourseHomeworkPanel(props: { | |||
| 73 | // A homework subject must sit in the section's resolved subject set. | 73 | // A homework subject must sit in the section's resolved subject set. |
| 74 | const [subjects] = createResource( | 74 | const [subjects] = createResource( |
| 75 | () => (props.active ? props.instanceId : null), | 75 | () => (props.active ? props.instanceId : null), |
| 76 | - async (instanceId) => (instanceId ? (await getInstanceSubjects(instanceId)).subjects : []), | 76 | + // Without subjects the form says so and cannot be sent; a refusal is the same case. |
| 77 | + async (instanceId) => (instanceId ? (await getInstanceSubjects(instanceId).catch(() => ({ subjects: [] }))).subjects : []), | ||
| 77 | ); | 78 | ); |
| 79 | + // An errored resource throws when read, so the rows are read through here. | ||
| 80 | + const rows = () => (homework.error ? [] : homework() ?? []); | ||
| 78 | const [serverTime] = createResource(() => getTime().catch(() => ({ now: Date.now() }))); | 81 | const [serverTime] = createResource(() => getTime().catch(() => ({ now: Date.now() }))); |
| 79 | const [editing, setEditing] = createSignal<Homework | null>(null); | 82 | const [editing, setEditing] = createSignal<Homework | null>(null); |
| 80 | const [deleteTarget, setDeleteTarget] = createSignal<Homework | null>(null); | 83 | const [deleteTarget, setDeleteTarget] = createSignal<Homework | null>(null); |
| @@ -112,7 +115,7 @@ export function CourseHomeworkPanel(props: { | |||
| 112 | if (!open) resetForm(); | 115 | if (!open) resetForm(); |
| 113 | }; | 116 | }; |
| 114 | 117 | ||
| 115 | - createEffect(() => props.onCountChange(homework()?.length ?? 0)); | 118 | + createEffect(() => props.onCountChange(rows().length)); |
| 116 | createEffect(() => { | 119 | createEffect(() => { |
| 117 | if (!subjectId()) setSubjectId(subjects()?.[0]?.id ?? ""); | 120 | if (!subjectId()) setSubjectId(subjects()?.[0]?.id ?? ""); |
| 118 | }); | 121 | }); |
| @@ -127,7 +130,7 @@ export function CourseHomeworkPanel(props: { | |||
| 127 | } | 130 | } |
| 128 | const current = editing(); | 131 | const current = editing(); |
| 129 | if ((!current || due_at !== current.due_at) && due_at < (serverTime()?.now ?? Date.now())) { | 132 | if ((!current || due_at !== current.due_at) && due_at < (serverTime()?.now ?? Date.now())) { |
| 130 | - setError(t("form.timePast")); | 133 | + setError(t("homework.duePast")); |
| 131 | return; | 134 | return; |
| 132 | } | 135 | } |
| 133 | setPending(true); | 136 | setPending(true); |
| @@ -211,12 +214,15 @@ export function CourseHomeworkPanel(props: { | |||
| 211 | <Alert variant="destructive">{error()}</Alert> | 214 | <Alert variant="destructive">{error()}</Alert> |
| 212 | </Show> | 215 | </Show> |
| 213 | 216 | ||
| 217 | + <Show when={homework.error}> | ||
| 218 | + <Alert variant="destructive">{formatApiError(homework.error)}</Alert> | ||
| 219 | + </Show> | ||
| 214 | <Suspense fallback={<DataTableSkeleton />}> | 220 | <Suspense fallback={<DataTableSkeleton />}> |
| 215 | {/* The add button rides in the table's toolbar card, so it stays | 221 | {/* The add button rides in the table's toolbar card, so it stays |
| 216 | reachable on an empty list too. */} | 222 | reachable on an empty list too. */} |
| 217 | <DataTable | 223 | <DataTable |
| 218 | columns={columns()} | 224 | columns={columns()} |
| 219 | - data={homework() ?? []} | 225 | + data={rows()} |
| 220 | filterColumn="title" | 226 | filterColumn="title" |
| 221 | enablePagination | 227 | enablePagination |
| 222 | pageSize={10} | 228 | pageSize={10} |
| @@ -245,6 +251,9 @@ export function CourseHomeworkPanel(props: { | |||
| 245 | <Select id="homework-subject" required value={subjectId()} onChange={(event) => setSubjectId(event.currentTarget.value)}> | 251 | <Select id="homework-subject" required value={subjectId()} onChange={(event) => setSubjectId(event.currentTarget.value)}> |
| 246 | <For each={subjects() ?? []}>{(subject: Subject) => <option value={subject.id}>{subject.name}</option>}</For> | 252 | <For each={subjects() ?? []}>{(subject: Subject) => <option value={subject.id}>{subject.name}</option>}</For> |
| 247 | </Select> | 253 | </Select> |
| 254 | + <Show when={subjects.state === "ready" && (subjects() ?? []).length === 0}> | ||
| 255 | + <p class="text-xs text-text-subtle">{t("subjects.empty")}</p> | ||
| 256 | + </Show> | ||
| 248 | </div> | 257 | </div> |
| 249 | <div class="space-y-1.5"> | 258 | <div class="space-y-1.5"> |
| 250 | <Label for="homework-description">{t("form.description")}</Label> | 259 | <Label for="homework-description">{t("form.description")}</Label> |
| @@ -254,7 +263,7 @@ export function CourseHomeworkPanel(props: { | |||
| 254 | <Label for="homework-due-date">{t("homework.dueAt")}</Label> | 263 | <Label for="homework-due-date">{t("homework.dueAt")}</Label> |
| 255 | <div class="grid grid-cols-2 gap-2"> | 264 | <div class="grid grid-cols-2 gap-2"> |
| 256 | <DatePicker id="homework-due-date" class="h-9" placeholder={t("form.datePlaceholder")} value={dueDate()} required onChange={setDueDate} /> | 265 | <DatePicker id="homework-due-date" class="h-9" placeholder={t("form.datePlaceholder")} value={dueDate()} required onChange={setDueDate} /> |
| 257 | - <Input class="h-9 rounded-md font-mono placeholder:text-text-placeholder" placeholder="17:00" value={dueTime()} required onInput={(event) => setDueTime(event.currentTarget.value)} /> | 266 | + <Input id="homework-due-time" class="h-9 rounded-md font-mono placeholder:text-muted-foreground/45" inputMode="numeric" maxlength={5} placeholder="17:00" aria-label={t("homework.dueTime")} value={dueTime()} required onInput={(event) => setDueTime(event.currentTarget.value)} /> |
| 258 | </div> | 267 | </div> |
| 259 | </div> | 268 | </div> |
| 260 | <p class="rounded-xl border border-border-line bg-surface-tint px-3 py-2 text-xs text-text-subtle">{t("homework.wholeCourseHelp")}</p> | 269 | <p class="rounded-xl border border-border-line bg-surface-tint px-3 py-2 text-xs text-text-subtle">{t("homework.wholeCourseHelp")}</p> |
src/components/homework/homework-report-view.tsxmodified+12 -6
| @@ -4,6 +4,8 @@ import { useNavigate } from "@tanstack/solid-router"; | |||
| 4 | import type { ColumnDef } from "@tanstack/solid-table"; | 4 | import type { ColumnDef } from "@tanstack/solid-table"; |
| 5 | import { getHomeworkReport } from "@/api/homework"; | 5 | import { getHomeworkReport } from "@/api/homework"; |
| 6 | import type { HomeworkReportEntry } from "@/api/client"; | 6 | import type { HomeworkReportEntry } from "@/api/client"; |
| 7 | +import { formatApiError } from "@/api/client"; | ||
| 8 | +import { Alert } from "@/components/ui/alert"; | ||
| 7 | import { Badge } from "@/components/ui/badge"; | 9 | import { Badge } from "@/components/ui/badge"; |
| 8 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 10 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 9 | import { EmptyState } from "@/components/ui/empty-state"; | 11 | import { EmptyState } from "@/components/ui/empty-state"; |
| @@ -21,12 +23,14 @@ export function HomeworkReportView(props: { userId: string }) { | |||
| 21 | const { locale } = usePreferences(); | 23 | const { locale } = usePreferences(); |
| 22 | const [tab, setTab] = createSignal<ReportTab>("all"); | 24 | const [tab, setTab] = createSignal<ReportTab>("all"); |
| 23 | const [report] = createResource(() => props.userId, async (userId) => getHomeworkReport(userId, { limit: 100 })); | 25 | const [report] = createResource(() => props.userId, async (userId) => getHomeworkReport(userId, { limit: 100 })); |
| 26 | + // An errored resource throws when read, so reads go through `items`. | ||
| 27 | + const items = () => (report.error ? [] : report()?.items ?? []); | ||
| 24 | const rows = createMemo(() => { | 28 | const rows = createMemo(() => { |
| 25 | - const items = report()?.items ?? []; | 29 | + const all = items(); |
| 26 | - if (tab() === "todo") return items.filter((row) => !row.submitted); | 30 | + if (tab() === "todo") return all.filter((row) => !row.submitted); |
| 27 | - if (tab() === "submitted") return items.filter((row) => row.submitted); | 31 | + if (tab() === "submitted") return all.filter((row) => row.submitted); |
| 28 | - if (tab() === "graded") return items.filter((row) => row.result !== null); | 32 | + if (tab() === "graded") return all.filter((row) => row.result != null); |
| 29 | - return items; | 33 | + return all; |
| 30 | }); | 34 | }); |
| 31 | const statusLabel = (row: HomeworkReportEntry) => { | 35 | const statusLabel = (row: HomeworkReportEntry) => { |
| 32 | if (row.missing) return t("homework.status.missing"); | 36 | if (row.missing) return t("homework.status.missing"); |
| @@ -92,7 +96,8 @@ export function HomeworkReportView(props: { userId: string }) { | |||
| 92 | 96 | ||
| 93 | return ( | 97 | return ( |
| 94 | <Suspense fallback={<DataTableSkeleton />}> | 98 | <Suspense fallback={<DataTableSkeleton />}> |
| 95 | - <Show when={(report()?.items ?? []).length > 0} fallback={<EmptyState kind="homework" title={t("homework.empty")} />}> | 99 | + <Show when={!report.error} fallback={<Alert variant="destructive">{formatApiError(report.error)}</Alert>}> |
| 100 | + <Show when={items().length > 0} fallback={<EmptyState kind="homework" title={t("homework.empty")} />}> | ||
| 96 | <Tabs value={tab()} onChange={(value) => setTab(value as ReportTab)}> | 101 | <Tabs value={tab()} onChange={(value) => setTab(value as ReportTab)}> |
| 97 | <TabsList aria-label={t("homework.title")}> | 102 | <TabsList aria-label={t("homework.title")}> |
| 98 | <TabsTrigger value="all">{t("common.all")}</TabsTrigger> | 103 | <TabsTrigger value="all">{t("common.all")}</TabsTrigger> |
| @@ -114,6 +119,7 @@ export function HomeworkReportView(props: { userId: string }) { | |||
| 114 | </TabsContent> | 119 | </TabsContent> |
| 115 | </Tabs> | 120 | </Tabs> |
| 116 | </Show> | 121 | </Show> |
| 122 | + </Show> | ||
| 117 | </Suspense> | 123 | </Suspense> |
| 118 | ); | 124 | ); |
| 119 | } | 125 | } |
src/components/homework/homework-submission-panel.tsxmodified+46 -20
| @@ -13,7 +13,7 @@ import { | |||
| 13 | import { getSettings } from "@/api/settings"; | 13 | import { getSettings } from "@/api/settings"; |
| 14 | import { Alert } from "@/components/ui/alert"; | 14 | import { Alert } from "@/components/ui/alert"; |
| 15 | import { Badge } from "@/components/ui/badge"; | 15 | import { Badge } from "@/components/ui/badge"; |
| 16 | -import { Button } from "@/components/ui/button"; | 16 | +import { Button, buttonVariants } from "@/components/ui/button"; |
| 17 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 17 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 18 | import { IconDownload, IconTrash, IconUploadCloud } from "@/components/ui/icons"; | 18 | import { IconDownload, IconTrash, IconUploadCloud } from "@/components/ui/icons"; |
| 19 | import { PageSpinner } from "@/components/ui/page-spinner"; | 19 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| @@ -33,6 +33,7 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { | |||
| 33 | const [error, setError] = createSignal(""); | 33 | const [error, setError] = createSignal(""); |
| 34 | const [flash, setFlash] = createFlash(); | 34 | const [flash, setFlash] = createFlash(); |
| 35 | const [withdrawOpen, setWithdrawOpen] = createSignal(false); | 35 | const [withdrawOpen, setWithdrawOpen] = createSignal(false); |
| 36 | + const [removeTarget, setRemoveTarget] = createSignal<{ id: string; name: string } | null>(null); | ||
| 36 | let input: HTMLInputElement | undefined; | 37 | let input: HTMLInputElement | undefined; |
| 37 | 38 | ||
| 38 | const [settings] = createResource(() => getSettings().catch(() => null)); | 39 | const [settings] = createResource(() => getSettings().catch(() => null)); |
| @@ -59,9 +60,13 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { | |||
| 59 | }, | 60 | }, |
| 60 | ); | 61 | ); |
| 61 | const maxFileBytes = () => maxUploadBytes(settings()); | 62 | const maxFileBytes = () => maxUploadBytes(settings()); |
| 62 | - const hasFiles = () => (submission()?.files.length ?? 0) > 0; | 63 | + // An errored resource throws when read: these two stand in for them. |
| 64 | + const current = () => (submission.error ? null : submission() ?? null); | ||
| 65 | + const grade = () => (result.error ? null : result() ?? null); | ||
| 66 | + const loadError = () => submission.error ?? result.error; | ||
| 67 | + const hasFiles = () => (current()?.files.length ?? 0) > 0; | ||
| 63 | 68 | ||
| 64 | - createEffect(() => setText(submission()?.text ?? "")); | 69 | + createEffect(() => setText(current()?.text ?? "")); |
| 65 | 70 | ||
| 66 | const save = async (event: SubmitEvent) => { | 71 | const save = async (event: SubmitEvent) => { |
| 67 | event.preventDefault(); | 72 | event.preventDefault(); |
| @@ -114,7 +119,7 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { | |||
| 114 | 119 | ||
| 115 | // The backend refuses a withdrawal once a grade exists (409), so the button | 120 | // The backend refuses a withdrawal once a grade exists (409), so the button |
| 116 | // only shows while there is a submission and no result on it. | 121 | // only shows while there is a submission and no result on it. |
| 117 | - const canWithdraw = () => submission() != null && result() == null; | 122 | + const canWithdraw = () => current() != null && grade() == null && !result.error; |
| 118 | const withdraw = async () => { | 123 | const withdraw = async () => { |
| 119 | setError(""); | 124 | setError(""); |
| 120 | setPending(true); | 125 | setPending(true); |
| @@ -150,8 +155,11 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { | |||
| 150 | <Show when={error()}> | 155 | <Show when={error()}> |
| 151 | <Alert variant="destructive">{error()}</Alert> | 156 | <Alert variant="destructive">{error()}</Alert> |
| 152 | </Show> | 157 | </Show> |
| 158 | + <Show when={loadError()}> | ||
| 159 | + {(err) => <Alert variant="destructive">{formatApiError(err(), locale())}</Alert>} | ||
| 160 | + </Show> | ||
| 153 | <Suspense fallback={<PageSpinner />}> | 161 | <Suspense fallback={<PageSpinner />}> |
| 154 | - <Show when={result()}> | 162 | + <Show when={grade()}> |
| 155 | {(row) => ( | 163 | {(row) => ( |
| 156 | <div class="rounded-xl border border-border-line bg-surface-tint p-3 text-sm"> | 164 | <div class="rounded-xl border border-border-line bg-surface-tint p-3 text-sm"> |
| 157 | <div class="flex flex-wrap items-center gap-2"> | 165 | <div class="flex flex-wrap items-center gap-2"> |
| @@ -186,7 +194,7 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { | |||
| 186 | <div class="flex items-center gap-2"> | 194 | <div class="flex items-center gap-2"> |
| 187 | <p class="text-sm font-medium">{t("notes.files")}</p> | 195 | <p class="text-sm font-medium">{t("notes.files")}</p> |
| 188 | <Show when={hasFiles()}> | 196 | <Show when={hasFiles()}> |
| 189 | - <Badge variant="secondary" class="rounded-full">{submission()!.files.length}</Badge> | 197 | + <Badge variant="secondary" class="rounded-full">{current()!.files.length}</Badge> |
| 190 | </Show> | 198 | </Show> |
| 191 | </div> | 199 | </div> |
| 192 | <input ref={(el) => { input = el; }} type="file" class="hidden" disabled={pending()} onChange={(event) => void upload(event.currentTarget.files?.[0])} /> | 200 | <input ref={(el) => { input = el; }} type="file" class="hidden" disabled={pending()} onChange={(event) => void upload(event.currentTarget.files?.[0])} /> |
| @@ -198,7 +206,7 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { | |||
| 198 | {/* Collapsed to just the header row above until a file exists — the list opens the moment one is added. */} | 206 | {/* Collapsed to just the header row above until a file exists — the list opens the moment one is added. */} |
| 199 | <Show when={hasFiles()}> | 207 | <Show when={hasFiles()}> |
| 200 | <ul class="grid grid-cols-1 gap-2 sm:grid-cols-2"> | 208 | <ul class="grid grid-cols-1 gap-2 sm:grid-cols-2"> |
| 201 | - <For each={submission()?.files ?? []}> | 209 | + <For each={current()?.files ?? []}> |
| 202 | {(file) => { | 210 | {(file) => { |
| 203 | const meta = fileTypeMeta(file); | 211 | const meta = fileTypeMeta(file); |
| 204 | return ( | 212 | return ( |
| @@ -208,12 +216,17 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { | |||
| 208 | <p class="truncate font-medium">{file.name}</p> | 216 | <p class="truncate font-medium">{file.name}</p> |
| 209 | <p class="text-xs text-text-subtle">{formatBytes(file.size)}</p> | 217 | <p class="text-xs text-text-subtle">{formatBytes(file.size)}</p> |
| 210 | </div> | 218 | </div> |
| 211 | - <a href={getHomeworkSubmissionFileUrl(props.homeworkId, file.id)} download={file.name}> | 219 | + {/* A link styled as the icon button, never a button inside a link. */} |
| 212 | - <Button type="button" size="icon" variant="ghost" class="h-7 w-7 rounded-lg" title={t("notes.downloadFile")}> | 220 | + <a |
| 213 | - <IconDownload class="h-3.5 w-3.5" /> | 221 | + href={getHomeworkSubmissionFileUrl(props.homeworkId, file.id)} |
| 214 | - </Button> | 222 | + download={file.name} |
| 223 | + class={cn(buttonVariants({ variant: "ghost", size: "icon" }), "h-10 w-10 rounded-lg sm:h-8 sm:w-8 touch:h-10 touch:w-10")} | ||
| 224 | + title={t("notes.downloadFile")} | ||
| 225 | + aria-label={`${t("notes.downloadFile")}: ${file.name}`} | ||
| 226 | + > | ||
| 227 | + <IconDownload class="h-3.5 w-3.5" /> | ||
| 215 | </a> | 228 | </a> |
| 216 | - <Button type="button" size="icon" variant="ghost" class="h-7 w-7 rounded-lg text-destructive-text hover:text-destructive-text" disabled={pending()} title={t("common.delete")} onClick={() => void removeFile(file.id)}> | 229 | + <Button type="button" size="icon" variant="ghost" class="h-10 w-10 rounded-lg text-destructive-text hover:text-destructive-text sm:h-8 sm:w-8 touch:h-10 touch:w-10" disabled={pending()} title={t("notes.removeFile")} aria-label={`${t("notes.removeFile")}: ${file.name}`} onClick={() => setRemoveTarget({ id: file.id, name: file.name })}> |
| 217 | <IconTrash class="h-3.5 w-3.5" /> | 230 | <IconTrash class="h-3.5 w-3.5" /> |
| 218 | </Button> | 231 | </Button> |
| 219 | </li> | 232 | </li> |
| @@ -221,18 +234,31 @@ export function HomeworkSubmissionPanel(props: { homeworkId: string }) { | |||
| 221 | }} | 234 | }} |
| 222 | </For> | 235 | </For> |
| 223 | </ul> | 236 | </ul> |
| 224 | - <Show when={submission()}> | ||
| 225 | - {(row) => ( | ||
| 226 | - <p class="text-xs text-text-subtle"> | ||
| 227 | - {t("homework.submittedAt")}: {formatDateTime(row().updated_at, locale())} | ||
| 228 | - <Show when={row().late}> · {t("homework.late")}</Show> | ||
| 229 | - </p> | ||
| 230 | - )} | ||
| 231 | - </Show> | ||
| 232 | </Show> | 237 | </Show> |
| 233 | </div> | 238 | </div> |
| 239 | + {/* A text-only submission has a time too, so this sits outside the files box. */} | ||
| 240 | + <Show when={current()}> | ||
| 241 | + {(row) => ( | ||
| 242 | + <p class="text-xs text-text-subtle"> | ||
| 243 | + {t("homework.submittedAt")}: {formatDateTime(row().updated_at, locale())} | ||
| 244 | + <Show when={row().late}> · {t("homework.late")}</Show> | ||
| 245 | + </p> | ||
| 246 | + )} | ||
| 247 | + </Show> | ||
| 234 | </Suspense> | 248 | </Suspense> |
| 235 | 249 | ||
| 250 | + <ConfirmDialog | ||
| 251 | + open={removeTarget() != null} | ||
| 252 | + onOpenChange={(open) => !open && setRemoveTarget(null)} | ||
| 253 | + title={t("notes.removeFile")} | ||
| 254 | + summary={removeTarget()?.name ?? ""} | ||
| 255 | + variant="destructive" | ||
| 256 | + onConfirm={async () => { | ||
| 257 | + const target = removeTarget(); | ||
| 258 | + setRemoveTarget(null); | ||
| 259 | + if (target) await removeFile(target.id); | ||
| 260 | + }} | ||
| 261 | + /> | ||
| 236 | <ConfirmDialog | 262 | <ConfirmDialog |
| 237 | open={withdrawOpen()} | 263 | open={withdrawOpen()} |
| 238 | onOpenChange={setWithdrawOpen} | 264 | onOpenChange={setWithdrawOpen} |
src/components/homework/homework-submissions-panel.tsxmodified+13 -7
| @@ -8,7 +8,8 @@ import type { HomeworkRosterEntry } from "@/api/client"; | |||
| 8 | import { Alert } from "@/components/ui/alert"; | 8 | import { Alert } from "@/components/ui/alert"; |
| 9 | import { InfoTip } from "@/components/ui/info-tip"; | 9 | import { InfoTip } from "@/components/ui/info-tip"; |
| 10 | import { Badge } from "@/components/ui/badge"; | 10 | import { Badge } from "@/components/ui/badge"; |
| 11 | -import { Button } from "@/components/ui/button"; | 11 | +import { Button, buttonVariants } from "@/components/ui/button"; |
| 12 | +import { cn } from "@/lib/cn"; | ||
| 12 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 13 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 13 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 14 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 14 | import { IconDownload, IconEdit, IconEye, IconTrash } from "@/components/ui/icons"; | 15 | import { IconDownload, IconEdit, IconEye, IconTrash } from "@/components/ui/icons"; |
| @@ -42,7 +43,8 @@ export function HomeworkSubmissionsPanel(props: { homeworkId: string; instanceId | |||
| 42 | ); | 43 | ); |
| 43 | const [enrollments] = createResource( | 44 | const [enrollments] = createResource( |
| 44 | () => props.instanceId, | 45 | () => props.instanceId, |
| 45 | - async (instanceId) => (await getInstanceEnrollments(instanceId, { limit: 200 })).items, | 46 | + // Without the roster the rows fall back to "—" names; not worth an error. |
| 47 | + async (instanceId) => (await getInstanceEnrollments(instanceId, { limit: 200 }).catch(() => ({ items: [] }))).items, | ||
| 46 | ); | 48 | ); |
| 47 | const enrollmentUsers = createMemo(() => new Map((enrollments() ?? []).map((row) => [row.user.id, row.user]))); | 49 | const enrollmentUsers = createMemo(() => new Map((enrollments() ?? []).map((row) => [row.user.id, row.user]))); |
| 48 | const studentLabel = (userId: string) => { | 50 | const studentLabel = (userId: string) => { |
| @@ -178,7 +180,7 @@ export function HomeworkSubmissionsPanel(props: { homeworkId: string; instanceId | |||
| 178 | <Show when={error() && !gradeTarget()}><Alert variant="destructive">{error()}</Alert></Show> | 180 | <Show when={error() && !gradeTarget()}><Alert variant="destructive">{error()}</Alert></Show> |
| 179 | <Suspense fallback={<DataTableSkeleton />}> | 181 | <Suspense fallback={<DataTableSkeleton />}> |
| 180 | <Show when={submissions.error}><Alert variant="destructive">{formatApiError(submissions.error, locale())}</Alert></Show> | 182 | <Show when={submissions.error}><Alert variant="destructive">{formatApiError(submissions.error, locale())}</Alert></Show> |
| 181 | - <DataTable columns={columns()} data={submissions()?.items ?? []} filterColumn="user" enablePagination pageSize={10} empty={t("common.noResults")} /> | 183 | + <DataTable columns={columns()} data={submissions.error ? [] : submissions()?.items ?? []} filterColumn="user" enablePagination pageSize={10} empty={t("common.noResults")} /> |
| 182 | </Suspense> | 184 | </Suspense> |
| 183 | <SidePanel open={gradeTarget() != null} onOpenChange={(open) => !open && closeGrade()} title={t("homework.grade")} description={gradeTarget() ? studentLabel(gradeTarget()!.user) : ""}> | 185 | <SidePanel open={gradeTarget() != null} onOpenChange={(open) => !open && closeGrade()} title={t("homework.grade")} description={gradeTarget() ? studentLabel(gradeTarget()!.user) : ""}> |
| 184 | <form class="flex min-h-full flex-col space-y-4" onSubmit={(event) => void saveGrade(event)}> | 186 | <form class="flex min-h-full flex-col space-y-4" onSubmit={(event) => void saveGrade(event)}> |
| @@ -233,10 +235,14 @@ export function HomeworkSubmissionsPanel(props: { homeworkId: string; instanceId | |||
| 233 | <p class="truncate font-medium">{file.name}</p> | 235 | <p class="truncate font-medium">{file.name}</p> |
| 234 | <p class="text-xs text-text-subtle">{formatBytes(file.size)}</p> | 236 | <p class="text-xs text-text-subtle">{formatBytes(file.size)}</p> |
| 235 | </div> | 237 | </div> |
| 236 | - <a href={getHomeworkSubmissionFileUrl(props.homeworkId, file.id)} download={file.name}> | 238 | + <a |
| 237 | - <Button type="button" size="icon" variant="ghost" class="h-7 w-7 rounded-lg" title={t("notes.downloadFile")}> | 239 | + href={getHomeworkSubmissionFileUrl(props.homeworkId, file.id)} |
| 238 | - <IconDownload class="h-3.5 w-3.5" /> | 240 | + download={file.name} |
| 239 | - </Button> | 241 | + class={cn(buttonVariants({ variant: "ghost", size: "icon" }), "h-10 w-10 rounded-lg sm:h-8 sm:w-8 touch:h-10 touch:w-10")} |
| 242 | + title={t("notes.downloadFile")} | ||
| 243 | + aria-label={`${t("notes.downloadFile")}: ${file.name}`} | ||
| 244 | + > | ||
| 245 | + <IconDownload class="h-3.5 w-3.5" /> | ||
| 240 | </a> | 246 | </a> |
| 241 | </li> | 247 | </li> |
| 242 | ); | 248 | ); |
src/components/insights/insight-run-report.tsxmodified+14 -20
| @@ -5,6 +5,8 @@ import { getUserSearch } from "@/api/users"; | |||
| 5 | import { ApiError, formatApiError, type InsightRun, type PersonRef, type StudentInsight } from "@/api/client"; | 5 | import { ApiError, formatApiError, type InsightRun, type PersonRef, type StudentInsight } from "@/api/client"; |
| 6 | import { InsightDetail } from "@/components/insights/insight-detail"; | 6 | import { InsightDetail } from "@/components/insights/insight-detail"; |
| 7 | import { Button } from "@/components/ui/button"; | 7 | import { Button } from "@/components/ui/button"; |
| 8 | +import { TOOLBAR_CONTROL, TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | ||
| 9 | +import { cn } from "@/lib/cn"; | ||
| 8 | import { EmptyInline } from "@/components/ui/empty-inline"; | 10 | import { EmptyInline } from "@/components/ui/empty-inline"; |
| 9 | import { ErrorAlert } from "@/components/ui/error-alert"; | 11 | import { ErrorAlert } from "@/components/ui/error-alert"; |
| 10 | import { IconCopy, IconDownload, IconFileText, IconReportAnalytics } from "@/components/ui/icons"; | 12 | import { IconCopy, IconDownload, IconFileText, IconReportAnalytics } from "@/components/ui/icons"; |
| @@ -239,7 +241,7 @@ function ReportDocument(props: { | |||
| 239 | <Button | 241 | <Button |
| 240 | variant="outline" | 242 | variant="outline" |
| 241 | size="sm" | 243 | size="sm" |
| 242 | - class="rounded-lg" | 244 | + class={cn(TOOLBAR_CONTROL, "px-3.5")} |
| 243 | onClick={() => props.onOpenStudent?.(student.id)} | 245 | onClick={() => props.onOpenStudent?.(student.id)} |
| 244 | > | 246 | > |
| 245 | {tx("openStudent")} | 247 | {tx("openStudent")} |
| @@ -445,7 +447,7 @@ export function InsightRunReport(props: { run: InsightRun }) { | |||
| 445 | <div class="space-y-5"> | 447 | <div class="space-y-5"> |
| 446 | {/* Report actions are toolbar pills: touch-sized (h-10) below `sm` and on | 448 | {/* Report actions are toolbar pills: touch-sized (h-10) below `sm` and on |
| 447 | touch screens, h-8 above. */} | 449 | touch screens, h-8 above. */} |
| 448 | - <div class="flex flex-wrap items-center justify-end gap-2 [&_button]:h-10 [&_button]:rounded-full [&_button]:px-3.5 [&_button]:text-[13px] sm:[&_button]:h-8 touch:[&_button]:h-10"> | 450 | + <div class={cn("flex flex-wrap items-center justify-end gap-2", TOOLBAR_SLOT)}> |
| 449 | <Button variant="outline" size="sm" disabled={loading()} onClick={() => void copyReport()}> | 451 | <Button variant="outline" size="sm" disabled={loading()} onClick={() => void copyReport()}> |
| 450 | <IconCopy class="h-4 w-4" /> | 452 | <IconCopy class="h-4 w-4" /> |
| 451 | {tx("copy")} | 453 | {tx("copy")} |
| @@ -476,39 +478,31 @@ export function InsightRunReport(props: { run: InsightRun }) { | |||
| 476 | {(message) => <ErrorAlert message={message()} />} | 478 | {(message) => <ErrorAlert message={message()} />} |
| 477 | </Show> | 479 | </Show> |
| 478 | 480 | ||
| 479 | - <Show when={unloaded().length > 0}> | 481 | + {/* One loading bar with one control: signals for the students already |
| 482 | + listed come first, then the next page of the roster. Two buttons | ||
| 483 | + side by side read as two different jobs. */} | ||
| 484 | + <Show when={unloaded().length > 0 || rosterTotal() > roster().length}> | ||
| 480 | <div class="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border-line px-3 py-2"> | 485 | <div class="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border-line px-3 py-2"> |
| 481 | - <p class="text-xs text-muted-foreground"> | 486 | + <p class="text-xs text-muted-foreground" aria-live="polite"> |
| 482 | {loading() ? tx("loadingSignals") : tx("coverage", { loaded: model().coverage.loaded, total: model().coverage.total })} | 487 | {loading() ? tx("loadingSignals") : tx("coverage", { loaded: model().coverage.loaded, total: model().coverage.total })} |
| 483 | </p> | 488 | </p> |
| 484 | <Button | 489 | <Button |
| 485 | variant="outline" | 490 | variant="outline" |
| 486 | size="sm" | 491 | size="sm" |
| 487 | - class="rounded-lg" | 492 | + class={cn(TOOLBAR_CONTROL, "px-3.5")} |
| 488 | disabled={loading()} | 493 | disabled={loading()} |
| 489 | - onClick={() => void loadSignals(unloaded().map((person) => person.id))} | 494 | + onClick={() => |
| 495 | + void (unloaded().length > 0 ? loadSignals(unloaded().map((person) => person.id)) : loadRoster(roster().length))} | ||
| 490 | > | 496 | > |
| 491 | - {tx("loadAll", { count: unloaded().length })} | 497 | + {unloaded().length > 0 ? tx("loadAll", { count: unloaded().length }) : tx("loadMoreRoster")} |
| 492 | </Button> | 498 | </Button> |
| 493 | </div> | 499 | </div> |
| 494 | </Show> | 500 | </Show> |
| 495 | 501 | ||
| 496 | - <Show when={loading() && unloaded().length === 0 && model().coverage.loaded === 0}> | 502 | + <Show when={loading() && unloaded().length === 0 && model().coverage.loaded === 0 && rosterTotal() <= roster().length}> |
| 497 | <p class="text-sm text-muted-foreground">{tx("loadingSignals")}</p> | 503 | <p class="text-sm text-muted-foreground">{tx("loadingSignals")}</p> |
| 498 | </Show> | 504 | </Show> |
| 499 | 505 | ||
| 500 | - <Show when={rosterTotal() > roster().length}> | ||
| 501 | - <Button | ||
| 502 | - variant="outline" | ||
| 503 | - size="sm" | ||
| 504 | - class="rounded-lg" | ||
| 505 | - disabled={loading()} | ||
| 506 | - onClick={() => void loadRoster(roster().length)} | ||
| 507 | - > | ||
| 508 | - {tx("loadMoreRoster")} | ||
| 509 | - </Button> | ||
| 510 | - </Show> | ||
| 511 | - | ||
| 512 | <ReportDocument model={model()} loading={loading()} onOpenStudent={setOpenStudentId} /> | 506 | <ReportDocument model={model()} loading={loading()} onOpenStudent={setOpenStudentId} /> |
| 513 | 507 | ||
| 514 | <Portal mount={document.body}> | 508 | <Portal mount={document.body}> |
src/components/insights/insight-runs-table.tsxmodified+44 -6
| @@ -1,4 +1,4 @@ | |||
| 1 | -import { Show, createMemo, createSignal } from "solid-js"; | 1 | +import { Show, createEffect, createMemo, createSignal, on } from "solid-js"; |
| 2 | import type { ColumnDef } from "@tanstack/solid-table"; | 2 | import type { ColumnDef } from "@tanstack/solid-table"; |
| 3 | import type { InsightRun } from "@/api/client"; | 3 | import type { InsightRun } from "@/api/client"; |
| 4 | import { InsightRunReport } from "@/components/insights/insight-run-report"; | 4 | import { InsightRunReport } from "@/components/insights/insight-run-report"; |
| @@ -26,17 +26,37 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 26 | const rtx = (key: RunReportKey, vars?: Record<string, string | number>) => | 26 | const rtx = (key: RunReportKey, vars?: Record<string, string | number>) => |
| 27 | runReportText(prefs.locale(), key, vars); | 27 | runReportText(prefs.locale(), key, vars); |
| 28 | const [selectedRun, setSelectedRun] = createSignal<InsightRun | null>(null); | 28 | const [selectedRun, setSelectedRun] = createSignal<InsightRun | null>(null); |
| 29 | + // A run under a minute rounded to "0 dk" while its report said "33 ms". | ||
| 30 | + const runDuration = (ms: number | null | undefined) => { | ||
| 31 | + if (ms == null || ms >= 60_000) return formatDurationMinutes(ms, prefs.locale()); | ||
| 32 | + const seconds = Math.max(1, Math.round(ms / 1000)); | ||
| 33 | + return prefs.locale() === "tr" ? `${seconds} sn` : `${seconds} s`; | ||
| 34 | + }; | ||
| 35 | + // The report opens under the table, out of view on a long list: bring it | ||
| 36 | + // up so a row click does not look like it did nothing. | ||
| 37 | + let reportSection: HTMLElement | undefined; | ||
| 38 | + createEffect(on(selectedRun, (run) => { | ||
| 39 | + if (run) queueMicrotask(() => reportSection?.scrollIntoView({ behavior: "smooth", block: "start" })); | ||
| 40 | + }, { defer: true })); | ||
| 41 | + // Every column is sized to its header label and its widest value, and | ||
| 42 | + // keeps that width (`minSize`): at the 120px default each got, eleven | ||
| 43 | + // labels truncated to "Çalı…"/"Başla…" and the dates to "26 Eyl 20…". The | ||
| 44 | + // run day stays pinned while the grid scrolls sideways. | ||
| 29 | // One value per cell: the start time, the failed/skipped counts and each | 45 | // One value per cell: the start time, the failed/skipped counts and each |
| 30 | // kind of issue used to stack under a headline value, so rows grew to | 46 | // kind of issue used to stack under a headline value, so rows grew to |
| 31 | // different heights. Each now has its own column. | 47 | // different heights. Each now has its own column. |
| 32 | const columns = createMemo<ColumnDef<InsightRun>[]>(() => [ | 48 | const columns = createMemo<ColumnDef<InsightRun>[]>(() => [ |
| 33 | { | 49 | { |
| 34 | accessorKey: "run_day", | 50 | accessorKey: "run_day", |
| 51 | + size: 146, | ||
| 52 | + minSize: 146, | ||
| 35 | header: tx("insights.runDay"), | 53 | header: tx("insights.runDay"), |
| 36 | - meta: { align: "center", cellClass: "font-medium text-text-strong" }, | 54 | + meta: { align: "center", cellClass: "font-medium text-text-strong", stickyLeft: true }, |
| 37 | }, | 55 | }, |
| 38 | { | 56 | { |
| 39 | id: "started_at", | 57 | id: "started_at", |
| 58 | + size: 150, | ||
| 59 | + minSize: 150, | ||
| 40 | accessorFn: (row) => row.started_at, | 60 | accessorFn: (row) => row.started_at, |
| 41 | header: rtx("startedAt"), | 61 | header: rtx("startedAt"), |
| 42 | meta: { align: "center", cellClass: "text-muted-foreground" }, | 62 | meta: { align: "center", cellClass: "text-muted-foreground" }, |
| @@ -44,6 +64,8 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 44 | }, | 64 | }, |
| 45 | { | 65 | { |
| 46 | accessorKey: "status", | 66 | accessorKey: "status", |
| 67 | + size: 120, | ||
| 68 | + minSize: 120, | ||
| 47 | header: tx("insights.result"), | 69 | header: tx("insights.result"), |
| 48 | meta: { align: "center" }, | 70 | meta: { align: "center" }, |
| 49 | cell: (cell) => ( | 71 | cell: (cell) => ( |
| @@ -54,6 +76,8 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 54 | }, | 76 | }, |
| 55 | { | 77 | { |
| 56 | id: "processed", | 78 | id: "processed", |
| 79 | + size: 110, | ||
| 80 | + minSize: 110, | ||
| 57 | header: tx("insights.processed"), | 81 | header: tx("insights.processed"), |
| 58 | accessorFn: (row) => row.students_ok, | 82 | accessorFn: (row) => row.students_ok, |
| 59 | meta: { align: "center", cellClass: "font-medium tabular-nums" }, | 83 | meta: { align: "center", cellClass: "font-medium tabular-nums" }, |
| @@ -61,27 +85,37 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 61 | }, | 85 | }, |
| 62 | { | 86 | { |
| 63 | accessorKey: "students_failed", | 87 | accessorKey: "students_failed", |
| 88 | + size: 96, | ||
| 89 | + minSize: 96, | ||
| 64 | header: rtx("failed"), | 90 | header: rtx("failed"), |
| 65 | meta: { align: "center", cellClass: "tabular-nums" }, | 91 | meta: { align: "center", cellClass: "tabular-nums" }, |
| 66 | }, | 92 | }, |
| 67 | { | 93 | { |
| 68 | accessorKey: "students_skipped", | 94 | accessorKey: "students_skipped", |
| 95 | + size: 104, | ||
| 96 | + minSize: 104, | ||
| 69 | header: rtx("skipped"), | 97 | header: rtx("skipped"), |
| 70 | meta: { align: "center", cellClass: "tabular-nums" }, | 98 | meta: { align: "center", cellClass: "tabular-nums" }, |
| 71 | }, | 99 | }, |
| 72 | { | 100 | { |
| 73 | accessorKey: "rows_written", | 101 | accessorKey: "rows_written", |
| 102 | + size: 134, | ||
| 103 | + minSize: 134, | ||
| 74 | header: tx("insights.written"), | 104 | header: tx("insights.written"), |
| 75 | meta: { align: "center", cellClass: "tabular-nums" }, | 105 | meta: { align: "center", cellClass: "tabular-nums" }, |
| 76 | }, | 106 | }, |
| 77 | { | 107 | { |
| 78 | accessorKey: "duration_ms", | 108 | accessorKey: "duration_ms", |
| 109 | + size: 90, | ||
| 110 | + minSize: 90, | ||
| 79 | header: tx("insights.duration"), | 111 | header: tx("insights.duration"), |
| 80 | meta: { align: "center" }, | 112 | meta: { align: "center" }, |
| 81 | - cell: (cell) => <span class="tabular-nums">{formatDurationMinutes(cell.row.original.duration_ms, prefs.locale())}</span>, | 113 | + cell: (cell) => <span class="tabular-nums">{runDuration(cell.row.original.duration_ms)}</span>, |
| 82 | }, | 114 | }, |
| 83 | { | 115 | { |
| 84 | id: "budget", | 116 | id: "budget", |
| 117 | + size: 132, | ||
| 118 | + minSize: 132, | ||
| 85 | accessorFn: (row) => (row.budget_exceeded ? 1 : 0), | 119 | accessorFn: (row) => (row.budget_exceeded ? 1 : 0), |
| 86 | header: rtx("budget"), | 120 | header: rtx("budget"), |
| 87 | meta: { align: "center" }, | 121 | meta: { align: "center" }, |
| @@ -92,6 +126,8 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 92 | }, | 126 | }, |
| 93 | { | 127 | { |
| 94 | id: "pending", | 128 | id: "pending", |
| 129 | + size: 132, | ||
| 130 | + minSize: 132, | ||
| 95 | accessorFn: (row) => row.pending_students.length, | 131 | accessorFn: (row) => row.pending_students.length, |
| 96 | header: rtx("pendingColumn"), | 132 | header: rtx("pendingColumn"), |
| 97 | meta: { align: "center" }, | 133 | meta: { align: "center" }, |
| @@ -106,6 +142,8 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 106 | }, | 142 | }, |
| 107 | { | 143 | { |
| 108 | id: "failed_modules", | 144 | id: "failed_modules", |
| 145 | + size: 200, | ||
| 146 | + minSize: 200, | ||
| 109 | accessorFn: (row) => row.failed_modules.map((stage) => failedStageText(prefs.locale(), stage)).join(", "), | 147 | accessorFn: (row) => row.failed_modules.map((stage) => failedStageText(prefs.locale(), stage)).join(", "), |
| 110 | header: rtx("failedModulesColumn"), | 148 | header: rtx("failedModulesColumn"), |
| 111 | enableSorting: false, | 149 | enableSorting: false, |
| @@ -142,7 +180,7 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 142 | columns={columns()} | 180 | columns={columns()} |
| 143 | data={props.runs} | 181 | data={props.runs} |
| 144 | empty={tx("insights.emptyRuns")} | 182 | empty={tx("insights.emptyRuns")} |
| 145 | - tableClass="insight-grid-table min-w-[76rem]" | 183 | + tableClass="insight-grid-table" |
| 146 | enablePagination | 184 | enablePagination |
| 147 | pageSize={10} | 185 | pageSize={10} |
| 148 | storageKey="insight-runs" | 186 | storageKey="insight-runs" |
| @@ -151,7 +189,7 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 151 | 189 | ||
| 152 | <Show keyed when={selectedRun()}> | 190 | <Show keyed when={selectedRun()}> |
| 153 | {(run) => ( | 191 | {(run) => ( |
| 154 | - <section class="data-shell mt-5 space-y-4 p-5" aria-label={rtx("panelDescription", { day: run.run_day })}> | 192 | + <section ref={reportSection} class="data-shell mt-5 scroll-mt-16 space-y-4 p-5" aria-label={rtx("panelDescription", { day: run.run_day })}> |
| 155 | <div class="flex flex-wrap items-center justify-between gap-3 border-b border-border-line pb-3"> | 193 | <div class="flex flex-wrap items-center justify-between gap-3 border-b border-border-line pb-3"> |
| 156 | <div> | 194 | <div> |
| 157 | <p class="text-xs font-semibold uppercase tracking-wide text-muted-foreground">{rtx("open")}</p> | 195 | <p class="text-xs font-semibold uppercase tracking-wide text-muted-foreground">{rtx("open")}</p> |
| @@ -159,7 +197,7 @@ export function InsightRunsTable(props: { runs: InsightRun[] }) { | |||
| 159 | </div> | 197 | </div> |
| 160 | <button | 198 | <button |
| 161 | type="button" | 199 | type="button" |
| 162 | - class="inline-flex h-10 items-center rounded-full border border-border/70 px-3.5 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground sm:h-8 touch:h-10" | 200 | + class="inline-flex h-10 items-center rounded-full border border-border/70 px-3.5 text-[13px] font-medium text-muted-foreground outline-hidden transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring sm:h-8 touch:h-10" |
| 163 | onClick={() => setSelectedRun(null)} | 201 | onClick={() => setSelectedRun(null)} |
| 164 | > | 202 | > |
| 165 | {tx("common.close")} | 203 | {tx("common.close")} |
src/components/insights/insight-students-table.tsxmodified+22 -11
| @@ -21,6 +21,8 @@ import { usePreferences } from "@/stores/preferences-context"; | |||
| 21 | 21 | ||
| 22 | type Filter = "all" | "attention" | "none"; | 22 | type Filter = "all" | "attention" | "none"; |
| 23 | 23 | ||
| 24 | +const CONFIDENCE_RANK: Record<string, number> = { none: 1, exploratory: 2, stable: 3 }; | ||
| 25 | + | ||
| 24 | /** | 26 | /** |
| 25 | * Every student's analysis at a glance: status, attention items, cards, the | 27 | * Every student's analysis at a glance: status, attention items, cards, the |
| 26 | * marks, attendance and focus their summary measured, confidence and when it | 28 | * marks, attendance and focus their summary measured, confidence and when it |
| @@ -80,7 +82,7 @@ export function InsightStudentsTable(props: { | |||
| 80 | }, | 82 | }, |
| 81 | { | 83 | { |
| 82 | id: "status", | 84 | id: "status", |
| 83 | - size: 118, | 85 | + size: 112, |
| 84 | accessorFn: (row) => row.state, | 86 | accessorFn: (row) => row.state, |
| 85 | header: rt("status" as never), | 87 | header: rt("status" as never), |
| 86 | meta: { align: "center" }, | 88 | meta: { align: "center" }, |
| @@ -110,7 +112,7 @@ export function InsightStudentsTable(props: { | |||
| 110 | }, | 112 | }, |
| 111 | { | 113 | { |
| 112 | id: "attention", | 114 | id: "attention", |
| 113 | - size: 95, | 115 | + size: 91, |
| 114 | accessorFn: (row) => row.attention, | 116 | accessorFn: (row) => row.attention, |
| 115 | header: rt("attention"), | 117 | header: rt("attention"), |
| 116 | meta: { align: "center" }, | 118 | meta: { align: "center" }, |
| @@ -122,15 +124,19 @@ export function InsightStudentsTable(props: { | |||
| 122 | }, | 124 | }, |
| 123 | { | 125 | { |
| 124 | id: "cards", | 126 | id: "cards", |
| 125 | - size: 95, | 127 | + size: 94, |
| 126 | accessorFn: (row) => row.cards, | 128 | accessorFn: (row) => row.cards, |
| 127 | header: rt("cards"), | 129 | header: rt("cards"), |
| 128 | meta: { align: "center" }, | 130 | meta: { align: "center" }, |
| 129 | - cell: (cell) => <span class="tabular-nums">{cell.row.original.state === "not_loaded" ? "—" : cell.row.original.cards}</span>, | 131 | + cell: (cell) => ( |
| 132 | + <span class={cn("tabular-nums", (cell.row.original.state === "not_loaded" || cell.row.original.cards === 0) && muted)}> | ||
| 133 | + {cell.row.original.state === "not_loaded" ? "—" : cell.row.original.cards} | ||
| 134 | + </span> | ||
| 135 | + ), | ||
| 130 | }, | 136 | }, |
| 131 | { | 137 | { |
| 132 | id: "marks", | 138 | id: "marks", |
| 133 | - size: 148, | 139 | + size: 146, |
| 134 | accessorFn: (row) => row.marks.average ?? -1, | 140 | accessorFn: (row) => row.marks.average ?? -1, |
| 135 | header: rt("marksAverage"), | 141 | header: rt("marksAverage"), |
| 136 | meta: { align: "center" }, | 142 | meta: { align: "center" }, |
| @@ -153,7 +159,7 @@ export function InsightStudentsTable(props: { | |||
| 153 | }, | 159 | }, |
| 154 | { | 160 | { |
| 155 | id: "study", | 161 | id: "study", |
| 156 | - size: 95, | 162 | + size: 97, |
| 157 | accessorFn: (row) => row.study.stints, | 163 | accessorFn: (row) => row.study.stints, |
| 158 | header: t("insights.studyStints"), | 164 | header: t("insights.studyStints"), |
| 159 | meta: { align: "center" }, | 165 | meta: { align: "center" }, |
| @@ -161,19 +167,24 @@ export function InsightStudentsTable(props: { | |||
| 161 | }, | 167 | }, |
| 162 | { | 168 | { |
| 163 | id: "confidence", | 169 | id: "confidence", |
| 164 | - size: 97, | 170 | + // "Güven" truncated to "Güv…" at 97px; the width comes from the two |
| 165 | - accessorFn: (row) => row.confidence ?? "", | 171 | + // count columns, whose short labels had room to spare. |
| 172 | + size: 108, | ||
| 173 | + // A numeric rank: an empty "" key made the table swap the cell for its | ||
| 174 | + // own faint "-" placeholder, unlike the "—" every other column shows. | ||
| 175 | + accessorFn: (row) => CONFIDENCE_RANK[row.confidence ?? ""] ?? 0, | ||
| 166 | header: rt("confidence"), | 176 | header: rt("confidence"), |
| 167 | meta: { align: "center" }, | 177 | meta: { align: "center" }, |
| 168 | cell: (cell) => <span class={muted}>{cell.row.original.confidence ? confidenceText(locale(), cell.row.original.confidence) : "—"}</span>, | 178 | cell: (cell) => <span class={muted}>{cell.row.original.confidence ? confidenceText(locale(), cell.row.original.confidence) : "—"}</span>, |
| 169 | }, | 179 | }, |
| 170 | { | 180 | { |
| 171 | id: "computedAt", | 181 | id: "computedAt", |
| 172 | - size: 100, | 182 | + size: 97, |
| 173 | accessorFn: (row) => row.computed_at ?? 0, | 183 | accessorFn: (row) => row.computed_at ?? 0, |
| 174 | header: t("insights.computedAt"), | 184 | header: t("insights.computedAt"), |
| 175 | - meta: { align: "center", cellClass: "text-xs text-muted-foreground whitespace-nowrap" }, | 185 | + meta: { align: "center", cellClass: "whitespace-nowrap" }, |
| 176 | - cell: (cell) => calculatedDate(cell.row.original.computed_at), | 186 | + // The muted tone rides a span: set on the cell it lost to the row's text colour. |
| 187 | + cell: (cell) => <span class="text-xs tabular-nums text-muted-foreground">{calculatedDate(cell.row.original.computed_at)}</span>, | ||
| 177 | }, | 188 | }, |
| 178 | { | 189 | { |
| 179 | id: "actions", | 190 | id: "actions", |
src/components/instances/exam-weights-editor.tsxmodified+1 -1
| @@ -111,7 +111,7 @@ export function ExamWeightsEditor(props: { | |||
| 111 | return ( | 111 | return ( |
| 112 | <> | 112 | <> |
| 113 | <Show when={removeError()}><Alert variant="destructive">{removeError()}</Alert></Show> | 113 | <Show when={removeError()}><Alert variant="destructive">{removeError()}</Alert></Show> |
| 114 | - <DataTable columns={columns()} data={props.weights} empty={t("common.noMatches")} actions={props.actions} /> | 114 | + <DataTable columns={columns()} data={props.weights} empty={t("instances.noWeights")} actions={props.actions} /> |
| 115 | <SidePanel | 115 | <SidePanel |
| 116 | open={props.editing !== null} | 116 | open={props.editing !== null} |
| 117 | onOpenChange={(open) => !open && props.onEditingChange(null)} | 117 | onOpenChange={(open) => !open && props.onEditingChange(null)} |
src/components/instances/subject-set-editor.tsxmodified+6 -2
| @@ -18,6 +18,8 @@ export function SubjectSetEditor(props: { | |||
| 18 | /** The catalog course's subjects — the only ones a set may hold. */ | 18 | /** The catalog course's subjects — the only ones a set may hold. */ |
| 19 | available: Subject[]; | 19 | available: Subject[]; |
| 20 | canEdit: boolean; | 20 | canEdit: boolean; |
| 21 | + /** Either list is still loading: draw nothing rather than "no topics" / "all taken". */ | ||
| 22 | + loading?: boolean; | ||
| 21 | onAdd: (subjectId: string) => Promise<void>; | 23 | onAdd: (subjectId: string) => Promise<void>; |
| 22 | onRemove: (subject: Subject) => Promise<void>; | 24 | onRemove: (subject: Subject) => Promise<void>; |
| 23 | }) { | 25 | }) { |
| @@ -44,7 +46,8 @@ export function SubjectSetEditor(props: { | |||
| 44 | }; | 46 | }; |
| 45 | 47 | ||
| 46 | return ( | 48 | return ( |
| 47 | - <div class="space-y-3"> | 49 | + <div class="space-y-3" aria-busy={props.loading || undefined}> |
| 50 | + <Show when={!props.loading} fallback={<div class="h-8 w-full max-w-sm animate-pulse rounded-full bg-surface-tint" />}> | ||
| 48 | <Show when={props.selected.length > 0} fallback={<p class="text-sm text-muted-foreground">{t("instances.noSubjects")}</p>}> | 51 | <Show when={props.selected.length > 0} fallback={<p class="text-sm text-muted-foreground">{t("instances.noSubjects")}</p>}> |
| 49 | <ul class="flex flex-wrap gap-1.5"> | 52 | <ul class="flex flex-wrap gap-1.5"> |
| 50 | <For each={props.selected}> | 53 | <For each={props.selected}> |
| @@ -76,7 +79,7 @@ export function SubjectSetEditor(props: { | |||
| 76 | class={cn(TOOLBAR_CONTROL, "min-w-56 flex-1 sm:max-w-sm [&_input]:text-[13px]")} | 79 | class={cn(TOOLBAR_CONTROL, "min-w-56 flex-1 sm:max-w-sm [&_input]:text-[13px]")} |
| 77 | value={pick()} | 80 | value={pick()} |
| 78 | onChange={setPick} | 81 | onChange={setPick} |
| 79 | - placeholder={t("instances.addSubject")} | 82 | + placeholder={t("subjects.select")} |
| 80 | options={addable().map((subject) => ({ value: subject.id, label: subject.name }))} | 83 | options={addable().map((subject) => ({ value: subject.id, label: subject.name }))} |
| 81 | /> | 84 | /> |
| 82 | <Button | 85 | <Button |
| @@ -93,6 +96,7 @@ export function SubjectSetEditor(props: { | |||
| 93 | </div> | 96 | </div> |
| 94 | </Show> | 97 | </Show> |
| 95 | </Show> | 98 | </Show> |
| 99 | + </Show> | ||
| 96 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> | 100 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> |
| 97 | </div> | 101 | </div> |
| 98 | ); | 102 | ); |
src/components/instances/weekly-plan-table.tsxmodified+1 -1
| @@ -28,7 +28,7 @@ export function WeeklyPlanTable(props: { slots: WeeklySlot[]; onRemove?: (slot: | |||
| 28 | id: "time", | 28 | id: "time", |
| 29 | accessorFn: (row) => row.starts_at, | 29 | accessorFn: (row) => row.starts_at, |
| 30 | header: t("weeklyPlan.time"), | 30 | header: t("weeklyPlan.time"), |
| 31 | - meta: { cellClass: "font-mono whitespace-nowrap" }, | 31 | + meta: { cellClass: "tabular-nums whitespace-nowrap" }, |
| 32 | cell: (cell) => `${minutesToHHmm(cell.row.original.starts_at)}–${minutesToHHmm(cell.row.original.ends_at)}`, | 32 | cell: (cell) => `${minutesToHHmm(cell.row.original.starts_at)}–${minutesToHHmm(cell.row.original.ends_at)}`, |
| 33 | }, | 33 | }, |
| 34 | { | 34 | { |
src/components/layout/app-shell.tsxmodified+7 -3
| @@ -53,7 +53,7 @@ export function AppShell(props: ParentProps) { | |||
| 53 | // mounted, and their dismissed state never has two in-memory copies. | 53 | // mounted, and their dismissed state never has two in-memory copies. |
| 54 | const phone = createMediaQuery("(max-width: 63.98rem)"); | 54 | const phone = createMediaQuery("(max-width: 63.98rem)"); |
| 55 | const routeLabel = createMemo(() => { | 55 | const routeLabel = createMemo(() => { |
| 56 | - const key = routeLabelKey(location().pathname, auth.user()?.role); | 56 | + const key = routeLabelKey(location().pathname, auth.user()?.role, location().search as Record<string, unknown>); |
| 57 | return key ? t(key) : ""; | 57 | return key ? t(key) : ""; |
| 58 | }); | 58 | }); |
| 59 | // The page's own h1, when it renders one (detail pages, the 404). Watched | 59 | // The page's own h1, when it renders one (detail pages, the 404). Watched |
| @@ -83,7 +83,11 @@ export function AppShell(props: ParentProps) { | |||
| 83 | const shellChrome = () => Boolean(auth.user()) && !fullScreen(); | 83 | const shellChrome = () => Boolean(auth.user()) && !fullScreen(); |
| 84 | // Room below the last row for the quick-action button resting over the tab | 84 | // Room below the last row for the quick-action button resting over the tab |
| 85 | // bar, so a pager or a last card's actions can scroll clear of it. | 85 | // bar, so a pager or a last card's actions can scroll clear of it. |
| 86 | - const fabClearance = () => shellChrome() && phone() && !quickActionsSuppressed(); | 86 | + // A board fills the content column edge to edge; the floating button sat |
| 87 | + // on its bottom-right corner, over the canvas's own controls. | ||
| 88 | + const boardPage = () => /^\/whiteboards\/[^/]+/.test(location().pathname); | ||
| 89 | + const fabHidden = () => quickActionsSuppressed() || boardPage(); | ||
| 90 | + const fabClearance = () => shellChrome() && phone() && !fabHidden(); | ||
| 87 | const logout = async () => { | 91 | const logout = async () => { |
| 88 | await auth.logout(); | 92 | await auth.logout(); |
| 89 | void navigate({ to: "/login" }); | 93 | void navigate({ to: "/login" }); |
| @@ -251,7 +255,7 @@ export function AppShell(props: ParentProps) { | |||
| 251 | </Show> | 255 | </Show> |
| 252 | <Show when={auth.user() && !fullScreen() && phone()}> | 256 | <Show when={auth.user() && !fullScreen() && phone()}> |
| 253 | <MobileQuickActions | 257 | <MobileQuickActions |
| 254 | - hidden={mobileOpen() || celebiPanelOpen() || commandPaletteOpen() || profileOpen() || quickActionsSuppressed()} | 258 | + hidden={mobileOpen() || celebiPanelOpen() || commandPaletteOpen() || profileOpen() || fabHidden()} |
| 255 | /> | 259 | /> |
| 256 | </Show> | 260 | </Show> |
| 257 | </ShellFeedProvider> | 261 | </ShellFeedProvider> |
src/components/layout/celebi-composer.tsxmodified+2 -2
| @@ -75,14 +75,14 @@ export function CelebiComposer(props: { | |||
| 75 | size="sm" | 75 | size="sm" |
| 76 | aria-label={t("ai.send")} | 76 | aria-label={t("ai.send")} |
| 77 | title={t("ai.send")} | 77 | title={t("ai.send")} |
| 78 | - class="h-8 w-8 shrink-0 rounded-full p-0" | 78 | + class="h-8 w-8 shrink-0 rounded-full p-0 touch:h-10 touch:w-10" |
| 79 | disabled={props.disabled} | 79 | disabled={props.disabled} |
| 80 | > | 80 | > |
| 81 | <IconSend class="h-4 w-4" /> | 81 | <IconSend class="h-4 w-4" /> |
| 82 | </Button> | 82 | </Button> |
| 83 | </div> | 83 | </div> |
| 84 | {/* Enter / Shift+Enter means nothing on a touch keyboard. */} | 84 | {/* Enter / Shift+Enter means nothing on a touch keyboard. */} |
| 85 | - <p class="mt-1.5 px-1 text-[11px] leading-4 text-muted-foreground [@media(pointer:coarse)]:hidden">{t("ai.hint")}</p> | 85 | + <p class="mt-1.5 px-1 text-[11px] leading-4 text-muted-foreground touch:hidden">{t("ai.hint")}</p> |
| 86 | </form> | 86 | </form> |
| 87 | ); | 87 | ); |
| 88 | } | 88 | } |
src/components/layout/celebi-panel.tsxmodified+7 -7
| @@ -357,12 +357,12 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean | |||
| 357 | when={view() === "chat"} | 357 | when={view() === "chat"} |
| 358 | fallback={ | 358 | fallback={ |
| 359 | <div class="flex min-w-0 items-center gap-2"> | 359 | <div class="flex min-w-0 items-center gap-2"> |
| 360 | - <button type="button" class="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-xs font-medium text-foreground transition-colors hover:bg-accent" onClick={() => setView("chat")}> | 360 | + <button type="button" class="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring touch:h-10" onClick={() => setView("chat")}> |
| 361 | <IconChevronLeft class="h-3.5 w-3.5" /> | 361 | <IconChevronLeft class="h-3.5 w-3.5" /> |
| 362 | {t("common.back")} | 362 | {t("common.back")} |
| 363 | </button> | 363 | </button> |
| 364 | <span class="min-w-0 flex-1 truncate text-sm font-medium text-foreground">{t("ai.chats")}</span> | 364 | <span class="min-w-0 flex-1 truncate text-sm font-medium text-foreground">{t("ai.chats")}</span> |
| 365 | - <button type="button" class="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-xs font-medium text-foreground transition-colors hover:bg-accent" onClick={(event) => { event.preventDefault(); startNewChat(); }}> | 365 | + <button type="button" class="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring touch:h-10" onClick={(event) => { event.preventDefault(); startNewChat(); }}> |
| 366 | <IconPlus class="h-3.5 w-3.5" /> | 366 | <IconPlus class="h-3.5 w-3.5" /> |
| 367 | {t("ai.newChat")} | 367 | {t("ai.newChat")} |
| 368 | </button> | 368 | </button> |
| @@ -371,11 +371,11 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean | |||
| 371 | > | 371 | > |
| 372 | <div class="flex min-w-0 items-center justify-between gap-3"> | 372 | <div class="flex min-w-0 items-center justify-between gap-3"> |
| 373 | <div class="flex shrink-0 items-center gap-1.5"> | 373 | <div class="flex shrink-0 items-center gap-1.5"> |
| 374 | - <button type="button" class="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-xs font-medium text-foreground transition-colors hover:bg-accent" onClick={(event) => { event.preventDefault(); startNewChat(); }}> | 374 | + <button type="button" class="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring touch:h-10" onClick={(event) => { event.preventDefault(); startNewChat(); }}> |
| 375 | <IconPlus class="h-3.5 w-3.5" /> | 375 | <IconPlus class="h-3.5 w-3.5" /> |
| 376 | {t("ai.newChat")} | 376 | {t("ai.newChat")} |
| 377 | </button> | 377 | </button> |
| 378 | - <button type="button" class="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-xs font-medium text-foreground transition-colors hover:bg-accent" onClick={(event) => { event.preventDefault(); openThreads(); }}> | 378 | + <button type="button" class="flex h-8 shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring touch:h-10" onClick={(event) => { event.preventDefault(); openThreads(); }}> |
| 379 | <IconMessage class="h-3.5 w-3.5" /> | 379 | <IconMessage class="h-3.5 w-3.5" /> |
| 380 | {t("ai.chats")} | 380 | {t("ai.chats")} |
| 381 | </button> | 381 | </button> |
| @@ -384,7 +384,7 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean | |||
| 384 | <span class="min-w-0 flex-1 truncate text-sm font-medium text-foreground">{threadTitle() || t("ai.untitledChat")}</span> | 384 | <span class="min-w-0 flex-1 truncate text-sm font-medium text-foreground">{threadTitle() || t("ai.untitledChat")}</span> |
| 385 | <button | 385 | <button |
| 386 | type="button" | 386 | type="button" |
| 387 | - class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-border bg-card text-muted-foreground transition-colors hover:bg-accent hover:text-foreground" | 387 | + class="flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border border-border bg-card text-muted-foreground outline-hidden transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring touch:h-10 touch:w-10" |
| 388 | aria-label={t("ai.renameChat")} | 388 | aria-label={t("ai.renameChat")} |
| 389 | title={t("ai.renameChat")} | 389 | title={t("ai.renameChat")} |
| 390 | onClick={(event) => { event.preventDefault(); renameActiveThread(); }} | 390 | onClick={(event) => { event.preventDefault(); renameActiveThread(); }} |
| @@ -396,12 +396,12 @@ export function CelebiPanel(props: { open: boolean; onOpenChange: (open: boolean | |||
| 396 | <Show | 396 | <Show |
| 397 | when={!searchOpen()} | 397 | when={!searchOpen()} |
| 398 | fallback={ | 398 | fallback={ |
| 399 | - <button type="button" class="flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-card text-xs font-medium text-foreground transition-colors hover:bg-accent" aria-label={t("common.close")} title={t("common.close")} onClick={() => { setSearchOpen(false); updateSearchQuery(""); }}> | 399 | + <button type="button" class="flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-card text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring touch:h-10 touch:w-10" aria-label={t("common.close")} title={t("common.close")} onClick={() => { setSearchOpen(false); updateSearchQuery(""); }}> |
| 400 | <IconX class="h-3.5 w-3.5" /> | 400 | <IconX class="h-3.5 w-3.5" /> |
| 401 | </button> | 401 | </button> |
| 402 | } | 402 | } |
| 403 | > | 403 | > |
| 404 | - <button type="button" class="flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-card text-xs font-medium text-foreground transition-colors hover:bg-accent" aria-label={t("common.search")} title={t("common.search")} aria-expanded={searchOpen()} onClick={(event) => { event.preventDefault(); setSearchOpen(true); }}> | 404 | + <button type="button" class="flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-card text-xs font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring touch:h-10 touch:w-10" aria-label={t("common.search")} title={t("common.search")} aria-expanded={searchOpen()} onClick={(event) => { event.preventDefault(); setSearchOpen(true); }}> |
| 405 | <IconSearch class="h-3.5 w-3.5" /> | 405 | <IconSearch class="h-3.5 w-3.5" /> |
| 406 | </button> | 406 | </button> |
| 407 | </Show> | 407 | </Show> |
src/components/layout/command-palette.tsxmodified+6 -5
| @@ -473,7 +473,8 @@ export function CommandPalette(props: CommandPaletteProps) { | |||
| 473 | return ( | 473 | return ( |
| 474 | <Dialog open={props.open} onOpenChange={props.onOpenChange}> | 474 | <Dialog open={props.open} onOpenChange={props.onOpenChange}> |
| 475 | <DialogContent | 475 | <DialogContent |
| 476 | - class="max-h-[min(85vh,38rem)] max-w-2xl overflow-hidden rounded-lg p-0 shadow-2xl border border-black/8 dark:border-white/12 bg-popover" | 476 | + position="top" |
| 477 | + class="max-h-[min(85vh,38rem)] max-w-2xl overflow-hidden rounded-xl p-0 shadow-2xl border border-black/8 dark:border-white/12 bg-popover" | ||
| 477 | // The palette draws its own labelled close control: the dialog's | 478 | // The palette draws its own labelled close control: the dialog's |
| 478 | // icon-only × sat beside the clear-search × and read as the same button. | 479 | // icon-only × sat beside the clear-search × and read as the same button. |
| 479 | closeButton={false} | 480 | closeButton={false} |
| @@ -512,7 +513,7 @@ export function CommandPalette(props: CommandPaletteProps) { | |||
| 512 | <Show when={query()}> | 513 | <Show when={query()}> |
| 513 | <button | 514 | <button |
| 514 | type="button" | 515 | type="button" |
| 515 | - class="flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground transition-colors" | 516 | + class="flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted sm:h-6 sm:w-6 hover:text-foreground transition-colors" |
| 516 | onClick={() => { | 517 | onClick={() => { |
| 517 | setQuery(""); | 518 | setQuery(""); |
| 518 | inputRef?.focus(); | 519 | inputRef?.focus(); |
| @@ -528,7 +529,7 @@ export function CommandPalette(props: CommandPaletteProps) { | |||
| 528 | </Show> | 529 | </Show> |
| 529 | <button | 530 | <button |
| 530 | type="button" | 531 | type="button" |
| 531 | - class="ml-1 inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md border border-border/80 bg-background px-2 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground" | 532 | + class="ml-1 inline-flex h-10 shrink-0 items-center gap-1.5 rounded-md sm:h-7 border border-border/80 bg-background px-2 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground" |
| 532 | onClick={() => props.onOpenChange(false)} | 533 | onClick={() => props.onOpenChange(false)} |
| 533 | aria-label={t("common.close")} | 534 | aria-label={t("common.close")} |
| 534 | title={t("common.close")} | 535 | title={t("common.close")} |
| @@ -614,7 +615,7 @@ export function CommandPalette(props: CommandPaletteProps) { | |||
| 614 | <div class="flex items-center gap-2"> | 615 | <div class="flex items-center gap-2"> |
| 615 | <span class="truncate text-sm font-medium">{item.title}</span> | 616 | <span class="truncate text-sm font-medium">{item.title}</span> |
| 616 | <Show when={item.roleBadge}> | 617 | <Show when={item.roleBadge}> |
| 617 | - <span class="rounded-full bg-secondary border border-border px-2 py-0.2 text-[11px] font-semibold text-muted-foreground"> | 618 | + <span class="rounded-full bg-secondary border border-border px-2 py-px text-[11px] font-semibold text-muted-foreground"> |
| 618 | {item.roleBadge} | 619 | {item.roleBadge} |
| 619 | </span> | 620 | </span> |
| 620 | </Show> | 621 | </Show> |
| @@ -643,7 +644,7 @@ export function CommandPalette(props: CommandPaletteProps) { | |||
| 643 | phones where there are no arrow, enter or escape keys to press. */} | 644 | phones where there are no arrow, enter or escape keys to press. */} |
| 644 | <div class="hidden items-center justify-between border-t border-border/60 bg-muted/30 px-4 py-2 text-xs text-muted-foreground sm:flex"> | 645 | <div class="hidden items-center justify-between border-t border-border/60 bg-muted/30 px-4 py-2 text-xs text-muted-foreground sm:flex"> |
| 645 | <span class="truncate">{t("command.shortcutHint")}</span> | 646 | <span class="truncate">{t("command.shortcutHint")}</span> |
| 646 | - <div class="flex items-center gap-2 font-mono shrink-0"> | 647 | + <div class="flex shrink-0 items-center gap-2 [&_kbd]:font-mono"> |
| 647 | <kbd class="rounded border border-border bg-background px-1.5 py-0.5 text-[11px] font-semibold">↑↓</kbd> | 648 | <kbd class="rounded border border-border bg-background px-1.5 py-0.5 text-[11px] font-semibold">↑↓</kbd> |
| 648 | <span>{t("command.key.navigate")}</span> | 649 | <span>{t("command.key.navigate")}</span> |
| 649 | <kbd class="rounded border border-border bg-background px-1.5 py-0.5 text-[11px] font-semibold">↵</kbd> | 650 | <kbd class="rounded border border-border bg-background px-1.5 py-0.5 text-[11px] font-semibold">↵</kbd> |
src/components/layout/mobile-quick-actions.tsxmodified+4 -1
| @@ -25,7 +25,10 @@ export function MobileQuickActions(props: { hidden: boolean }) { | |||
| 25 | const [notificationsOpen, setNotificationsOpen] = createSignal(false); | 25 | const [notificationsOpen, setNotificationsOpen] = createSignal(false); |
| 26 | 26 | ||
| 27 | createEffect(() => { | 27 | createEffect(() => { |
| 28 | - if (notificationsOpen()) notifications.refreshAll(); | 28 | + if (notificationsOpen()) { |
| 29 | + notifications.opened(); | ||
| 30 | + notifications.refreshAll(); | ||
| 31 | + } | ||
| 29 | }); | 32 | }); |
| 30 | 33 | ||
| 31 | const actions = createMemo(() => { | 34 | const actions = createMemo(() => { |
src/components/layout/nav-items.tsmodified+24 -3
| @@ -430,9 +430,19 @@ function searchMatches(item: NavItem, search: Record<string, unknown> | undefine | |||
| 430 | return Object.entries(item.search).every(([key, value]) => search?.[key] === value); | 430 | return Object.entries(item.search).every(([key, value]) => search?.[key] === value); |
| 431 | } | 431 | } |
| 432 | 432 | ||
| 433 | +// Pages with no nav entry of their own that live under one: a şube×ders | ||
| 434 | +// instance is reached from Dersler, so the sidebar keeps Dersler lit there. | ||
| 435 | +const NAV_PARENT_PREFIXES: { prefix: string; parent: string }[] = [{ prefix: "/instances", parent: "/courses" }]; | ||
| 436 | + | ||
| 437 | +function navPath(pathname: string) { | ||
| 438 | + const alias = NAV_PARENT_PREFIXES.find((entry) => pathname === entry.prefix || pathname.startsWith(`${entry.prefix}/`)); | ||
| 439 | + return alias ? alias.parent : pathname; | ||
| 440 | +} | ||
| 441 | + | ||
| 433 | export function routeNavItem(pathname: string, role: Role | undefined, search?: Record<string, unknown>): NavItem | undefined { | 442 | export function routeNavItem(pathname: string, role: Role | undefined, search?: Record<string, unknown>): NavItem | undefined { |
| 443 | + const path = navPath(pathname); | ||
| 434 | return [...primaryNavItems(role), ...visibleNavItems(role)] | 444 | return [...primaryNavItems(role), ...visibleNavItems(role)] |
| 435 | - .filter((item) => pathActive(pathname, item.to, item.exact) && searchMatches(item, search)) | 445 | + .filter((item) => pathActive(path, item.to, item.exact) && searchMatches(item, search)) |
| 436 | .sort((a, b) => b.to.length - a.to.length || Number(!!b.search) - Number(!!a.search))[0]; | 446 | .sort((a, b) => b.to.length - a.to.length || Number(!!b.search) - Number(!!a.search))[0]; |
| 437 | } | 447 | } |
| 438 | 448 | ||
| @@ -460,8 +470,19 @@ const UNLISTED_ROUTE_LABELS: { prefix: string; labelKey: MessageKey }[] = [ | |||
| 460 | * otherwise an explicit fallback. Returns undefined only for routes rendered | 470 | * otherwise an explicit fallback. Returns undefined only for routes rendered |
| 461 | * without the shell (login, register, the exam room). | 471 | * without the shell (login, register, the exam room). |
| 462 | */ | 472 | */ |
| 463 | -export function routeLabelKey(pathname: string, role: Role | undefined): MessageKey | undefined { | 473 | +export function routeLabelKey( |
| 464 | - const item = routeNavItem(pathname, role); | 474 | + pathname: string, |
| 475 | + role: Role | undefined, | ||
| 476 | + search?: Record<string, unknown>, | ||
| 477 | +): MessageKey | undefined { | ||
| 478 | + // The catalog filtered to one course kind is that kind's page. | ||
| 479 | + if (pathname === "/courses" && (search?.kind === "club" || search?.kind === "study")) { | ||
| 480 | + return search.kind === "club" ? "courses.kind.club" : "courses.kind.study"; | ||
| 481 | + } | ||
| 482 | + // An aliased page (an instance) is named by its own heading, not the | ||
| 483 | + // parent entry it keeps lit in the sidebar. | ||
| 484 | + if (navPath(pathname) !== pathname) return undefined; | ||
| 485 | + const item = routeNavItem(pathname, role, search); | ||
| 465 | if (item) return item.labelKey; | 486 | if (item) return item.labelKey; |
| 466 | 487 | ||
| 467 | const unlisted = UNLISTED_ROUTE_LABELS.find( | 488 | const unlisted = UNLISTED_ROUTE_LABELS.find( |
src/components/layout/notification-center.tsxmodified+4 -1
| @@ -16,7 +16,10 @@ export function NotificationCenter() { | |||
| 16 | const [open, setOpen] = createSignal(false); | 16 | const [open, setOpen] = createSignal(false); |
| 17 | 17 | ||
| 18 | createEffect(() => { | 18 | createEffect(() => { |
| 19 | - if (open()) feed.refreshAll(); | 19 | + if (open()) { |
| 20 | + feed.opened(); | ||
| 21 | + feed.refreshAll(); | ||
| 22 | + } | ||
| 20 | }); | 23 | }); |
| 21 | 24 | ||
| 22 | const unreadCount = feed.unreadCount; | 25 | const unreadCount = feed.unreadCount; |
src/components/layout/notification-feed.tsmodified+6 -1
| @@ -41,9 +41,12 @@ export function createNotificationFeed() { | |||
| 41 | 41 | ||
| 42 | // Exams and homework of one ders taught in two şubeler share titles; the | 42 | // Exams and homework of one ders taught in two şubeler share titles; the |
| 43 | // row's description names "<ders> — <şube>" so they can be told apart. | 43 | // row's description names "<ders> — <şube>" so they can be told apart. |
| 44 | + // Only the open list shows these labels, and resolving them costs a read | ||
| 45 | + // per section; the unread badge needs none. So they wait for the first open. | ||
| 44 | const auth = useAuth(); | 46 | const auth = useAuth(); |
| 47 | + const [labelsWanted, setLabelsWanted] = createSignal(false); | ||
| 45 | const sectionLabels = createInstanceLabels( | 48 | const sectionLabels = createInstanceLabels( |
| 46 | - () => [ | 49 | + () => !labelsWanted() ? [] : [ |
| 47 | ...feed.exams().items.filter((ex) => ex.starts_at && !ex.draft && notEnded(ex.starts_at, ex.ends_at)).map((ex) => ex.class_course), | 50 | ...feed.exams().items.filter((ex) => ex.starts_at && !ex.draft && notEnded(ex.starts_at, ex.ends_at)).map((ex) => ex.class_course), |
| 48 | ...feed.homework().items.filter((hw) => hw.due_at >= nowMs()).map((hw) => hw.class_course), | 51 | ...feed.homework().items.filter((hw) => hw.due_at >= nowMs()).map((hw) => hw.class_course), |
| 49 | ], | 52 | ], |
| @@ -224,6 +227,8 @@ export function createNotificationFeed() { | |||
| 224 | dismissAll, | 227 | dismissAll, |
| 225 | markRead, | 228 | markRead, |
| 226 | refreshAll: feed.refreshAll, | 229 | refreshAll: feed.refreshAll, |
| 230 | + /** Call when the list opens: resolves the section labels its rows show. */ | ||
| 231 | + opened: () => setLabelsWanted(true), | ||
| 227 | }; | 232 | }; |
| 228 | } | 233 | } |
| 229 | 234 | ||
src/components/layout/notification-list.tsxmodified+3 -3
| @@ -108,7 +108,7 @@ export function NotificationList(props: { | |||
| 108 | when={previewNotification()} | 108 | when={previewNotification()} |
| 109 | fallback={ | 109 | fallback={ |
| 110 | <div class="p-2"> | 110 | <div class="p-2"> |
| 111 | - <div class={cn("mt-0 space-y-1 overflow-y-auto", props.scrollClass ?? "max-h-80")}> | 111 | + <div class={cn("mt-0 space-y-1 overflow-y-auto", props.scrollClass ?? "max-h-[min(30rem,calc(100dvh-9rem))]")}> |
| 112 | <Suspense | 112 | <Suspense |
| 113 | fallback={ | 113 | fallback={ |
| 114 | <div class="p-8 text-center text-xs text-text-subtle"> | 114 | <div class="p-8 text-center text-xs text-text-subtle"> |
| @@ -172,7 +172,7 @@ export function NotificationList(props: { | |||
| 172 | select(item); | 172 | select(item); |
| 173 | } | 173 | } |
| 174 | }} | 174 | }} |
| 175 | - class="group relative flex cursor-pointer select-none items-start gap-3 rounded-lg p-2 text-xs transition-colors hover:bg-background/70" | 175 | + class="group relative flex cursor-pointer select-none items-start gap-3 rounded-lg p-2 text-xs outline-hidden transition-colors hover:bg-background/70 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring" |
| 176 | > | 176 | > |
| 177 | <div class="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-background/75 text-text-subtle transition-colors group-hover:bg-primary group-hover:text-primary-foreground"> | 177 | <div class="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-background/75 text-text-subtle transition-colors group-hover:bg-primary group-hover:text-primary-foreground"> |
| 178 | <Show when={item.type === "message"}> | 178 | <Show when={item.type === "message"}> |
| @@ -202,7 +202,7 @@ export function NotificationList(props: { | |||
| 202 | type="button" | 202 | type="button" |
| 203 | // A thumb-sized target on touch screens, where | 203 | // A thumb-sized target on touch screens, where |
| 204 | // there is no hover to reveal it either. | 204 | // there is no hover to reveal it either. |
| 205 | - class="absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-md text-text-subtle/70 opacity-80 transition-all hover:bg-destructive/10 hover:text-destructive-text sm:opacity-0 sm:group-hover:opacity-100 touch:right-0 touch:top-0 touch:h-11 touch:w-11 touch:opacity-80" | 205 | + class="absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-md text-text-subtle/70 opacity-80 transition-all hover:bg-destructive/10 hover:text-destructive-text outline-hidden focus-visible:ring-2 focus-visible:ring-ring sm:opacity-0 sm:group-hover:opacity-100 sm:group-focus-within:opacity-100 sm:focus-visible:opacity-100 touch:right-0 touch:top-0 touch:h-11 touch:w-11 touch:opacity-80" |
| 206 | title={t("notifications.dismiss")} | 206 | title={t("notifications.dismiss")} |
| 207 | aria-label={t("notifications.dismiss")} | 207 | aria-label={t("notifications.dismiss")} |
| 208 | onClick={(e) => dismissOne(e, item.id)} | 208 | onClick={(e) => dismissOne(e, item.id)} |
src/components/layout/page-center.tsxmodified+18 -3
| @@ -1,6 +1,6 @@ | |||
| 1 | -import type { JSX } from "solid-js"; | 1 | +import { createSignal, type JSX } from "solid-js"; |
| 2 | import { currentLocale } from "@/api/client"; | 2 | import { currentLocale } from "@/api/client"; |
| 3 | -import { formatMessage, messageFor, type MessageKey } from "@/i18n/messages"; | 3 | +import { formatMessage, loadLocale, messageFor, type MessageKey } from "@/i18n/messages"; |
| 4 | import { cn } from "@/lib/cn"; | 4 | import { cn } from "@/lib/cn"; |
| 5 | 5 | ||
| 6 | /** Card sizing shared by the full-page states (load failure, record not found). */ | 6 | /** Card sizing shared by the full-page states (load failure, record not found). */ |
| @@ -11,8 +11,23 @@ export const PAGE_STATE_CARD = "min-h-[420px] gap-6 px-6 py-10 sm:px-10 sm:py-12 | |||
| 11 | * component, above the i18n provider, so they read the loaded dictionary | 11 | * component, above the i18n provider, so they read the loaded dictionary |
| 12 | * directly instead of `useT()` (the boot awaits the stored locale first). | 12 | * directly instead of `useT()` (the boot awaits the stored locale first). |
| 13 | */ | 13 | */ |
| 14 | +// Bumped when a dictionary that was missing has loaded, so text read through | ||
| 15 | +// pageStateText redraws in place. | ||
| 16 | +const [dictionaryVersion, setDictionaryVersion] = createSignal(0); | ||
| 17 | + | ||
| 14 | export function pageStateText(key: MessageKey, vars?: Record<string, string | number>): string { | 18 | export function pageStateText(key: MessageKey, vars?: Record<string, string | number>): string { |
| 15 | - return formatMessage(messageFor(currentLocale(), key) ?? key, vars); | 19 | + dictionaryVersion(); |
| 20 | + const locale = currentLocale(); | ||
| 21 | + const message = messageFor(locale, key); | ||
| 22 | + if (message == null) { | ||
| 23 | + // The dictionary can be gone when this screen shows: a hot reload that | ||
| 24 | + // dropped the i18n module, or a crash before the boot finished. Fetch it | ||
| 25 | + // and redraw instead of leaving raw keys on screen; until it lands the | ||
| 26 | + // screen shows nothing rather than "errors.pageLoad.title". | ||
| 27 | + void loadLocale(locale).then(() => setDictionaryVersion((n) => n + 1), () => undefined); | ||
| 28 | + return ""; | ||
| 29 | + } | ||
| 30 | + return formatMessage(message, vars); | ||
| 16 | } | 31 | } |
| 17 | 32 | ||
| 18 | /** | 33 | /** |
src/components/layout/page-header.tsxmodified+4 -1
| @@ -1,3 +1,4 @@ | |||
| 1 | +import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | ||
| 1 | import type { JSX, ParentProps } from "solid-js"; | 2 | import type { JSX, ParentProps } from "solid-js"; |
| 2 | import { Show } from "solid-js"; | 3 | import { Show } from "solid-js"; |
| 3 | import { cn } from "@/lib/cn"; | 4 | import { cn } from "@/lib/cn"; |
| @@ -55,7 +56,9 @@ export function PageHeader( | |||
| 55 | {props.children} | 56 | {props.children} |
| 56 | </div> | 57 | </div> |
| 57 | <Show when={props.actions}> | 58 | <Show when={props.actions}> |
| 58 | - <div class="flex min-w-0 flex-wrap items-center gap-2">{props.actions}</div> | 59 | + {/* Header actions follow the toolbar pill standard, so a page's |
| 60 | + plain size="sm" buttons sit at the same height as its lists. */} | ||
| 61 | + <div class={cn("flex min-w-0 flex-wrap items-center gap-2", TOOLBAR_SLOT)}>{props.actions}</div> | ||
| 59 | </Show> | 62 | </Show> |
| 60 | </div> | 63 | </div> |
| 61 | </div> | 64 | </div> |
src/components/layout/page-load-error.tsxmodified+1 -1
| @@ -81,7 +81,7 @@ export function PageLoadError(props: { error: unknown; reset: () => void }) { | |||
| 81 | description={formatApiError(props.error)} | 81 | description={formatApiError(props.error)} |
| 82 | action={ | 82 | action={ |
| 83 | <div class="flex w-full flex-col items-center gap-5"> | 83 | <div class="flex w-full flex-col items-center gap-5"> |
| 84 | - <Button type="button" size="sm" class="h-9 rounded-lg px-4" disabled={wait() > 0} onClick={() => props.reset()}> | 84 | + <Button type="button" size="sm" class="h-9 rounded-lg px-4 text-sm" disabled={wait() > 0} onClick={() => props.reset()}> |
| 85 | {wait() > 0 ? tt("errors.pageLoad.retryIn", { seconds: wait() }) : tt("errors.pageLoad.retry")} | 85 | {wait() > 0 ? tt("errors.pageLoad.retryIn", { seconds: wait() }) : tt("errors.pageLoad.retry")} |
| 86 | </Button> | 86 | </Button> |
| 87 | <details class="group w-full rounded-lg border border-border-hairline bg-surface-tint/60 text-left"> | 87 | <details class="group w-full rounded-lg border border-border-hairline bg-surface-tint/60 text-left"> |
src/components/layout/record-not-found.tsxmodified+1 -1
| @@ -25,7 +25,7 @@ export function RecordNotFound(props: { backTo?: string }) { | |||
| 25 | title={tt("errors.recordNotFound.title")} | 25 | title={tt("errors.recordNotFound.title")} |
| 26 | description={tt("errors.recordNotFound.description")} | 26 | description={tt("errors.recordNotFound.description")} |
| 27 | action={ | 27 | action={ |
| 28 | - <Link to={backTo()} class={cn(buttonVariants({ variant: "outline", size: "sm" }), "h-9 rounded-lg px-4")}> | 28 | + <Link to={backTo()} class={cn(buttonVariants({ variant: "outline", size: "sm" }), "h-9 rounded-lg px-4 text-sm")}> |
| 29 | {backTo() === "/" ? tt("errors.recordNotFound.backHome") : tt("errors.recordNotFound.backToList")} | 29 | {backTo() === "/" ? tt("errors.recordNotFound.backHome") : tt("errors.recordNotFound.backToList")} |
| 30 | </Link> | 30 | </Link> |
| 31 | } | 31 | } |
src/components/layout/theme-mode-control.tsxmodified+5 -5
| @@ -18,7 +18,7 @@ export function ThemeModeControl(props: ThemeModeControlProps) { | |||
| 18 | return ( | 18 | return ( |
| 19 | <button | 19 | <button |
| 20 | type="button" | 20 | type="button" |
| 21 | - class="flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground" | 21 | + class="flex h-10 w-10 items-center justify-center rounded-md text-muted-foreground outline-hidden transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring sm:h-8 sm:w-8 touch:h-10 touch:w-10" |
| 22 | aria-label={prefs.t("theme.toggle")} | 22 | aria-label={prefs.t("theme.toggle")} |
| 23 | title={isDark() ? lightLabel() : darkLabel()} | 23 | title={isDark() ? lightLabel() : darkLabel()} |
| 24 | onClick={() => selectTheme(isDark() ? "light" : "dark")} | 24 | onClick={() => selectTheme(isDark() ? "light" : "dark")} |
| @@ -33,10 +33,10 @@ export function ThemeModeControl(props: ThemeModeControlProps) { | |||
| 33 | // touch screens. | 33 | // touch screens. |
| 34 | return ( | 34 | return ( |
| 35 | <div class="flex rounded-lg bg-muted p-0.5 dark:bg-white/8" role="group" aria-label={prefs.t("theme.toggle")}> | 35 | <div class="flex rounded-lg bg-muted p-0.5 dark:bg-white/8" role="group" aria-label={prefs.t("theme.toggle")}> |
| 36 | - <button type="button" class={cn("rounded-md p-1.5 text-muted-foreground transition-colors hover:text-foreground touch:p-3.5 dark:text-white/60 dark:hover:text-white", !isDark() && "bg-background text-foreground shadow-xs dark:bg-white/12 dark:text-white")} onClick={() => selectTheme("light")} aria-pressed={!isDark()} aria-label={lightLabel()} title={lightLabel()}> | 36 | + <button type="button" class={cn("rounded-md p-3 text-muted-foreground outline-hidden transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring sm:p-1.5 touch:p-3.5 dark:text-white/60 dark:hover:text-white", !isDark() && "bg-background text-foreground shadow-xs dark:bg-white/12 dark:text-white")} onClick={() => selectTheme("light")} aria-pressed={!isDark()} aria-label={lightLabel()} title={lightLabel()}> |
| 37 | <IconSun class="h-4 w-4" /> | 37 | <IconSun class="h-4 w-4" /> |
| 38 | </button> | 38 | </button> |
| 39 | - <button type="button" class={cn("rounded-md p-1.5 text-muted-foreground transition-colors hover:text-foreground touch:p-3.5 dark:text-white/60 dark:hover:text-white", isDark() && "bg-background text-foreground shadow-xs dark:bg-white/12 dark:text-white")} onClick={() => selectTheme("dark")} aria-pressed={isDark()} aria-label={darkLabel()} title={darkLabel()}> | 39 | + <button type="button" class={cn("rounded-md p-3 text-muted-foreground outline-hidden transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring sm:p-1.5 touch:p-3.5 dark:text-white/60 dark:hover:text-white", isDark() && "bg-background text-foreground shadow-xs dark:bg-white/12 dark:text-white")} onClick={() => selectTheme("dark")} aria-pressed={isDark()} aria-label={darkLabel()} title={darkLabel()}> |
| 40 | <IconMoon class="h-4 w-4" /> | 40 | <IconMoon class="h-4 w-4" /> |
| 41 | </button> | 41 | </button> |
| 42 | </div> | 42 | </div> |
| @@ -46,8 +46,8 @@ export function ThemeModeControl(props: ThemeModeControlProps) { | |||
| 46 | if (props.variant === "segmented") { | 46 | if (props.variant === "segmented") { |
| 47 | return ( | 47 | return ( |
| 48 | <div class="flex w-full gap-0.5 rounded-lg bg-muted p-0.5" role="group" aria-label={prefs.t("theme.toggle")}> | 48 | <div class="flex w-full gap-0.5 rounded-lg bg-muted p-0.5" role="group" aria-label={prefs.t("theme.toggle")}> |
| 49 | - <button type="button" aria-pressed={!isDark()} onClick={() => selectTheme("light")} class={cn("flex-1 rounded-md px-3 py-1.5 text-sm font-medium transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring", !isDark() ? "bg-background text-foreground shadow-xs" : "text-muted-foreground hover:text-foreground")}>{lightLabel()}</button> | 49 | + <button type="button" aria-pressed={!isDark()} onClick={() => selectTheme("light")} class={cn("h-10 flex-1 rounded-md px-3 text-sm font-medium sm:h-8 touch:h-10 transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring", !isDark() ? "bg-background text-foreground shadow-xs" : "text-muted-foreground hover:text-foreground")}>{lightLabel()}</button> |
| 50 | - <button type="button" aria-pressed={isDark()} onClick={() => selectTheme("dark")} class={cn("flex-1 rounded-md px-3 py-1.5 text-sm font-medium transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring", isDark() ? "bg-background text-foreground shadow-xs" : "text-muted-foreground hover:text-foreground")}>{darkLabel()}</button> | 50 | + <button type="button" aria-pressed={isDark()} onClick={() => selectTheme("dark")} class={cn("h-10 flex-1 rounded-md px-3 text-sm font-medium sm:h-8 touch:h-10 transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring", isDark() ? "bg-background text-foreground shadow-xs" : "text-muted-foreground hover:text-foreground")}>{darkLabel()}</button> |
| 51 | </div> | 51 | </div> |
| 52 | ); | 52 | ); |
| 53 | } | 53 | } |
src/components/marks/karne-view.tsxmodified+2 -2
| @@ -51,7 +51,7 @@ export function KarneView(props: { | |||
| 51 | <div class="space-y-4"> | 51 | <div class="space-y-4"> |
| 52 | <div class="flex flex-wrap items-end justify-between gap-3"> | 52 | <div class="flex flex-wrap items-end justify-between gap-3"> |
| 53 | <div class="min-w-0 space-y-1.5"> | 53 | <div class="min-w-0 space-y-1.5"> |
| 54 | - <label class="text-[11px] font-medium uppercase tracking-wide text-muted-foreground" for="karne-term"> | 54 | + <label class="block text-xs font-medium text-muted-foreground" for="karne-term"> |
| 55 | {t("terms.term")} | 55 | {t("terms.term")} |
| 56 | </label> | 56 | </label> |
| 57 | <Select | 57 | <Select |
| @@ -78,7 +78,7 @@ export function KarneView(props: { | |||
| 78 | 78 | ||
| 79 | <Show | 79 | <Show |
| 80 | when={props.report.instances.length > 0} | 80 | when={props.report.instances.length > 0} |
| 81 | - fallback={<DataTableEmpty class="rounded-lg border border-border bg-card py-10">{t("karne.empty")}</DataTableEmpty>} | 81 | + fallback={<DataTableEmpty class="rounded-xl border border-border bg-card py-10">{t("karne.empty")}</DataTableEmpty>} |
| 82 | > | 82 | > |
| 83 | <DataTable | 83 | <DataTable |
| 84 | columns={columns()} | 84 | columns={columns()} |
src/components/marks/marks-report-view.tsxmodified+17 -10
| @@ -75,9 +75,9 @@ export function MarksReportView(props: { | |||
| 75 | id: "course", | 75 | id: "course", |
| 76 | accessorFn: (row) => row.course.title, | 76 | accessorFn: (row) => row.course.title, |
| 77 | header: t("nav.courses"), | 77 | header: t("nav.courses"), |
| 78 | - meta: { headerClass: "w-[36%]" }, | 78 | + size: 260, |
| 79 | cell: (cell) => ( | 79 | cell: (cell) => ( |
| 80 | - <Link to="/courses/$id" params={{ id: cell.row.original.course.id }} class="block truncate font-medium hover:text-primary-text hover:underline"> | 80 | + <Link to="/courses/$id" params={{ id: cell.row.original.course.id }} title={cell.row.original.course.title} class="block truncate font-medium hover:text-primary-text hover:underline"> |
| 81 | {cell.row.original.course.title} | 81 | {cell.row.original.course.title} |
| 82 | </Link> | 82 | </Link> |
| 83 | ), | 83 | ), |
| @@ -85,7 +85,8 @@ export function MarksReportView(props: { | |||
| 85 | { | 85 | { |
| 86 | id: "instance", | 86 | id: "instance", |
| 87 | header: t("instances.title"), | 87 | header: t("instances.title"), |
| 88 | - meta: { headerClass: "w-[24%]", cellClass: "text-muted-foreground" }, | 88 | + size: 170, |
| 89 | + meta: { cellClass: "text-muted-foreground" }, | ||
| 89 | cell: (cell) => ( | 90 | cell: (cell) => ( |
| 90 | <Link | 91 | <Link |
| 91 | to="/instances/$id" | 92 | to="/instances/$id" |
| @@ -104,7 +105,7 @@ export function MarksReportView(props: { | |||
| 104 | id: "average", | 105 | id: "average", |
| 105 | accessorFn: (row) => row.average ?? undefined, | 106 | accessorFn: (row) => row.average ?? undefined, |
| 106 | header: t("marks.courseAvg"), | 107 | header: t("marks.courseAvg"), |
| 107 | - meta: { headerClass: "w-[22%]" }, | 108 | + size: 160, |
| 108 | cell: (cell) => ( | 109 | cell: (cell) => ( |
| 109 | <div class="flex min-w-0 items-center gap-2"> | 110 | <div class="flex min-w-0 items-center gap-2"> |
| 110 | <div class="h-1.5 w-12 min-w-8 shrink overflow-hidden rounded-full bg-muted"> | 111 | <div class="h-1.5 w-12 min-w-8 shrink overflow-hidden rounded-full bg-muted"> |
| @@ -118,7 +119,7 @@ export function MarksReportView(props: { | |||
| 118 | id: "band", | 119 | id: "band", |
| 119 | accessorFn: (row) => row.average_grade || undefined, | 120 | accessorFn: (row) => row.average_grade || undefined, |
| 120 | header: t("marks.band"), | 121 | header: t("marks.band"), |
| 121 | - meta: { headerClass: "w-[18%]" }, | 122 | + size: 110, |
| 122 | }, | 123 | }, |
| 123 | ]); | 124 | ]); |
| 124 | const [settings] = createResource(() => getSettings()); | 125 | const [settings] = createResource(() => getSettings()); |
| @@ -139,9 +140,11 @@ export function MarksReportView(props: { | |||
| 139 | { | 140 | { |
| 140 | accessorKey: "title", | 141 | accessorKey: "title", |
| 141 | header: t("marks.exam"), | 142 | header: t("marks.exam"), |
| 143 | + // The title is the one long value; four equal columns cut it to "2. Dönem B…". | ||
| 144 | + size: 240, | ||
| 142 | meta: { stickyLeft: true }, | 145 | meta: { stickyLeft: true }, |
| 143 | cell: (cell) => ( | 146 | cell: (cell) => ( |
| 144 | - <ExamLink examId={cell.row.original.exam} class="block truncate font-medium hover:underline"> | 147 | + <ExamLink examId={cell.row.original.exam} title={cell.row.original.title} class="block truncate font-medium hover:underline"> |
| 145 | {cell.row.original.title} | 148 | {cell.row.original.title} |
| 146 | </ExamLink> | 149 | </ExamLink> |
| 147 | ), | 150 | ), |
| @@ -150,18 +153,21 @@ export function MarksReportView(props: { | |||
| 150 | // it and stack it under the title as a second line instead. | 153 | // it and stack it under the title as a second line instead. |
| 151 | { | 154 | { |
| 152 | id: "kind", | 155 | id: "kind", |
| 156 | + size: 110, | ||
| 153 | accessorFn: (row) => examKindLabel(row.kind, t), | 157 | accessorFn: (row) => examKindLabel(row.kind, t), |
| 154 | header: t("exams.kind"), | 158 | header: t("exams.kind"), |
| 155 | cell: (cell) => <Badge variant="outline" class="rounded-sm capitalize">{examKindLabel(cell.row.original.kind, t)}</Badge>, | 159 | cell: (cell) => <Badge variant="outline" class="rounded-sm capitalize">{examKindLabel(cell.row.original.kind, t)}</Badge>, |
| 156 | }, | 160 | }, |
| 157 | { | 161 | { |
| 158 | id: "weight", | 162 | id: "weight", |
| 163 | + size: 90, | ||
| 159 | header: t("marks.weight"), | 164 | header: t("marks.weight"), |
| 160 | meta: { align: "right", divider: "left", cellClass: "" }, | 165 | meta: { align: "right", divider: "left", cellClass: "" }, |
| 161 | cell: (cell) => examWeight(cell.row.original, settings()?.exam_kinds) ?? "—", | 166 | cell: (cell) => examWeight(cell.row.original, settings()?.exam_kinds) ?? "—", |
| 162 | }, | 167 | }, |
| 163 | { | 168 | { |
| 164 | id: "mark", | 169 | id: "mark", |
| 170 | + size: 100, | ||
| 165 | accessorFn: (row) => row.mark ?? undefined, | 171 | accessorFn: (row) => row.mark ?? undefined, |
| 166 | header: t("marks.mark"), | 172 | header: t("marks.mark"), |
| 167 | meta: { align: "right", cellClass: "font-semibold" }, | 173 | meta: { align: "right", cellClass: "font-semibold" }, |
| @@ -169,6 +175,7 @@ export function MarksReportView(props: { | |||
| 169 | }, | 175 | }, |
| 170 | { | 176 | { |
| 171 | id: "grade", | 177 | id: "grade", |
| 178 | + size: 120, | ||
| 172 | accessorFn: (row) => row.grade || undefined, | 179 | accessorFn: (row) => row.grade || undefined, |
| 173 | header: t("marks.band"), | 180 | header: t("marks.band"), |
| 174 | meta: { align: "right" }, | 181 | meta: { align: "right" }, |
| @@ -177,7 +184,7 @@ export function MarksReportView(props: { | |||
| 177 | 184 | ||
| 178 | return ( | 185 | return ( |
| 179 | <div class="@container min-w-0 space-y-4"> | 186 | <div class="@container min-w-0 space-y-4"> |
| 180 | - <section class="overflow-hidden rounded-lg border border-border bg-card"> | 187 | + <section class="overflow-hidden rounded-xl border border-border bg-card"> |
| 181 | <Show when={props.identity}> | 188 | <Show when={props.identity}> |
| 182 | {(identity) => ( | 189 | {(identity) => ( |
| 183 | <div class="border-b border-border bg-muted/25 px-4 py-4"> | 190 | <div class="border-b border-border bg-muted/25 px-4 py-4"> |
| @@ -225,7 +232,7 @@ export function MarksReportView(props: { | |||
| 225 | </div> | 232 | </div> |
| 226 | </section> | 233 | </section> |
| 227 | 234 | ||
| 228 | - <Show when={props.report.courses.length > 0} fallback={<div class="rounded-lg border border-border bg-card p-4"><EmptyInline illustration="exams" title={t("marks.empty")} /></div>}> | 235 | + <Show when={props.report.courses.length > 0} fallback={<div class="rounded-xl border border-border bg-card p-4"><EmptyInline illustration="exams" title={t("marks.empty")} /></div>}> |
| 229 | <Tabs value={tab()} onChange={(value) => setTab(value === "byCourse" ? "byCourse" : "general")}> | 236 | <Tabs value={tab()} onChange={(value) => setTab(value === "byCourse" ? "byCourse" : "general")}> |
| 230 | <TabsList class="w-full @lg:w-fit"> | 237 | <TabsList class="w-full @lg:w-fit"> |
| 231 | <TabsTrigger value="general" class="min-w-0">{t("marks.tabGeneral")}</TabsTrigger> | 238 | <TabsTrigger value="general" class="min-w-0">{t("marks.tabGeneral")}</TabsTrigger> |
| @@ -259,7 +266,7 @@ export function MarksReportView(props: { | |||
| 259 | 266 | ||
| 260 | <Show when={activeCourse()} keyed> | 267 | <Show when={activeCourse()} keyed> |
| 261 | {(block) => ( | 268 | {(block) => ( |
| 262 | - <div class="rounded-lg border border-border bg-card p-4 shadow-xs"> | 269 | + <div class="rounded-xl border border-border bg-card p-4 shadow-xs"> |
| 263 | <div class="grid gap-3 @lg:grid-cols-[minmax(0,1fr)_auto] @lg:items-start"> | 270 | <div class="grid gap-3 @lg:grid-cols-[minmax(0,1fr)_auto] @lg:items-start"> |
| 264 | <div class="min-w-0"> | 271 | <div class="min-w-0"> |
| 265 | <Link to="/courses/$id" params={{ id: block.course.id }} class="block truncate text-sm font-semibold text-primary-text hover:underline"> | 272 | <Link to="/courses/$id" params={{ id: block.course.id }} class="block truncate text-sm font-semibold text-primary-text hover:underline"> |
| @@ -276,7 +283,7 @@ export function MarksReportView(props: { | |||
| 276 | </Link> | 283 | </Link> |
| 277 | </div> | 284 | </div> |
| 278 | <div class="@lg:text-right"> | 285 | <div class="@lg:text-right"> |
| 279 | - <p class="text-[11px] font-medium uppercase tracking-wider text-muted-foreground">{t("marks.courseAvg")}</p> | 286 | + <p class="text-xs font-medium text-muted-foreground">{t("marks.courseAvg")}</p> |
| 280 | <p class="mt-0.5 text-xl font-semibold tabular-nums">{markWithGrade(block.average, block.average_grade)}</p> | 287 | <p class="mt-0.5 text-xl font-semibold tabular-nums">{markWithGrade(block.average, block.average_grade)}</p> |
| 281 | </div> | 288 | </div> |
| 282 | </div> | 289 | </div> |
src/components/meals/meal-menu-row.tsxmodified+1 -1
| @@ -20,7 +20,7 @@ export function MealMenuRow(props: { menu: MealMenu; locale: string }) { | |||
| 20 | <Link | 20 | <Link |
| 21 | to="/meals/$id" | 21 | to="/meals/$id" |
| 22 | params={{ id: props.menu.id }} | 22 | params={{ id: props.menu.id }} |
| 23 | - class="group grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-4 gap-y-2 px-4 py-4 transition-colors hover:bg-surface-tint focus-visible:bg-surface-tint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring sm:grid-cols-[8rem_minmax(0,1fr)_auto_auto] sm:items-center" | 23 | + class="group grid grid-cols-[minmax(0,1fr)_auto] items-start gap-x-4 gap-y-2 px-4 py-4 transition-colors hover:bg-surface-tint focus-visible:bg-surface-tint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring sm:grid-cols-[8rem_minmax(0,1fr)_8rem_7rem] sm:items-center" |
| 24 | > | 24 | > |
| 25 | <span class="col-start-1 row-start-1 font-semibold text-text-strong sm:col-start-auto sm:row-start-auto">{mealSlotLabel(props.menu.slot, t)}</span> | 25 | <span class="col-start-1 row-start-1 font-semibold text-text-strong sm:col-start-auto sm:row-start-auto">{mealSlotLabel(props.menu.slot, t)}</span> |
| 26 | <span class="col-span-2 col-start-1 row-start-2 min-w-0 text-sm text-foreground sm:col-span-1 sm:col-start-auto sm:row-start-auto"> | 26 | <span class="col-span-2 col-start-1 row-start-2 min-w-0 text-sm text-foreground sm:col-span-1 sm:col-start-auto sm:row-start-auto"> |
src/components/meals/meal-service-table.tsxmodified+6 -4
| @@ -6,6 +6,8 @@ import { Badge } from "@/components/ui/badge"; | |||
| 6 | import { Button } from "@/components/ui/button"; | 6 | import { Button } from "@/components/ui/button"; |
| 7 | import { MealSectionHeading } from "@/components/meals/meal-section-heading"; | 7 | import { MealSectionHeading } from "@/components/meals/meal-section-heading"; |
| 8 | import { DataTable } from "@/components/ui/data-table"; | 8 | import { DataTable } from "@/components/ui/data-table"; |
| 9 | +import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | ||
| 10 | +import { cn } from "@/lib/cn"; | ||
| 9 | import { IconCheck, IconPlus, IconTrash, IconX } from "@/components/ui/icons"; | 11 | import { IconCheck, IconPlus, IconTrash, IconX } from "@/components/ui/icons"; |
| 10 | import { TableRowActions } from "@/components/ui/table-row-actions"; | 12 | import { TableRowActions } from "@/components/ui/table-row-actions"; |
| 11 | import { mealBookingStateLabel, mealServiceStatusLabel } from "@/lib/meals"; | 13 | import { mealBookingStateLabel, mealServiceStatusLabel } from "@/lib/meals"; |
| @@ -71,11 +73,11 @@ export function MealServiceTable(props: { | |||
| 71 | cell: (cell) => { | 73 | cell: (cell) => { |
| 72 | const status = () => cell.row.original.attendance?.status; | 74 | const status = () => cell.row.original.attendance?.status; |
| 73 | return ( | 75 | return ( |
| 74 | - <div class="flex gap-1.5"> | 76 | + // Row marks sit at the row-actions trigger's pill height. |
| 77 | + <div class={cn("flex gap-1.5", TOOLBAR_SLOT)}> | ||
| 75 | <Button | 78 | <Button |
| 76 | size="sm" | 79 | size="sm" |
| 77 | variant={status() === "served" ? "default" : "outline"} | 80 | variant={status() === "served" ? "default" : "outline"} |
| 78 | - class="rounded-lg" | ||
| 79 | disabled={props.pending} | 81 | disabled={props.pending} |
| 80 | aria-pressed={status() === "served"} | 82 | aria-pressed={status() === "served"} |
| 81 | onClick={(event) => { event.stopPropagation(); props.onMark(cell.row.original.student.id, "served"); }} | 83 | onClick={(event) => { event.stopPropagation(); props.onMark(cell.row.original.student.id, "served"); }} |
| @@ -86,7 +88,7 @@ export function MealServiceTable(props: { | |||
| 86 | <Button | 88 | <Button |
| 87 | size="sm" | 89 | size="sm" |
| 88 | variant="outline" | 90 | variant="outline" |
| 89 | - class={status() === "missed" ? "rounded-lg border-warning/60 bg-warning/10 text-warning-text" : "rounded-lg"} | 91 | + class={status() === "missed" ? "border-warning/60 bg-warning/10 text-warning-text" : undefined} |
| 90 | disabled={props.pending} | 92 | disabled={props.pending} |
| 91 | aria-pressed={status() === "missed"} | 93 | aria-pressed={status() === "missed"} |
| 92 | onClick={(event) => { event.stopPropagation(); props.onMark(cell.row.original.student.id, "missed"); }} | 94 | onClick={(event) => { event.stopPropagation(); props.onMark(cell.row.original.student.id, "missed"); }} |
| @@ -125,7 +127,7 @@ export function MealServiceTable(props: { | |||
| 125 | <MealSectionHeading id="meal-service-title" title={t("meals.service")} description={t("meals.serviceHelp")} /> | 127 | <MealSectionHeading id="meal-service-title" title={t("meals.service")} description={t("meals.serviceHelp")} /> |
| 126 | <DataTable | 128 | <DataTable |
| 127 | actions={ | 129 | actions={ |
| 128 | - <Button variant="outline" size="sm" class="rounded-lg" onClick={props.onAddWalkIn}> | 130 | + <Button variant="outline" size="sm" onClick={props.onAddWalkIn}> |
| 129 | <IconPlus class="h-4 w-4" /> | 131 | <IconPlus class="h-4 w-4" /> |
| 130 | {t("meals.addWalkIn")} | 132 | {t("meals.addWalkIn")} |
| 131 | </Button> | 133 | </Button> |
src/components/meals/meal-student-record-panel.tsxmodified+4 -1
| @@ -1,4 +1,4 @@ | |||
| 1 | -import { Show, createEffect, createSignal } from "solid-js"; | 1 | +import { Show, createEffect, createSignal, on } from "solid-js"; |
| 2 | import type { DietaryProfile, Limits } from "@/api/client"; | 2 | import type { DietaryProfile, Limits } from "@/api/client"; |
| 3 | import { MealTagCheckboxes } from "@/components/meals/meal-tag-checkboxes"; | 3 | import { MealTagCheckboxes } from "@/components/meals/meal-tag-checkboxes"; |
| 4 | import { Alert } from "@/components/ui/alert"; | 4 | import { Alert } from "@/components/ui/alert"; |
| @@ -40,6 +40,9 @@ export function MealStudentRecordPanel(props: { | |||
| 40 | const [amount, setAmount] = createSignal(""); | 40 | const [amount, setAmount] = createSignal(""); |
| 41 | const [method, setMethod] = createSignal(""); | 41 | const [method, setMethod] = createSignal(""); |
| 42 | const [creditNote, setCreditNote] = createSignal(""); | 42 | const [creditNote, setCreditNote] = createSignal(""); |
| 43 | + // A different student starts from a blank form, so a student with no | ||
| 44 | + // profile never shows the previous student's tags and note. | ||
| 45 | + createEffect(on(() => props.studentId, () => { setTags([]); setNote(""); }, { defer: true })); | ||
| 43 | createEffect(() => { | 46 | createEffect(() => { |
| 44 | const profile = props.profile; | 47 | const profile = props.profile; |
| 45 | if (profile) { setTags([...profile.tags]); setNote(profile.note ?? ""); } | 48 | if (profile) { setTags([...profile.tags]); setNote(profile.note ?? ""); } |
src/components/meals/meal-tag-checkboxes.tsxmodified+1 -1
| @@ -11,7 +11,7 @@ export function MealTagCheckboxes(props: { tags: string[]; selected: string[]; o | |||
| 11 | <div class="flex flex-wrap gap-2"> | 11 | <div class="flex flex-wrap gap-2"> |
| 12 | <For each={props.tags}> | 12 | <For each={props.tags}> |
| 13 | {(tag) => ( | 13 | {(tag) => ( |
| 14 | - <label class="flex cursor-pointer items-center gap-2 rounded-lg border border-border-line px-3 py-1.5 text-sm has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5"> | 14 | + <label class="flex cursor-pointer items-center gap-2 min-h-10 rounded-lg border border-border-line px-3 py-1.5 text-sm sm:min-h-8 touch:min-h-10 has-[:checked]:border-primary/50 has-[:checked]:bg-primary/5"> |
| 15 | <input type="checkbox" checked={props.selected.includes(tag)} onChange={() => toggle(tag)} /> | 15 | <input type="checkbox" checked={props.selected.includes(tag)} onChange={() => toggle(tag)} /> |
| 16 | {dietaryTagLabel(tag, t)} | 16 | {dietaryTagLabel(tag, t)} |
| 17 | </label> | 17 | </label> |
src/components/meals/meal-walk-in-panel.tsxmodified+1 -1
| @@ -28,7 +28,7 @@ export function MealWalkInPanel(props: { | |||
| 28 | <SidePanel open={props.open} onOpenChange={props.onOpenChange} title={t("meals.addWalkIn")} description={props.description}> | 28 | <SidePanel open={props.open} onOpenChange={props.onOpenChange} title={t("meals.addWalkIn")} description={props.description}> |
| 29 | <form class="space-y-4" onSubmit={submit}> | 29 | <form class="space-y-4" onSubmit={submit}> |
| 30 | <p class="text-sm text-muted-foreground">{t("meals.walkInHelp")}</p> | 30 | <p class="text-sm text-muted-foreground">{t("meals.walkInHelp")}</p> |
| 31 | - <UserSearchSelect id="meal-walkin" value={student()} onChange={setStudent} label={t("meals.student")} placeholder={t("form.selectStudent")} /> | 31 | + <UserSearchSelect id="meal-walkin" role="student" value={student()} onChange={setStudent} label={t("meals.student")} placeholder={t("form.selectStudent")} /> |
| 32 | <Show when={props.error}><Alert variant="destructive">{props.error}</Alert></Show> | 32 | <Show when={props.error}><Alert variant="destructive">{props.error}</Alert></Show> |
| 33 | <div class="flex gap-2 border-t border-border-hairline pt-4"> | 33 | <div class="flex gap-2 border-t border-border-hairline pt-4"> |
| 34 | <Button type="submit" disabled={!student() || props.pending}>{t("meals.served")}</Button> | 34 | <Button type="submit" disabled={!student() || props.pending}>{t("meals.served")}</Button> |
src/components/messages/gmail-compose-box.tsxmodified+7 -5
| @@ -106,11 +106,13 @@ export function GmailComposeBox(props: GmailComposeBoxProps) { | |||
| 106 | return ( | 106 | return ( |
| 107 | <Show when={props.open}> | 107 | <Show when={props.open}> |
| 108 | <div | 108 | <div |
| 109 | + role="dialog" | ||
| 110 | + aria-label={t("messages.newMessage")} | ||
| 109 | class="fixed inset-x-0 bottom-0 z-50 w-full rounded-t-2xl border border-border-line bg-surface-base pb-[max(env(safe-area-inset-bottom),var(--android-nav-inset,0px))] shadow-2xl shadow-black/20 transition-all duration-200 sm:inset-x-auto sm:right-6 sm:w-[560px] sm:rounded-t-xl sm:pb-0" | 111 | class="fixed inset-x-0 bottom-0 z-50 w-full rounded-t-2xl border border-border-line bg-surface-base pb-[max(env(safe-area-inset-bottom),var(--android-nav-inset,0px))] shadow-2xl shadow-black/20 transition-all duration-200 sm:inset-x-auto sm:right-6 sm:w-[560px] sm:rounded-t-xl sm:pb-0" |
| 110 | style={{ "max-height": isMinimized() ? "44px" : "640px" }} | 112 | style={{ "max-height": isMinimized() ? "44px" : "640px" }} |
| 111 | > | 113 | > |
| 112 | {/* Gmail Header */} | 114 | {/* Gmail Header */} |
| 113 | - <div class="flex h-9 items-center justify-between rounded-t-xl border-b border-border-hairline bg-surface-overlay px-4"> | 115 | + <div class="flex h-11 items-center justify-between rounded-t-2xl border-b sm:h-9 sm:rounded-t-xl border-border-hairline bg-surface-overlay px-4"> |
| 114 | <div class="flex min-w-0 flex-1 items-center gap-2"> | 116 | <div class="flex min-w-0 flex-1 items-center gap-2"> |
| 115 | <span class="h-2.5 w-2.5 rounded-full bg-primary" /> | 117 | <span class="h-2.5 w-2.5 rounded-full bg-primary" /> |
| 116 | <h3 class="min-w-0 truncate text-xs font-bold text-foreground"> | 118 | <h3 class="min-w-0 truncate text-xs font-bold text-foreground"> |
| @@ -120,7 +122,7 @@ export function GmailComposeBox(props: GmailComposeBoxProps) { | |||
| 120 | <div class="flex items-center gap-1"> | 122 | <div class="flex items-center gap-1"> |
| 121 | <button | 123 | <button |
| 122 | type="button" | 124 | type="button" |
| 123 | - class="flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted hover:text-foreground" | 125 | + class="flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground outline-hidden hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring sm:h-7 sm:w-7" |
| 124 | onClick={() => setIsMinimized(!isMinimized())} | 126 | onClick={() => setIsMinimized(!isMinimized())} |
| 125 | title={isMinimized() ? t("messages.expand") : t("messages.minimize")} | 127 | title={isMinimized() ? t("messages.expand") : t("messages.minimize")} |
| 126 | aria-label={isMinimized() ? t("messages.expand") : t("messages.minimize")} | 128 | aria-label={isMinimized() ? t("messages.expand") : t("messages.minimize")} |
| @@ -130,7 +132,7 @@ export function GmailComposeBox(props: GmailComposeBoxProps) { | |||
| 130 | </button> | 132 | </button> |
| 131 | <button | 133 | <button |
| 132 | type="button" | 134 | type="button" |
| 133 | - class="flex h-7 w-7 items-center justify-center rounded-lg text-muted-foreground hover:bg-destructive/10 hover:text-destructive-text" | 135 | + class="flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground outline-hidden hover:bg-destructive/10 hover:text-destructive-text focus-visible:ring-2 focus-visible:ring-ring sm:h-7 sm:w-7" |
| 134 | onClick={requestClose} | 136 | onClick={requestClose} |
| 135 | title={t("common.cancel")} | 137 | title={t("common.cancel")} |
| 136 | aria-label={t("common.cancel")} | 138 | aria-label={t("common.cancel")} |
| @@ -214,7 +216,7 @@ export function GmailComposeBox(props: GmailComposeBoxProps) { | |||
| 214 | disabled={pending() || !!sendBlocker()} | 216 | disabled={pending() || !!sendBlocker()} |
| 215 | aria-describedby={sendBlocker() ? "gmail-compose-send-hint" : undefined} | 217 | aria-describedby={sendBlocker() ? "gmail-compose-send-hint" : undefined} |
| 216 | > | 218 | > |
| 217 | - <IconSend class="mr-2 h-4 w-4" /> | 219 | + <IconSend class="h-4 w-4" /> |
| 218 | {t("messages.send")} | 220 | {t("messages.send")} |
| 219 | </Button> | 221 | </Button> |
| 220 | <Show when={sendBlocker() && !error()}> | 222 | <Show when={sendBlocker() && !error()}> |
| @@ -226,7 +228,7 @@ export function GmailComposeBox(props: GmailComposeBoxProps) { | |||
| 226 | 228 | ||
| 227 | <button | 229 | <button |
| 228 | type="button" | 230 | type="button" |
| 229 | - class="flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-destructive/10 hover:text-destructive-text transition-colors" | 231 | + class="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg text-muted-foreground outline-hidden transition-colors hover:bg-destructive/10 hover:text-destructive-text focus-visible:ring-2 focus-visible:ring-ring sm:h-8 sm:w-8" |
| 230 | onClick={requestClose} | 232 | onClick={requestClose} |
| 231 | title={t("messages.deleteDraft")} | 233 | title={t("messages.deleteDraft")} |
| 232 | aria-label={t("messages.deleteDraft")} | 234 | aria-label={t("messages.deleteDraft")} |
src/components/messages/gmail-mail-detail.tsxmodified+32 -20
| @@ -7,8 +7,16 @@ import { IconSend, IconTrash, IconMessage, IconArchive, IconChevronLeft, IconChe | |||
| 7 | import { postMessage } from "@/api/messages"; | 7 | import { postMessage } from "@/api/messages"; |
| 8 | import { formatApiError } from "@/api/client"; | 8 | import { formatApiError } from "@/api/client"; |
| 9 | import { personLabel } from "@/lib/person"; | 9 | import { personLabel } from "@/lib/person"; |
| 10 | -import { useT } from "@/stores/preferences-context"; | 10 | +import type { MessageKey } from "@/i18n/messages"; |
| 11 | -import { sanitizeRichText } from "@/lib/rich-text"; | 11 | +import { usePreferences, useT } from "@/stores/preferences-context"; |
| 12 | +import { toRichTextHtml } from "@/lib/rich-text"; | ||
| 13 | + | ||
| 14 | +const FOLDER_LABEL: Record<string, MessageKey> = { | ||
| 15 | + inbox: "messages.inbox", | ||
| 16 | + sent: "messages.sent", | ||
| 17 | + archive: "messages.archive", | ||
| 18 | + trash: "messages.trash", | ||
| 19 | +}; | ||
| 12 | 20 | ||
| 13 | interface GmailMailDetailProps { | 21 | interface GmailMailDetailProps { |
| 14 | message: Message; | 22 | message: Message; |
| @@ -22,6 +30,7 @@ interface GmailMailDetailProps { | |||
| 22 | 30 | ||
| 23 | export function GmailMailDetail(props: GmailMailDetailProps) { | 31 | export function GmailMailDetail(props: GmailMailDetailProps) { |
| 24 | const t = useT(); | 32 | const t = useT(); |
| 33 | + const { locale } = usePreferences(); | ||
| 25 | const [isReplying, setIsReplying] = createSignal(false); | 34 | const [isReplying, setIsReplying] = createSignal(false); |
| 26 | const [replyBody, setReplyBody] = createSignal(""); | 35 | const [replyBody, setReplyBody] = createSignal(""); |
| 27 | const [sending, setSending] = createSignal(false); | 36 | const [sending, setSending] = createSignal(false); |
| @@ -63,7 +72,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 63 | 72 | ||
| 64 | const formattedDate = (ts: number) => { | 73 | const formattedDate = (ts: number) => { |
| 65 | const date = new Date(ts); | 74 | const date = new Date(ts); |
| 66 | - return date.toLocaleString([], { | 75 | + return date.toLocaleString(locale(), { |
| 67 | year: "numeric", | 76 | year: "numeric", |
| 68 | month: "long", | 77 | month: "long", |
| 69 | day: "numeric", | 78 | day: "numeric", |
| @@ -121,8 +130,8 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 121 | class="h-8 rounded-lg text-xs" | 130 | class="h-8 rounded-lg text-xs" |
| 122 | onClick={props.onBack} | 131 | onClick={props.onBack} |
| 123 | > | 132 | > |
| 124 | - <IconChevronLeft class="mr-1 h-4 w-4" /> | 133 | + <IconChevronLeft class="h-4 w-4" /> |
| 125 | - Gelen Kutusu | 134 | + {t(FOLDER_LABEL[props.folder] ?? "messages.inbox")} |
| 126 | </Button> | 135 | </Button> |
| 127 | 136 | ||
| 128 | <div class="h-4 w-px bg-border mx-1" /> | 137 | <div class="h-4 w-px bg-border mx-1" /> |
| @@ -138,9 +147,9 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 138 | > | 147 | > |
| 139 | <Show | 148 | <Show |
| 140 | when={props.message.read} | 149 | when={props.message.read} |
| 141 | - fallback={<IconCheck class="mr-1.5 h-3.5 w-3.5" />} | 150 | + fallback={<IconCheck class="h-3.5 w-3.5" />} |
| 142 | > | 151 | > |
| 143 | - <IconMessage class="mr-1.5 h-3.5 w-3.5" /> | 152 | + <IconMessage class="h-3.5 w-3.5" /> |
| 144 | </Show> | 153 | </Show> |
| 145 | {props.message.read ? t("messages.markAsUnread") : t("messages.markAsRead")} | 154 | {props.message.read ? t("messages.markAsUnread") : t("messages.markAsRead")} |
| 146 | </Button> | 155 | </Button> |
| @@ -155,7 +164,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 155 | onClick={() => props.onAction({ folder: "archive" })} | 164 | onClick={() => props.onAction({ folder: "archive" })} |
| 156 | title={t("messages.moveToArchive")} | 165 | title={t("messages.moveToArchive")} |
| 157 | > | 166 | > |
| 158 | - <IconArchive class="mr-1.5 h-3.5 w-3.5" /> | 167 | + <IconArchive class="h-3.5 w-3.5" /> |
| 159 | {t("messages.moveToArchive")} | 168 | {t("messages.moveToArchive")} |
| 160 | </Button> | 169 | </Button> |
| 161 | </Show> | 170 | </Show> |
| @@ -169,7 +178,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 169 | onClick={() => props.onAction({ folder: restoreFolder() })} | 178 | onClick={() => props.onAction({ folder: restoreFolder() })} |
| 170 | title={t("messages.moveOutOfArchive")} | 179 | title={t("messages.moveOutOfArchive")} |
| 171 | > | 180 | > |
| 172 | - <IconArchive class="mr-1.5 h-3.5 w-3.5" /> | 181 | + <IconArchive class="h-3.5 w-3.5" /> |
| 173 | {t("messages.moveOutOfArchive")} | 182 | {t("messages.moveOutOfArchive")} |
| 174 | </Button> | 183 | </Button> |
| 175 | </Show> | 184 | </Show> |
| @@ -183,7 +192,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 183 | onClick={() => props.onAction({ folder: restoreFolder() })} | 192 | onClick={() => props.onAction({ folder: restoreFolder() })} |
| 184 | title={t("messages.restoreFromTrash")} | 193 | title={t("messages.restoreFromTrash")} |
| 185 | > | 194 | > |
| 186 | - <IconMessage class="mr-1.5 h-3.5 w-3.5" /> | 195 | + <IconMessage class="h-3.5 w-3.5" /> |
| 187 | {t("messages.restoreFromTrash")} | 196 | {t("messages.restoreFromTrash")} |
| 188 | </Button> | 197 | </Button> |
| 189 | </Show> | 198 | </Show> |
| @@ -197,7 +206,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 197 | onClick={() => props.onAction({ folder: "trash" })} | 206 | onClick={() => props.onAction({ folder: "trash" })} |
| 198 | title={t("messages.moveToTrash")} | 207 | title={t("messages.moveToTrash")} |
| 199 | > | 208 | > |
| 200 | - <IconTrash class="mr-1.5 h-3.5 w-3.5" /> | 209 | + <IconTrash class="h-3.5 w-3.5" /> |
| 201 | {t("messages.moveToTrash")} | 210 | {t("messages.moveToTrash")} |
| 202 | </Button> | 211 | </Button> |
| 203 | </Show> | 212 | </Show> |
| @@ -211,7 +220,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 211 | onClick={() => props.onAction({ delete: true })} | 220 | onClick={() => props.onAction({ delete: true })} |
| 212 | title={t("messages.deleteForever")} | 221 | title={t("messages.deleteForever")} |
| 213 | > | 222 | > |
| 214 | - <IconTrash class="mr-1.5 h-3.5 w-3.5" /> | 223 | + <IconTrash class="h-3.5 w-3.5" /> |
| 215 | {t("messages.deleteForever")} | 224 | {t("messages.deleteForever")} |
| 216 | </Button> | 225 | </Button> |
| 217 | </Show> | 226 | </Show> |
| @@ -226,8 +235,8 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 226 | <div class="flex-1 p-4 sm:p-6 max-w-4xl mx-auto w-full space-y-6"> | 235 | <div class="flex-1 p-4 sm:p-6 max-w-4xl mx-auto w-full space-y-6"> |
| 227 | {/* Email Subject Title Header */} | 236 | {/* Email Subject Title Header */} |
| 228 | <div class="flex items-center justify-between gap-3 border-b border-border-hairline pb-4"> | 237 | <div class="flex items-center justify-between gap-3 border-b border-border-hairline pb-4"> |
| 229 | - <div class="flex items-center gap-3"> | 238 | + <div class="flex min-w-0 flex-wrap items-center gap-3"> |
| 230 | - <h1 class="text-xl font-bold tracking-tight text-foreground"> | 239 | + <h1 class="min-w-0 break-words text-xl font-bold tracking-tight text-foreground"> |
| 231 | {props.message.subject} | 240 | {props.message.subject} |
| 232 | </h1> | 241 | </h1> |
| 233 | <Show when={props.message.label}> | 242 | <Show when={props.message.label}> |
| @@ -256,7 +265,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 256 | </Show> | 265 | </Show> |
| 257 | </div> | 266 | </div> |
| 258 | <p class="text-xs text-muted-foreground"> | 267 | <p class="text-xs text-muted-foreground"> |
| 259 | - {isSent() ? `${t("messages.to")}: ` : `${t("messages.from")}: `} | 268 | + {isSent() ? t("messages.to") : t("messages.from")} |
| 260 | <span class="font-medium text-foreground">{peerName()}</span> | 269 | <span class="font-medium text-foreground">{peerName()}</span> |
| 261 | </p> | 270 | </p> |
| 262 | </div> | 271 | </div> |
| @@ -269,15 +278,17 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 269 | class="h-8 rounded-lg text-xs" | 278 | class="h-8 rounded-lg text-xs" |
| 270 | onClick={handleStartReply} | 279 | onClick={handleStartReply} |
| 271 | > | 280 | > |
| 272 | - <IconMessage class="mr-1.5 h-3.5 w-3.5" /> | 281 | + <IconMessage class="h-3.5 w-3.5" /> |
| 273 | {t("messages.reply")} | 282 | {t("messages.reply")} |
| 274 | </Button> | 283 | </Button> |
| 275 | </Show> | 284 | </Show> |
| 276 | </div> | 285 | </div> |
| 277 | 286 | ||
| 278 | {/* Email Body Card */} | 287 | {/* Email Body Card */} |
| 279 | - <div class="rounded-xl border border-border-line bg-surface-base p-6 leading-relaxed text-sm text-foreground/90 whitespace-pre-wrap min-h-[140px]"> | 288 | + <div class="min-h-[140px] rounded-xl border border-border-line bg-surface-base p-4 text-sm leading-relaxed text-foreground/90 sm:p-6"> |
| 280 | - <div innerHTML={sanitizeRichText(props.message.body)} /> | 289 | + {/* Stored HTML (or older plain text) as paragraphs; source newlines |
| 290 | + between tags no longer turn into blank lines. */} | ||
| 291 | + <div class="note-prose break-words" innerHTML={toRichTextHtml(props.message.body)} /> | ||
| 281 | </div> | 292 | </div> |
| 282 | 293 | ||
| 283 | {/* Gmail Style Inline Reply Area */} | 294 | {/* Gmail Style Inline Reply Area */} |
| @@ -293,7 +304,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 293 | class="rounded-lg px-5 h-9 text-xs font-semibold hover:bg-accent" | 304 | class="rounded-lg px-5 h-9 text-xs font-semibold hover:bg-accent" |
| 294 | onClick={handleStartReply} | 305 | onClick={handleStartReply} |
| 295 | > | 306 | > |
| 296 | - <IconMessage class="mr-2 h-4 w-4" /> | 307 | + <IconMessage class="h-4 w-4" /> |
| 297 | {t("messages.reply")} | 308 | {t("messages.reply")} |
| 298 | </Button> | 309 | </Button> |
| 299 | </div> | 310 | </div> |
| @@ -338,7 +349,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 338 | class="rounded-lg px-5 h-9 font-semibold" | 349 | class="rounded-lg px-5 h-9 font-semibold" |
| 339 | disabled={sending() || !replyBody().trim()} | 350 | disabled={sending() || !replyBody().trim()} |
| 340 | > | 351 | > |
| 341 | - <IconSend class="mr-2 h-4 w-4" /> | 352 | + <IconSend class="h-4 w-4" /> |
| 342 | {t("messages.send")} | 353 | {t("messages.send")} |
| 343 | </Button> | 354 | </Button> |
| 344 | 355 | ||
| @@ -347,6 +358,7 @@ export function GmailMailDetail(props: GmailMailDetailProps) { | |||
| 347 | class="flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-destructive/10 hover:text-destructive-text" | 358 | class="flex h-8 w-8 items-center justify-center rounded-lg text-muted-foreground hover:bg-destructive/10 hover:text-destructive-text" |
| 348 | onClick={() => setIsReplying(false)} | 359 | onClick={() => setIsReplying(false)} |
| 349 | title={t("common.cancel")} | 360 | title={t("common.cancel")} |
| 361 | + aria-label={t("common.cancel")} | ||
| 350 | > | 362 | > |
| 351 | <IconTrash class="h-4 w-4" /> | 363 | <IconTrash class="h-4 w-4" /> |
| 352 | </button> | 364 | </button> |
src/components/messages/gmail-mail-row.tsxmodified+28 -11
| @@ -4,7 +4,8 @@ import { Badge } from "@/components/ui/badge"; | |||
| 4 | import { IconArchive, IconTrash, IconMessage } from "@/components/ui/icons"; | 4 | import { IconArchive, IconTrash, IconMessage } from "@/components/ui/icons"; |
| 5 | import { cn } from "@/lib/cn"; | 5 | import { cn } from "@/lib/cn"; |
| 6 | import { personLabel } from "@/lib/person"; | 6 | import { personLabel } from "@/lib/person"; |
| 7 | -import { useT } from "@/stores/preferences-context"; | 7 | +import { richTextExcerpt, toRichTextHtml } from "@/lib/rich-text"; |
| 8 | +import { usePreferences, useT } from "@/stores/preferences-context"; | ||
| 8 | 9 | ||
| 9 | interface GmailMailRowProps { | 10 | interface GmailMailRowProps { |
| 10 | message: Message; | 11 | message: Message; |
| @@ -20,6 +21,7 @@ interface GmailMailRowProps { | |||
| 20 | 21 | ||
| 21 | export function GmailMailRow(props: GmailMailRowProps) { | 22 | export function GmailMailRow(props: GmailMailRowProps) { |
| 22 | const t = useT(); | 23 | const t = useT(); |
| 24 | + const { locale } = usePreferences(); | ||
| 23 | 25 | ||
| 24 | const isSent = () => props.folder === "sent" || props.message.sender.id === props.currentUserId; | 26 | const isSent = () => props.folder === "sent" || props.message.sender.id === props.currentUserId; |
| 25 | const peer = () => (isSent() ? props.message.recipient : props.message.sender); | 27 | const peer = () => (isSent() ? props.message.recipient : props.message.sender); |
| @@ -36,9 +38,9 @@ export function GmailMailRow(props: GmailMailRowProps) { | |||
| 36 | date.getFullYear() === now.getFullYear(); | 38 | date.getFullYear() === now.getFullYear(); |
| 37 | 39 | ||
| 38 | if (isToday) { | 40 | if (isToday) { |
| 39 | - return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }); | 41 | + return date.toLocaleTimeString(locale(), { hour: "2-digit", minute: "2-digit" }); |
| 40 | } | 42 | } |
| 41 | - return date.toLocaleDateString([], { month: "short", day: "numeric" }); | 43 | + return date.toLocaleDateString(locale(), { month: "short", day: "numeric" }); |
| 42 | }; | 44 | }; |
| 43 | 45 | ||
| 44 | return ( | 46 | return ( |
| @@ -47,12 +49,23 @@ export function GmailMailRow(props: GmailMailRowProps) { | |||
| 47 | // A phone cannot fit sender, subject, snippet, date and actions on one | 49 | // A phone cannot fit sender, subject, snippet, date and actions on one |
| 48 | // 40px line, so below sm: the row stacks and grows to a thumb-sized | 50 | // 40px line, so below sm: the row stacks and grows to a thumb-sized |
| 49 | // target; from sm: up it stays the dense single line it always was. | 51 | // target; from sm: up it stays the dense single line it always was. |
| 50 | - "group relative flex shrink-0 cursor-pointer select-none flex-col gap-0.5 border-b border-l-4 border-border-hairline px-3 py-2.5 text-xs transition-colors duration-150", | 52 | + "group relative flex shrink-0 cursor-pointer select-none flex-col gap-0.5 border-b border-l-4 border-border-hairline px-3 py-2.5 text-xs transition-colors duration-150 outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring", |
| 51 | "sm:h-10 sm:flex-row sm:items-center sm:gap-3 sm:px-4 sm:py-0", | 53 | "sm:h-10 sm:flex-row sm:items-center sm:gap-3 sm:px-4 sm:py-0", |
| 52 | unread() ? "border-l-primary bg-surface-base font-semibold text-foreground hover:bg-accent/40" : "border-l-transparent bg-surface-overlay text-muted-foreground hover:bg-muted/50", | 54 | unread() ? "border-l-primary bg-surface-base font-semibold text-foreground hover:bg-accent/40" : "border-l-transparent bg-surface-overlay text-muted-foreground hover:bg-muted/50", |
| 53 | props.isSelected && "bg-accent/80 text-foreground" | 55 | props.isSelected && "bg-accent/80 text-foreground" |
| 54 | )} | 56 | )} |
| 57 | + role="button" | ||
| 58 | + tabindex="0" | ||
| 59 | + aria-current={props.isSelected ? "true" : undefined} | ||
| 55 | onClick={props.onSelect} | 60 | onClick={props.onSelect} |
| 61 | + onKeyDown={(event) => { | ||
| 62 | + // Only the row itself: Enter on a quick action must not open the message. | ||
| 63 | + if (event.target !== event.currentTarget) return; | ||
| 64 | + if (event.key === "Enter" || event.key === " ") { | ||
| 65 | + event.preventDefault(); | ||
| 66 | + props.onSelect(); | ||
| 67 | + } | ||
| 68 | + }} | ||
| 56 | > | 69 | > |
| 57 | {/* Sender / Peer Name — carries the date too while stacked, so the first | 70 | {/* Sender / Peer Name — carries the date too while stacked, so the first |
| 58 | line reads like a message list entry on a phone. */} | 71 | line reads like a message list entry on a phone. */} |
| @@ -66,7 +79,7 @@ export function GmailMailRow(props: GmailMailRowProps) { | |||
| 66 | {isSent() ? `${t("messages.to")}${peerName()}` : peerName()} | 79 | {isSent() ? `${t("messages.to")}${peerName()}` : peerName()} |
| 67 | </span> | 80 | </span> |
| 68 | <Show when={role()}> | 81 | <Show when={role()}> |
| 69 | - <span class="shrink-0 text-[11px] uppercase font-mono px-1 py-0.2 rounded bg-muted text-muted-foreground border border-border-hairline"> | 82 | + <span class="shrink-0 text-[11px] uppercase font-mono px-1 rounded bg-muted text-muted-foreground border border-border-hairline"> |
| 70 | {t(`role.${role()}` as any)} | 83 | {t(`role.${role()}` as any)} |
| 71 | </span> | 84 | </span> |
| 72 | </Show> | 85 | </Show> |
| @@ -88,7 +101,7 @@ export function GmailMailRow(props: GmailMailRowProps) { | |||
| 88 | </span> | 101 | </span> |
| 89 | <span class="truncate text-[11px] text-muted-foreground/70"> | 102 | <span class="truncate text-[11px] text-muted-foreground/70"> |
| 90 | <span class="hidden sm:inline">— </span> | 103 | <span class="hidden sm:inline">— </span> |
| 91 | - {props.message.body.replace(/<[^>]*>?/gm, "").trim()} | 104 | + {richTextExcerpt(toRichTextHtml(props.message.body), 160)} |
| 92 | </span> | 105 | </span> |
| 93 | </div> | 106 | </div> |
| 94 | 107 | ||
| @@ -109,12 +122,13 @@ export function GmailMailRow(props: GmailMailRowProps) { | |||
| 109 | </span> | 122 | </span> |
| 110 | 123 | ||
| 111 | {/* Quick Actions (Always visible with opacity on mobile, group-hover visible on desktop) */} | 124 | {/* Quick Actions (Always visible with opacity on mobile, group-hover visible on desktop) */} |
| 112 | - <div class="flex items-center justify-end gap-1 opacity-0 transition-opacity group-hover:opacity-100"> | 125 | + <div class="flex items-center justify-end gap-1 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100"> |
| 113 | <Show when={props.onArchive}> | 126 | <Show when={props.onArchive}> |
| 114 | <button | 127 | <button |
| 115 | type="button" | 128 | type="button" |
| 116 | - class="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors" | 129 | + class="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground outline-hidden focus-visible:ring-2 focus-visible:ring-ring hover:bg-accent hover:text-foreground transition-colors" |
| 117 | title={props.folder === "archive" ? t("messages.moveOutOfArchive") : t("messages.moveToArchive")} | 130 | title={props.folder === "archive" ? t("messages.moveOutOfArchive") : t("messages.moveToArchive")} |
| 131 | + aria-label={props.folder === "archive" ? t("messages.moveOutOfArchive") : t("messages.moveToArchive")} | ||
| 118 | onClick={(e) => { | 132 | onClick={(e) => { |
| 119 | e.stopPropagation(); | 133 | e.stopPropagation(); |
| 120 | props.onArchive?.(); | 134 | props.onArchive?.(); |
| @@ -127,8 +141,9 @@ export function GmailMailRow(props: GmailMailRowProps) { | |||
| 127 | <Show when={props.onTrash}> | 141 | <Show when={props.onTrash}> |
| 128 | <button | 142 | <button |
| 129 | type="button" | 143 | type="button" |
| 130 | - class="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive-text transition-colors" | 144 | + class="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground outline-hidden focus-visible:ring-2 focus-visible:ring-ring hover:bg-destructive/10 hover:text-destructive-text transition-colors" |
| 131 | title={props.folder === "trash" ? t("messages.restoreFromTrash") : t("messages.moveToTrash")} | 145 | title={props.folder === "trash" ? t("messages.restoreFromTrash") : t("messages.moveToTrash")} |
| 146 | + aria-label={props.folder === "trash" ? t("messages.restoreFromTrash") : t("messages.moveToTrash")} | ||
| 132 | onClick={(e) => { | 147 | onClick={(e) => { |
| 133 | e.stopPropagation(); | 148 | e.stopPropagation(); |
| 134 | props.onTrash?.(); | 149 | props.onTrash?.(); |
| @@ -141,8 +156,9 @@ export function GmailMailRow(props: GmailMailRowProps) { | |||
| 141 | <Show when={props.onDeleteForever}> | 156 | <Show when={props.onDeleteForever}> |
| 142 | <button | 157 | <button |
| 143 | type="button" | 158 | type="button" |
| 144 | - class="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-destructive/10 hover:text-destructive-text transition-colors" | 159 | + class="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground outline-hidden focus-visible:ring-2 focus-visible:ring-ring hover:bg-destructive/10 hover:text-destructive-text transition-colors" |
| 145 | title={t("messages.deleteForever")} | 160 | title={t("messages.deleteForever")} |
| 161 | + aria-label={t("messages.deleteForever")} | ||
| 146 | onClick={(e) => { | 162 | onClick={(e) => { |
| 147 | e.stopPropagation(); | 163 | e.stopPropagation(); |
| 148 | props.onDeleteForever?.(); | 164 | props.onDeleteForever?.(); |
| @@ -155,8 +171,9 @@ export function GmailMailRow(props: GmailMailRowProps) { | |||
| 155 | <Show when={props.onToggleRead}> | 171 | <Show when={props.onToggleRead}> |
| 156 | <button | 172 | <button |
| 157 | type="button" | 173 | type="button" |
| 158 | - class="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-accent hover:text-foreground transition-colors" | 174 | + class="flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground outline-hidden focus-visible:ring-2 focus-visible:ring-ring hover:bg-accent hover:text-foreground transition-colors" |
| 159 | title={unread() ? t("messages.markAsRead") : t("messages.markAsUnread")} | 175 | title={unread() ? t("messages.markAsRead") : t("messages.markAsUnread")} |
| 176 | + aria-label={unread() ? t("messages.markAsRead") : t("messages.markAsUnread")} | ||
| 160 | onClick={(e) => { | 177 | onClick={(e) => { |
| 161 | e.stopPropagation(); | 178 | e.stopPropagation(); |
| 162 | props.onToggleRead?.(); | 179 | props.onToggleRead?.(); |
src/components/notes/note-card.tsxmodified+17 -16
| @@ -29,22 +29,23 @@ export function NoteCard(props: { | |||
| 29 | 29 | ||
| 30 | return ( | 30 | return ( |
| 31 | <> | 31 | <> |
| 32 | - <article | 32 | + {/* The title is the card's one open control, stretched over the whole |
| 33 | - role="button" | 33 | + card; the actions menu sits above it. A role="button" card wrapping |
| 34 | - tabindex="0" | 34 | + the menu nested one button in another, and Enter on the menu |
| 35 | - class="group flex h-full min-h-44 cursor-pointer flex-col rounded-xl border border-border bg-card p-4 shadow-xs transition-[border-color,box-shadow] hover:border-primary/40 hover:shadow-md focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" | 35 | + trigger bubbled up and opened the note. */} |
| 36 | - onClick={() => props.onOpen(props.note)} | 36 | + <article class="group relative flex h-full min-h-44 cursor-pointer flex-col rounded-xl border border-border-line bg-card p-4 shadow-xs transition-[border-color,box-shadow] hover:border-primary/40 hover:shadow-md has-[.note-card-open:focus-visible]:ring-2 has-[.note-card-open:focus-visible]:ring-ring"> |
| 37 | - onKeyDown={(event) => { | ||
| 38 | - if (event.key === "Enter" || event.key === " ") { | ||
| 39 | - event.preventDefault(); | ||
| 40 | - props.onOpen(props.note); | ||
| 41 | - } | ||
| 42 | - }} | ||
| 43 | - > | ||
| 44 | <div class="flex items-start justify-between gap-3"> | 37 | <div class="flex items-start justify-between gap-3"> |
| 45 | - <h3 class="line-clamp-2 min-w-0 text-[15px] font-semibold leading-snug text-text-strong">{props.note.title}</h3> | 38 | + <h3 class="line-clamp-2 min-w-0 text-[15px] font-semibold leading-snug text-text-strong"> |
| 39 | + <button | ||
| 40 | + type="button" | ||
| 41 | + class="note-card-open text-left outline-hidden after:absolute after:inset-0 after:rounded-xl after:content-['']" | ||
| 42 | + onClick={() => props.onOpen(props.note)} | ||
| 43 | + > | ||
| 44 | + {props.note.title} | ||
| 45 | + </button> | ||
| 46 | + </h3> | ||
| 46 | <Show when={canManage()}> | 47 | <Show when={canManage()}> |
| 47 | - <div class="-mr-1.5 -mt-1 shrink-0" onClick={(event) => event.stopPropagation()}> | 48 | + <div class="relative z-10 -mr-1.5 -mt-1 shrink-0"> |
| 48 | <TableRowActions | 49 | <TableRowActions |
| 49 | label={t("common.actions")} | 50 | label={t("common.actions")} |
| 50 | actions={[ | 51 | actions={[ |
| @@ -68,11 +69,11 @@ export function NoteCard(props: { | |||
| 68 | <p class={cn("mt-2 line-clamp-5 flex-1 text-[13px] leading-6", excerpt() ? "text-muted-foreground" : "italic text-muted-foreground/70")}> | 69 | <p class={cn("mt-2 line-clamp-5 flex-1 text-[13px] leading-6", excerpt() ? "text-muted-foreground" : "italic text-muted-foreground/70")}> |
| 69 | {excerpt() || t("notes.noContent")} | 70 | {excerpt() || t("notes.noContent")} |
| 70 | </p> | 71 | </p> |
| 71 | - <span class="mt-3 inline-flex items-center gap-1 text-xs font-medium text-primary-text opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"> | 72 | + <span aria-hidden="true" class="mt-3 inline-flex items-center gap-1 text-xs font-medium text-primary-text opacity-0 transition-opacity group-hover:opacity-100 group-has-[.note-card-open:focus-visible]:opacity-100"> |
| 72 | {t("notes.open")} | 73 | {t("notes.open")} |
| 73 | <IconChevronRight class="h-3.5 w-3.5" /> | 74 | <IconChevronRight class="h-3.5 w-3.5" /> |
| 74 | </span> | 75 | </span> |
| 75 | - {error() && <p class="mt-2 text-sm text-destructive-text">{error()}</p>} | 76 | + {error() && <p class="relative z-10 mt-2 text-sm text-destructive-text">{error()}</p>} |
| 76 | </article> | 77 | </article> |
| 77 | 78 | ||
| 78 | <SidePanel guardUnsaved open={editing()} onOpenChange={setEditing} title={t("common.edit")} description={props.note.title}> | 79 | <SidePanel guardUnsaved open={editing()} onOpenChange={setEditing} title={t("common.edit")} description={props.note.title}> |
src/components/notes/note-document.tsxmodified+14 -14
| @@ -7,6 +7,7 @@ import { NoteFilesPanel } from "@/components/notes/note-files-panel"; | |||
| 7 | import { NoteRichEditor } from "@/components/notes/note-rich-editor"; | 7 | import { NoteRichEditor } from "@/components/notes/note-rich-editor"; |
| 8 | import { Alert } from "@/components/ui/alert"; | 8 | import { Alert } from "@/components/ui/alert"; |
| 9 | import { Button } from "@/components/ui/button"; | 9 | import { Button } from "@/components/ui/button"; |
| 10 | +import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | ||
| 10 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 11 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 11 | import { IconAlert, IconChevronLeft, IconPlus, IconTrash } from "@/components/ui/icons"; | 12 | import { IconAlert, IconChevronLeft, IconPlus, IconTrash } from "@/components/ui/icons"; |
| 12 | import { cn } from "@/lib/cn"; | 13 | import { cn } from "@/lib/cn"; |
| @@ -139,16 +140,17 @@ export function NoteDocument(props: { note?: Note }) { | |||
| 139 | 140 | ||
| 140 | return ( | 141 | return ( |
| 141 | <div class="space-y-4"> | 142 | <div class="space-y-4"> |
| 142 | - <div class="flex items-center gap-3"> | 143 | + {/* Header row controls are toolbar pills, the back link included. */} |
| 143 | - <Link to="/notes" class="inline-flex h-8 items-center gap-1 rounded-lg px-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"> | 144 | + <div class={cn("flex items-center gap-3", TOOLBAR_SLOT)}> |
| 145 | + <Link to="/notes" class="inline-flex items-center gap-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"> | ||
| 144 | <IconChevronLeft class="h-4 w-4" /> | 146 | <IconChevronLeft class="h-4 w-4" /> |
| 145 | {t("notes.backToNotebook")} | 147 | {t("notes.backToNotebook")} |
| 146 | </Link> | 148 | </Link> |
| 147 | - <span class={cn("ml-auto text-xs", dirty() ? "text-amber-600 dark:text-amber-400" : "text-muted-foreground")} aria-live="polite"> | 149 | + <span class={cn("ml-auto text-xs", dirty() ? "text-warning-text" : "text-muted-foreground")} aria-live="polite"> |
| 148 | {status()} | 150 | {status()} |
| 149 | </span> | 151 | </span> |
| 150 | <Show when={props.note}> | 152 | <Show when={props.note}> |
| 151 | - <Button type="button" variant="outline" size="sm" class="rounded-lg text-destructive-text hover:text-destructive-text" onClick={() => setDeleteOpen(true)}> | 153 | + <Button type="button" variant="outline" size="sm" class="text-destructive-text hover:text-destructive-text" onClick={() => setDeleteOpen(true)}> |
| 152 | <IconTrash class="h-4 w-4" /> | 154 | <IconTrash class="h-4 w-4" /> |
| 153 | {t("common.delete")} | 155 | {t("common.delete")} |
| 154 | </Button> | 156 | </Button> |
| @@ -178,10 +180,10 @@ export function NoteDocument(props: { note?: Note }) { | |||
| 178 | value={content()} | 180 | value={content()} |
| 179 | onChange={setContent} | 181 | onChange={setContent} |
| 180 | placeholder={t("notes.bodyPlaceholder")} | 182 | placeholder={t("notes.bodyPlaceholder")} |
| 181 | - toolbarClass="top-[45px]" | 183 | + toolbarClass="top-[calc(49px+env(safe-area-inset-top))]" |
| 182 | actions={ | 184 | actions={ |
| 183 | <> | 185 | <> |
| 184 | - <Button type="button" size="sm" class="min-w-[6.5rem] rounded-lg" disabled={saving() || (!dirty() && !isNew())} onClick={() => void save()}> | 186 | + <Button type="button" size="sm" class="h-8 min-w-[6.5rem] rounded-full px-3.5 text-[13px]" disabled={saving() || (!dirty() && !isNew())} onClick={() => void save()}> |
| 185 | {saving() ? t("notes.saving") : t("common.save")} | 187 | {saving() ? t("notes.saving") : t("common.save")} |
| 186 | </Button> | 188 | </Button> |
| 187 | </> | 189 | </> |
| @@ -189,11 +191,11 @@ export function NoteDocument(props: { note?: Note }) { | |||
| 189 | /> | 191 | /> |
| 190 | </div> | 192 | </div> |
| 191 | 193 | ||
| 192 | - <aside class="min-w-0 space-y-4 xl:sticky xl:top-[61px] xl:self-start"> | 194 | + <aside class="min-w-0 space-y-4 xl:sticky xl:top-[calc(61px+env(safe-area-inset-top))] xl:self-start"> |
| 193 | <Show | 195 | <Show |
| 194 | when={props.note} | 196 | when={props.note} |
| 195 | fallback={ | 197 | fallback={ |
| 196 | - <section class="space-y-3 rounded-lg border border-border/80 bg-card p-4 shadow-xs dark:border-white/8"> | 198 | + <section class="space-y-3 rounded-xl border border-border-line bg-card p-4 shadow-xs"> |
| 197 | <div> | 199 | <div> |
| 198 | <h3 class="text-sm font-semibold">{t("notes.files")}</h3> | 200 | <h3 class="text-sm font-semibold">{t("notes.files")}</h3> |
| 199 | <p class="mt-1 text-xs text-muted-foreground">{t("notes.filesHelp", { size: formatBytes(maxFileBytes()) })}</p> | 201 | <p class="mt-1 text-xs text-muted-foreground">{t("notes.filesHelp", { size: formatBytes(maxFileBytes()) })}</p> |
| @@ -208,12 +210,10 @@ export function NoteDocument(props: { note?: Note }) { | |||
| 208 | disabled={saving() || atFileLimit()} | 210 | disabled={saving() || atFileLimit()} |
| 209 | onChange={(event) => addFiles(event.currentTarget.files)} | 211 | onChange={(event) => addFiles(event.currentTarget.files)} |
| 210 | /> | 212 | /> |
| 211 | - <div class="grid w-full grid-cols-2 gap-2"> | 213 | + <Button type="button" size="sm" class="h-10 w-full rounded-full text-[13px] sm:h-8 touch:h-10" disabled={saving() || atFileLimit()} onClick={() => fileInput?.click()}> |
| 212 | - <Button type="button" size="sm" class="col-span-2 w-full rounded-lg" disabled={saving() || atFileLimit()} onClick={() => fileInput?.click()}> | 214 | + <IconPlus class="h-4 w-4 shrink-0" /> |
| 213 | - <IconPlus class="h-4 w-4 shrink-0" /> | 215 | + <span class="truncate">{t("notes.addFile")}</span> |
| 214 | - <span class="truncate">{t("notes.addFile")}</span> | 216 | + </Button> |
| 215 | - </Button> | ||
| 216 | - </div> | ||
| 217 | <p class="text-xs text-muted-foreground">{t("notes.filesUploadOnSave")}</p> | 217 | <p class="text-xs text-muted-foreground">{t("notes.filesUploadOnSave")}</p> |
| 218 | <Show when={atFileLimit()}> | 218 | <Show when={atFileLimit()}> |
| 219 | <p class="text-xs text-muted-foreground">{t("notes.fileLimit")}</p> | 219 | <p class="text-xs text-muted-foreground">{t("notes.fileLimit")}</p> |
src/components/notes/note-files-panel.tsxmodified+5 -5
| @@ -143,7 +143,7 @@ export function NoteFilesPanel(props: { | |||
| 143 | }; | 143 | }; |
| 144 | 144 | ||
| 145 | return ( | 145 | return ( |
| 146 | - <section class="space-y-3 rounded-lg border border-border/80 bg-card p-4 shadow-xs dark:border-white/8"> | 146 | + <section class="space-y-3 rounded-xl border border-border-line bg-card p-4 shadow-xs"> |
| 147 | <Show when={flash()}> | 147 | <Show when={flash()}> |
| 148 | <Alert variant="success">{flash()}</Alert> | 148 | <Alert variant="success">{flash()}</Alert> |
| 149 | </Show> | 149 | </Show> |
| @@ -167,11 +167,11 @@ export function NoteFilesPanel(props: { | |||
| 167 | {/* Two equal halves spanning the panel, the same width as the drop | 167 | {/* Two equal halves spanning the panel, the same width as the drop |
| 168 | area and file list under them. */} | 168 | area and file list under them. */} |
| 169 | <div class="grid w-full grid-cols-2 gap-2"> | 169 | <div class="grid w-full grid-cols-2 gap-2"> |
| 170 | - <Button type="button" variant="outline" size="sm" class="w-full rounded-lg" disabled={pending() || atLimit()} onClick={openNewDrawing}> | 170 | + <Button type="button" variant="outline" size="sm" class="h-10 w-full rounded-full text-[13px] sm:h-8 touch:h-10" disabled={pending() || atLimit()} onClick={openNewDrawing}> |
| 171 | <IconEdit class="h-4 w-4 shrink-0" /> | 171 | <IconEdit class="h-4 w-4 shrink-0" /> |
| 172 | <span class="truncate">{t("notes.draw")}</span> | 172 | <span class="truncate">{t("notes.draw")}</span> |
| 173 | </Button> | 173 | </Button> |
| 174 | - <Button type="button" size="sm" class="w-full rounded-lg" disabled={pending() || atLimit()} onClick={() => input?.click()}> | 174 | + <Button type="button" size="sm" class="h-10 w-full rounded-full text-[13px] sm:h-8 touch:h-10" disabled={pending() || atLimit()} onClick={() => input?.click()}> |
| 175 | <IconPlus class="h-4 w-4 shrink-0" /> | 175 | <IconPlus class="h-4 w-4 shrink-0" /> |
| 176 | <span class="truncate">{t("notes.addFile")}</span> | 176 | <span class="truncate">{t("notes.addFile")}</span> |
| 177 | </Button> | 177 | </Button> |
| @@ -191,14 +191,14 @@ export function NoteFilesPanel(props: { | |||
| 191 | <Suspense fallback={<PageSpinner />}> | 191 | <Suspense fallback={<PageSpinner />}> |
| 192 | <Show | 192 | <Show |
| 193 | when={(files() ?? []).length > 0} | 193 | when={(files() ?? []).length > 0} |
| 194 | - fallback={<p class="rounded-md border border-dashed border-border/80 bg-muted/20 px-3 py-6 text-center text-sm text-muted-foreground">{t("notes.noFiles")}</p>} | 194 | + fallback={!files.error && <p class="rounded-md border border-dashed border-border/80 bg-muted/20 px-3 py-6 text-center text-sm text-muted-foreground">{t("notes.noFiles")}</p>} |
| 195 | > | 195 | > |
| 196 | <ul class="grid grid-cols-1 gap-3 rounded-md border border-border/70 bg-background/70 p-2 sm:grid-cols-2"> | 196 | <ul class="grid grid-cols-1 gap-3 rounded-md border border-border/70 bg-background/70 p-2 sm:grid-cols-2"> |
| 197 | <For each={pageFiles()}> | 197 | <For each={pageFiles()}> |
| 198 | {(file) => { | 198 | {(file) => { |
| 199 | const meta = fileTypeMeta(file, "h-8 w-8"); | 199 | const meta = fileTypeMeta(file, "h-8 w-8"); |
| 200 | return ( | 200 | return ( |
| 201 | - <li class="group overflow-hidden rounded-xl border border-border/70 bg-card text-sm shadow-xs transition-colors hover:border-amber-500/40"> | 201 | + <li class="group overflow-hidden rounded-xl border border-border/70 bg-card text-sm shadow-xs transition-colors hover:border-primary/40"> |
| 202 | <div class="relative h-28 bg-muted/25"> | 202 | <div class="relative h-28 bg-muted/25"> |
| 203 | <button type="button" class="flex h-full w-full items-center justify-center rounded-t-xl transition-colors hover:bg-muted/40" aria-label={`${t("common.view")}: ${file.name}`} onClick={() => setPreviewFile(file)}> | 203 | <button type="button" class="flex h-full w-full items-center justify-center rounded-t-xl transition-colors hover:bg-muted/40" aria-label={`${t("common.view")}: ${file.name}`} onClick={() => setPreviewFile(file)}> |
| 204 | <span class={cn("flex h-16 w-16 items-center justify-center rounded-lg border", meta.class)}> | 204 | <span class={cn("flex h-16 w-16 items-center justify-center rounded-lg border", meta.class)}> |
src/components/notes/note-import-panel.tsxmodified+21 -11
| @@ -86,8 +86,18 @@ export function NoteImportPanel(props: { | |||
| 86 | <div class="space-y-5"> | 86 | <div class="space-y-5"> |
| 87 | <Show when={!file()}> | 87 | <Show when={!file()}> |
| 88 | <div | 88 | <div |
| 89 | - class="flex min-h-56 cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-amber-500/50 ring-1 ring-amber-500/25 bg-muted/30 p-6 text-center transition-all hover:border-amber-400 hover:ring-amber-400/40 hover:bg-muted/50" | 89 | + role="button" |
| 90 | + tabindex="0" | ||
| 91 | + aria-busy={processing()} | ||
| 92 | + class="flex min-h-56 cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-primary/40 bg-muted/30 p-6 text-center outline-hidden transition-colors hover:border-primary/70 hover:bg-muted/50 focus-visible:ring-2 focus-visible:ring-ring" | ||
| 90 | onClick={() => fileInput?.click()} | 93 | onClick={() => fileInput?.click()} |
| 94 | + onKeyDown={(event) => { | ||
| 95 | + if (event.target !== event.currentTarget) return; | ||
| 96 | + if (event.key === "Enter" || event.key === " ") { | ||
| 97 | + event.preventDefault(); | ||
| 98 | + fileInput?.click(); | ||
| 99 | + } | ||
| 100 | + }} | ||
| 91 | > | 101 | > |
| 92 | <input | 102 | <input |
| 93 | ref={(el) => { | 103 | ref={(el) => { |
| @@ -98,15 +108,15 @@ export function NoteImportPanel(props: { | |||
| 98 | class="hidden" | 108 | class="hidden" |
| 99 | onChange={(e) => void handleFileSelect(e.currentTarget.files?.[0])} | 109 | onChange={(e) => void handleFileSelect(e.currentTarget.files?.[0])} |
| 100 | /> | 110 | /> |
| 101 | - <span class="flex h-12 w-12 items-center justify-center rounded-lg border border-amber-500/50 ring-1 ring-amber-500/30 bg-muted/40 text-foreground shadow-xs"> | 111 | + <span class="flex h-12 w-12 items-center justify-center rounded-lg border border-primary/40 bg-primary/10 text-primary-text shadow-xs"> |
| 102 | <IconUploadCloud class="h-6 w-6" /> | 112 | <IconUploadCloud class="h-6 w-6" /> |
| 103 | </span> | 113 | </span> |
| 104 | <div class="space-y-1 max-w-sm mx-auto"> | 114 | <div class="space-y-1 max-w-sm mx-auto"> |
| 105 | <p class="text-sm font-semibold text-foreground"> | 115 | <p class="text-sm font-semibold text-foreground"> |
| 106 | {t("notes.import")} (PDF, TXT, Markdown) | 116 | {t("notes.import")} (PDF, TXT, Markdown) |
| 107 | </p> | 117 | </p> |
| 108 | - <p class="text-xs leading-normal text-muted-foreground"> | 118 | + <p class="text-xs leading-normal text-muted-foreground" aria-live="polite"> |
| 109 | - {t("notes.importHelp")} | 119 | + {processing() ? t("notes.importReading") : t("notes.importHelp")} |
| 110 | </p> | 120 | </p> |
| 111 | </div> | 121 | </div> |
| 112 | </div> | 122 | </div> |
| @@ -114,7 +124,7 @@ export function NoteImportPanel(props: { | |||
| 114 | 124 | ||
| 115 | <Show when={file()}> | 125 | <Show when={file()}> |
| 116 | <div class="space-y-4"> | 126 | <div class="space-y-4"> |
| 117 | - <div class="flex items-center justify-between rounded-xl border border-amber-500/40 ring-1 ring-amber-500/25 bg-card px-4 py-3 text-xs"> | 127 | + <div class="flex items-center justify-between gap-2 rounded-xl border border-border-line bg-card px-4 py-3 text-xs"> |
| 118 | <div class="flex items-center gap-2.5 min-w-0"> | 128 | <div class="flex items-center gap-2.5 min-w-0"> |
| 119 | <IconFileText class="h-4 w-4 shrink-0 text-foreground" /> | 129 | <IconFileText class="h-4 w-4 shrink-0 text-foreground" /> |
| 120 | <span class="truncate font-medium text-foreground">{file()?.name}</span> | 130 | <span class="truncate font-medium text-foreground">{file()?.name}</span> |
| @@ -124,7 +134,7 @@ export function NoteImportPanel(props: { | |||
| 124 | type="button" | 134 | type="button" |
| 125 | variant="ghost" | 135 | variant="ghost" |
| 126 | size="sm" | 136 | size="sm" |
| 127 | - class="h-7 text-xs rounded-lg" | 137 | + class="h-8 shrink-0 rounded-full px-3 text-xs touch:h-10" |
| 128 | onClick={() => { | 138 | onClick={() => { |
| 129 | setFile(null); | 139 | setFile(null); |
| 130 | setError(""); | 140 | setError(""); |
| @@ -133,17 +143,17 @@ export function NoteImportPanel(props: { | |||
| 133 | setHasGarbled(false); | 143 | setHasGarbled(false); |
| 134 | }} | 144 | }} |
| 135 | > | 145 | > |
| 136 | - {t("common.edit")} | 146 | + {t("notes.importChangeFile")} |
| 137 | </Button> | 147 | </Button> |
| 138 | </div> | 148 | </div> |
| 139 | 149 | ||
| 140 | <Show when={hasGarbled()}> | 150 | <Show when={hasGarbled()}> |
| 141 | - <p class="rounded-xl border border-amber-500/30 bg-amber-500/10 px-3.5 py-2.5 text-xs font-medium text-amber-700 dark:text-amber-300"> | 151 | + <p class="rounded-xl border border-warning/30 bg-warning/10 px-3.5 py-2.5 text-xs font-medium text-warning-text"> |
| 142 | - ⚠️ Some content may be unreadable due to OCR/extraction issues | 152 | + {t("notes.importGarbled")} |
| 143 | </p> | 153 | </p> |
| 144 | </Show> | 154 | </Show> |
| 145 | 155 | ||
| 146 | - <div class="space-y-1.5 rounded-xl border border-border/80 bg-card p-4 shadow-xs"> | 156 | + <div class="space-y-1.5 rounded-xl border border-border-line bg-card p-4 shadow-xs"> |
| 147 | <Label for="import-title">{t("form.title")}</Label> | 157 | <Label for="import-title">{t("form.title")}</Label> |
| 148 | <Input | 158 | <Input |
| 149 | id="import-title" | 159 | id="import-title" |
| @@ -154,7 +164,7 @@ export function NoteImportPanel(props: { | |||
| 154 | /> | 164 | /> |
| 155 | </div> | 165 | </div> |
| 156 | 166 | ||
| 157 | - <div class="space-y-1.5 rounded-xl border border-border/80 bg-card p-4 shadow-xs"> | 167 | + <div class="space-y-1.5 rounded-xl border border-border-line bg-card p-4 shadow-xs"> |
| 158 | <Label for="import-content">{t("form.content")} (Markdown)</Label> | 168 | <Label for="import-content">{t("form.content")} (Markdown)</Label> |
| 159 | <Textarea | 169 | <Textarea |
| 160 | id="import-content" | 170 | id="import-content" |
src/components/notes/podcast-panel.tsxmodified+4 -8
| @@ -168,14 +168,10 @@ export function PodcastPanel(props: { | |||
| 168 | } | 168 | } |
| 169 | > | 169 | > |
| 170 | <section class={props.flat ? "space-y-4" : "space-y-4 rounded-xl border border-border-line bg-surface-base p-3 sm:p-4"}> | 170 | <section class={props.flat ? "space-y-4" : "space-y-4 rounded-xl border border-border-line bg-surface-base p-3 sm:p-4"}> |
| 171 | - <div class="flex items-start gap-3"> | 171 | + {/* Same head as the AI summary section beside it: title over a one-line hint. */} |
| 172 | - <div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary-text"> | 172 | + <div> |
| 173 | - <IconWaveform class="h-5 w-5" /> | 173 | + <h3 class="text-sm font-semibold">{t("podcast.title")}</h3> |
| 174 | - </div> | 174 | + <p class="mt-0.5 text-xs text-muted-foreground">{t("podcast.description")}</p> |
| 175 | - <div> | ||
| 176 | - <h2 class="font-semibold">{t("podcast.title")}</h2> | ||
| 177 | - <p class="mt-0.5 text-sm text-muted-foreground">{t("podcast.description")}</p> | ||
| 178 | - </div> | ||
| 179 | </div> | 175 | </div> |
| 180 | 176 | ||
| 181 | <Show when={error()}>{(message) => <Alert variant="destructive">{message()}</Alert>}</Show> | 177 | <Show when={error()}>{(message) => <Alert variant="destructive">{message()}</Alert>}</Show> |
src/components/notes/rag-outputs-panel.tsxmodified+1 -1
| @@ -274,7 +274,7 @@ export function RagOutputsPanel(props: { | |||
| 274 | {(current) => ( | 274 | {(current) => ( |
| 275 | <article class="overflow-hidden rounded-lg border border-border/60 bg-background/50"> | 275 | <article class="overflow-hidden rounded-lg border border-border/60 bg-background/50"> |
| 276 | <header class="flex flex-wrap items-center justify-between gap-2 border-b border-border/60 px-3 py-2"> | 276 | <header class="flex flex-wrap items-center justify-between gap-2 border-b border-border/60 px-3 py-2"> |
| 277 | - <span class="text-xs font-semibold uppercase tracking-wide text-muted-foreground">{t("courseNotes.markdownPreview")}</span> | 277 | + <span class="text-xs font-semibold text-muted-foreground">{t("courseNotes.markdownPreview")}</span> |
| 278 | <span class="text-xs text-muted-foreground">{formatDateTime(current().generated_at, locale())}</span> | 278 | <span class="text-xs text-muted-foreground">{formatDateTime(current().generated_at, locale())}</span> |
| 279 | </header> | 279 | </header> |
| 280 | <div class="p-3 sm:p-4"> | 280 | <div class="p-3 sm:p-4"> |
src/components/pomodoro/pomodoro-log-view.tsxmodified+5 -7
| @@ -14,7 +14,7 @@ export function PomodoroLogView(props: { log: PomodoroLog }) { | |||
| 14 | { | 14 | { |
| 15 | accessorKey: "label", | 15 | accessorKey: "label", |
| 16 | header: t("pomodoro.sessionLabel"), | 16 | header: t("pomodoro.sessionLabel"), |
| 17 | - cell: (cell) => <span class="font-medium">{cell.row.original.label || "—"}</span>, | 17 | + cell: (cell) => <span class="font-medium">{cell.row.original.label}</span>, |
| 18 | }, | 18 | }, |
| 19 | { | 19 | { |
| 20 | accessorKey: "started_at", | 20 | accessorKey: "started_at", |
| @@ -35,12 +35,9 @@ export function PomodoroLogView(props: { log: PomodoroLog }) { | |||
| 35 | accessorKey: "counted", | 35 | accessorKey: "counted", |
| 36 | header: t("pomodoro.counted"), | 36 | header: t("pomodoro.counted"), |
| 37 | cell: (cell) => ( | 37 | cell: (cell) => ( |
| 38 | + // A null `counted` never reaches here: DataTable draws its empty dash. | ||
| 38 | <Badge variant={cell.row.original.counted ? "default" : "secondary"}> | 39 | <Badge variant={cell.row.original.counted ? "default" : "secondary"}> |
| 39 | - {cell.row.original.counted == null | 40 | + {cell.row.original.counted ? t("pomodoro.countedYes") : t("pomodoro.countedNo")} |
| 40 | - ? "—" | ||
| 41 | - : cell.row.original.counted | ||
| 42 | - ? t("pomodoro.countedYes") | ||
| 43 | - : t("pomodoro.countedNo")} | ||
| 44 | </Badge> | 41 | </Badge> |
| 45 | ), | 42 | ), |
| 46 | }, | 43 | }, |
| @@ -52,7 +49,8 @@ export function PomodoroLogView(props: { log: PomodoroLog }) { | |||
| 52 | <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("pomodoro.total")}</p> | 49 | <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("pomodoro.total")}</p> |
| 53 | <p class="mt-2 text-3xl font-semibold tabular-nums">{formatDurationClock(props.log.total_focus_ms)}</p> | 50 | <p class="mt-2 text-3xl font-semibold tabular-nums">{formatDurationClock(props.log.total_focus_ms)}</p> |
| 54 | </div> | 51 | </div> |
| 55 | - <DataTable columns={columns()} data={props.log.items} empty={t("pomodoro.empty")} enablePagination pageSize={10} /> | 52 | + {/* No search and no filters here, so no toolbar card holding only "Sütunlar". */} |
| 53 | + <DataTable columns={columns()} data={props.log.items} empty={t("pomodoro.empty")} enableColumnVisibility={false} enablePagination pageSize={10} /> | ||
| 56 | </div> | 54 | </div> |
| 57 | ); | 55 | ); |
| 58 | } | 56 | } |
src/components/question-generation/generated-question-card.tsxmodified+3 -3
| @@ -38,17 +38,17 @@ export function GeneratedQuestionCard(props: { | |||
| 38 | </div> | 38 | </div> |
| 39 | </Show> | 39 | </Show> |
| 40 | <div class="flex flex-wrap items-center gap-2"> | 40 | <div class="flex flex-wrap items-center gap-2"> |
| 41 | - <Button type="button" size="sm" variant="outline" class="h-8 rounded-lg" aria-expanded={open()} onClick={() => setOpen((value) => !value)}> | 41 | + <Button type="button" size="sm" variant="outline" class="h-8 rounded-lg touch:h-10" aria-expanded={open()} onClick={() => setOpen((value) => !value)}> |
| 42 | {open() ? t("qgen.hideAnswer") : t("qgen.showAnswer")} | 42 | {open() ? t("qgen.hideAnswer") : t("qgen.showAnswer")} |
| 43 | </Button> | 43 | </Button> |
| 44 | - <Button type="button" size="sm" variant="ghost" class="h-8 rounded-lg" onClick={() => void copy()}> | 44 | + <Button type="button" size="sm" variant="ghost" class="h-8 rounded-lg touch:h-10" onClick={() => void copy()}> |
| 45 | <Show when={copied()} fallback={<IconCopy class="h-3.5 w-3.5" />}> | 45 | <Show when={copied()} fallback={<IconCopy class="h-3.5 w-3.5" />}> |
| 46 | <IconCheck class="h-3.5 w-3.5" /> | 46 | <IconCheck class="h-3.5 w-3.5" /> |
| 47 | </Show> | 47 | </Show> |
| 48 | {copied() ? t("qgen.copied") : t("qgen.copy")} | 48 | {copied() ? t("qgen.copied") : t("qgen.copy")} |
| 49 | </Button> | 49 | </Button> |
| 50 | <Show when={props.onAddToBank}> | 50 | <Show when={props.onAddToBank}> |
| 51 | - <Button type="button" size="sm" variant="ghost" class="ml-auto h-8 rounded-lg" onClick={() => props.onAddToBank?.()}> | 51 | + <Button type="button" size="sm" variant="ghost" class="ml-auto h-8 rounded-lg touch:h-10" onClick={() => props.onAddToBank?.()}> |
| 52 | <IconPlus class="h-3.5 w-3.5" /> | 52 | <IconPlus class="h-3.5 w-3.5" /> |
| 53 | {t("qgen.addToBank")} | 53 | {t("qgen.addToBank")} |
| 54 | </Button> | 54 | </Button> |
src/components/rag/rag-composer.tsxmodified+1 -1
| @@ -52,7 +52,7 @@ export function RagComposer(props: { | |||
| 52 | value={props.value} | 52 | value={props.value} |
| 53 | disabled={props.disabled} | 53 | disabled={props.disabled} |
| 54 | placeholder={props.placeholder} | 54 | placeholder={props.placeholder} |
| 55 | - class="max-h-44 min-h-0 flex-1 resize-none overflow-y-auto border-0 bg-transparent px-0 py-1.5 text-base shadow-none hover:border-0 hover:bg-transparent focus:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0" | 55 | + class="max-h-44 min-h-0 flex-1 resize-none overflow-y-auto border-0 bg-transparent px-0 py-1.5 text-base shadow-none placeholder:truncate hover:border-0 hover:bg-transparent focus:bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0" |
| 56 | onInput={(event) => props.onInput(event.currentTarget.value)} | 56 | onInput={(event) => props.onInput(event.currentTarget.value)} |
| 57 | onKeyDown={(event) => { | 57 | onKeyDown={(event) => { |
| 58 | if (event.key === "Enter" && !event.shiftKey) { | 58 | if (event.key === "Enter" && !event.shiftKey) { |
src/components/rag/rag-copy.tsmodified+4 -0
| @@ -23,6 +23,8 @@ const copy = { | |||
| 23 | collapseHistory: "Hide chat history", | 23 | collapseHistory: "Hide chat history", |
| 24 | expandHistory: "Show chat history", | 24 | expandHistory: "Show chat history", |
| 25 | loadMore: "Show more", | 25 | loadMore: "Show more", |
| 26 | + threadsFailed: "Chats could not be loaded.", | ||
| 27 | + tryAgain: "Try again", | ||
| 26 | greetingMorning: "Good morning", | 28 | greetingMorning: "Good morning", |
| 27 | greetingAfternoon: "Good afternoon", | 29 | greetingAfternoon: "Good afternoon", |
| 28 | greetingEvening: "Good evening", | 30 | greetingEvening: "Good evening", |
| @@ -91,6 +93,8 @@ const copy = { | |||
| 91 | collapseHistory: "Sohbet geçmişini gizle", | 93 | collapseHistory: "Sohbet geçmişini gizle", |
| 92 | expandHistory: "Sohbet geçmişini göster", | 94 | expandHistory: "Sohbet geçmişini göster", |
| 93 | loadMore: "Daha fazla göster", | 95 | loadMore: "Daha fazla göster", |
| 96 | + threadsFailed: "Sohbetler yüklenemedi.", | ||
| 97 | + tryAgain: "Tekrar dene", | ||
| 94 | greetingMorning: "Günaydın", | 98 | greetingMorning: "Günaydın", |
| 95 | greetingAfternoon: "İyi günler", | 99 | greetingAfternoon: "İyi günler", |
| 96 | greetingEvening: "İyi akşamlar", | 100 | greetingEvening: "İyi akşamlar", |
src/components/rag/rag-message-row.tsxmodified+7 -2
| @@ -45,13 +45,18 @@ export function RagMessageRow(props: { | |||
| 45 | const copyable = () => assistant() && props.message.status === "complete" && !!props.message.content; | 45 | const copyable = () => assistant() && props.message.status === "complete" && !!props.message.content; |
| 46 | 46 | ||
| 47 | const copy = async () => { | 47 | const copy = async () => { |
| 48 | - await navigator.clipboard.writeText(props.message.content); | 48 | + try { |
| 49 | + await navigator.clipboard.writeText(props.message.content); | ||
| 50 | + } catch { | ||
| 51 | + // No clipboard permission (or an insecure origin): nothing to confirm. | ||
| 52 | + return; | ||
| 53 | + } | ||
| 49 | setCopied(true); | 54 | setCopied(true); |
| 50 | window.setTimeout(() => setCopied(false), 1_500); | 55 | window.setTimeout(() => setCopied(false), 1_500); |
| 51 | }; | 56 | }; |
| 52 | 57 | ||
| 53 | const iconButton = | 58 | const iconButton = |
| 54 | - "inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground outline-hidden transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"; | 59 | + "inline-flex h-10 w-10 items-center justify-center rounded-md text-muted-foreground sm:h-7 sm:w-7 touch:h-10 touch:w-10 outline-hidden transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring"; |
| 55 | 60 | ||
| 56 | return ( | 61 | return ( |
| 57 | // Vibe's turns: the question is a pill on the right; the answer runs the | 62 | // Vibe's turns: the question is a pill on the right; the answer runs the |
src/components/rag/rag-study-actions.tsxmodified+4 -3
| @@ -5,6 +5,7 @@ import { postRagQuestions, postRagSummarize } from "@/api/rag"; | |||
| 5 | import { CelebiMarkdown } from "@/components/layout/celebi-markdown"; | 5 | import { CelebiMarkdown } from "@/components/layout/celebi-markdown"; |
| 6 | import { Button } from "@/components/ui/button"; | 6 | import { Button } from "@/components/ui/button"; |
| 7 | import { Select } from "@/components/ui/select"; | 7 | import { Select } from "@/components/ui/select"; |
| 8 | +import { TOOLBAR_CONTROL } from "@/components/ui/data-toolbar"; | ||
| 8 | import type { ragCopy } from "@/components/rag/rag-copy"; | 9 | import type { ragCopy } from "@/components/rag/rag-copy"; |
| 9 | 10 | ||
| 10 | type Copy = ReturnType<typeof ragCopy>; | 11 | type Copy = ReturnType<typeof ragCopy>; |
| @@ -67,16 +68,16 @@ export function RagStudyActions(props: { | |||
| 67 | fallback={<p class="text-xs text-muted-foreground">{props.copy.studyUnavailable}</p>} | 68 | fallback={<p class="text-xs text-muted-foreground">{props.copy.studyUnavailable}</p>} |
| 68 | > | 69 | > |
| 69 | <div class="flex flex-wrap items-center gap-2"> | 70 | <div class="flex flex-wrap items-center gap-2"> |
| 70 | - <Button type="button" size="sm" variant="outline" class="h-8 rounded-lg" disabled={busy()} onClick={() => void summarize()}> | 71 | + <Button type="button" size="sm" variant="outline" class={`${TOOLBAR_CONTROL} px-3.5`} disabled={busy()} onClick={() => void summarize()}> |
| 71 | {props.copy.summarize} | 72 | {props.copy.summarize} |
| 72 | </Button> | 73 | </Button> |
| 73 | - <Button type="button" size="sm" variant="outline" class="h-8 rounded-lg" disabled={busy()} onClick={() => void practice()}> | 74 | + <Button type="button" size="sm" variant="outline" class={`${TOOLBAR_CONTROL} px-3.5`} disabled={busy()} onClick={() => void practice()}> |
| 74 | {props.copy.practice} | 75 | {props.copy.practice} |
| 75 | </Button> | 76 | </Button> |
| 76 | <Select | 77 | <Select |
| 77 | aria-label={props.copy.difficulty} | 78 | aria-label={props.copy.difficulty} |
| 78 | wrapperClass="w-auto" | 79 | wrapperClass="w-auto" |
| 79 | - class="h-8 rounded-lg text-[13px]" | 80 | + class={TOOLBAR_CONTROL} |
| 80 | value={difficulty()} | 81 | value={difficulty()} |
| 81 | onChange={(event) => setDifficulty(event.currentTarget.value as (typeof DIFFICULTIES)[number])} | 82 | onChange={(event) => setDifficulty(event.currentTarget.value as (typeof DIFFICULTIES)[number])} |
| 82 | > | 83 | > |
src/components/rag/rag-study-panel.tsxmodified+22 -3
| @@ -50,6 +50,9 @@ export function RagStudyPanel() { | |||
| 50 | const [sending, setSending] = createSignal(false); | 50 | const [sending, setSending] = createSignal(false); |
| 51 | const [error, setError] = createSignal(""); | 51 | const [error, setError] = createSignal(""); |
| 52 | const [studyUnavailable, setStudyUnavailable] = createSignal(false); | 52 | const [studyUnavailable, setStudyUnavailable] = createSignal(false); |
| 53 | + // An opened chat's transcript is on its way: without this the landing | ||
| 54 | + // greeting flashed in its place until the messages arrived. | ||
| 55 | + const [loadingThread, setLoadingThread] = createSignal(false); | ||
| 53 | const [renaming, setRenaming] = createSignal<RagThread | null>(null); | 56 | const [renaming, setRenaming] = createSignal<RagThread | null>(null); |
| 54 | const [removing, setRemoving] = createSignal<RagThread | null>(null); | 57 | const [removing, setRemoving] = createSignal<RagThread | null>(null); |
| 55 | // Below lg the history is a drawer from the left edge, the way a chat app | 58 | // Below lg the history is a drawer from the left edge, the way a chat app |
| @@ -160,11 +163,14 @@ export function RagStudyPanel() { | |||
| 160 | setThreadId(id); | 163 | setThreadId(id); |
| 161 | setActiveThread(knownThreads().find((thread) => thread.id === id)); | 164 | setActiveThread(knownThreads().find((thread) => thread.id === id)); |
| 162 | setMessages([]); | 165 | setMessages([]); |
| 166 | + setLoadingThread(true); | ||
| 163 | try { | 167 | try { |
| 164 | const page = await getRagThreadMessages(id, { limit: 500 }); | 168 | const page = await getRagThreadMessages(id, { limit: 500 }); |
| 165 | if (threadId() === id) setMessages(page.items); | 169 | if (threadId() === id) setMessages(page.items); |
| 166 | } catch (err) { | 170 | } catch (err) { |
| 167 | if (threadId() === id) setError(formatApiError(err)); | 171 | if (threadId() === id) setError(formatApiError(err)); |
| 172 | + } finally { | ||
| 173 | + if (threadId() === id) setLoadingThread(false); | ||
| 168 | } | 174 | } |
| 169 | }; | 175 | }; |
| 170 | const resetThread = () => { | 176 | const resetThread = () => { |
| @@ -174,6 +180,7 @@ export function RagStudyPanel() { | |||
| 174 | setThreadId(undefined); | 180 | setThreadId(undefined); |
| 175 | setActiveThread(undefined); | 181 | setActiveThread(undefined); |
| 176 | setMessages([]); | 182 | setMessages([]); |
| 183 | + setLoadingThread(false); | ||
| 177 | }; | 184 | }; |
| 178 | // The URL is the source of truth for which chat is open. A chat this panel | 185 | // The URL is the source of truth for which chat is open. A chat this panel |
| 179 | // just created is already open when its URL lands, so it is not reloaded. | 186 | // just created is already open when its URL lands, so it is not reloaded. |
| @@ -362,7 +369,10 @@ export function RagStudyPanel() { | |||
| 362 | <IconPlus class="h-4 w-4 shrink-0" /> | 369 | <IconPlus class="h-4 w-4 shrink-0" /> |
| 363 | <span class="truncate">{copy().newThread}</span> | 370 | <span class="truncate">{copy().newThread}</span> |
| 364 | </button> | 371 | </button> |
| 365 | - <h3 class="px-2.5 pb-0.5 pt-4 text-xs font-medium text-muted-foreground">{copy().recents}</h3> | 372 | + {/* No "Recents" heading over an empty list: the empty state says it. */} |
| 373 | + <Show when={knownThreads().length > 0}> | ||
| 374 | + <h3 class="px-2.5 pb-0.5 pt-4 text-xs font-medium text-muted-foreground">{copy().recents}</h3> | ||
| 375 | + </Show> | ||
| 366 | <RagThreadList | 376 | <RagThreadList |
| 367 | activeId={threadId()} | 377 | activeId={threadId()} |
| 368 | version={threadsVersion()} | 378 | version={threadsVersion()} |
| @@ -467,8 +477,16 @@ export function RagStudyPanel() { | |||
| 467 | <Show | 477 | <Show |
| 468 | when={messages().length > 0} | 478 | when={messages().length > 0} |
| 469 | fallback={ | 479 | fallback={ |
| 470 | - // The landing screen centres the mark and the composer instead of | 480 | + <Show |
| 471 | - // stranding the composer at the bottom of an empty page. | 481 | + when={!loadingThread()} |
| 482 | + fallback={ | ||
| 483 | + <p class="flex min-h-[60vh] items-center justify-center text-sm text-muted-foreground lg:min-h-[calc(100dvh-16rem)]" role="status"> | ||
| 484 | + {copy().loadingMessages} | ||
| 485 | + </p> | ||
| 486 | + } | ||
| 487 | + > | ||
| 488 | + {/* The landing screen centres the mark and the composer instead of | ||
| 489 | + stranding the composer at the bottom of an empty page. */} | ||
| 472 | <div class="flex min-h-[60vh] flex-col justify-center lg:min-h-[calc(100dvh-16rem)]"> | 490 | <div class="flex min-h-[60vh] flex-col justify-center lg:min-h-[calc(100dvh-16rem)]"> |
| 473 | <RagStudyWelcome title={greeting()} /> | 491 | <RagStudyWelcome title={greeting()} /> |
| 474 | <RagComposer | 492 | <RagComposer |
| @@ -483,6 +501,7 @@ export function RagStudyPanel() { | |||
| 483 | onSubmit={() => void send()} | 501 | onSubmit={() => void send()} |
| 484 | /> | 502 | /> |
| 485 | </div> | 503 | </div> |
| 504 | + </Show> | ||
| 486 | } | 505 | } |
| 487 | > | 506 | > |
| 488 | <For each={messages()}> | 507 | <For each={messages()}> |
src/components/rag/rag-thread-list.tsxmodified+20 -5
| @@ -26,6 +26,8 @@ export function RagThreadList(props: { | |||
| 26 | actions: string; | 26 | actions: string; |
| 27 | delete: string; | 27 | delete: string; |
| 28 | loadMore: string; | 28 | loadMore: string; |
| 29 | + threadsFailed: string; | ||
| 30 | + tryAgain: string; | ||
| 29 | groupToday: string; | 31 | groupToday: string; |
| 30 | groupYesterday: string; | 32 | groupYesterday: string; |
| 31 | groupThisWeek: string; | 33 | groupThisWeek: string; |
| @@ -38,7 +40,7 @@ export function RagThreadList(props: { | |||
| 38 | onRemove: (thread: RagThread) => void; | 40 | onRemove: (thread: RagThread) => void; |
| 39 | }) { | 41 | }) { |
| 40 | const [limit, setLimit] = createSignal(THREAD_PAGE_SIZE); | 42 | const [limit, setLimit] = createSignal(THREAD_PAGE_SIZE); |
| 41 | - const [threads] = createResource( | 43 | + const [threads, { refetch }] = createResource( |
| 42 | () => ({ limit: limit(), version: props.version }), | 44 | () => ({ limit: limit(), version: props.version }), |
| 43 | ({ limit }) => getRagThreads({ limit, offset: 0 }), | 45 | ({ limit }) => getRagThreads({ limit, offset: 0 }), |
| 44 | ); | 46 | ); |
| @@ -52,7 +54,20 @@ export function RagThreadList(props: { | |||
| 52 | }; | 54 | }; |
| 53 | return ( | 55 | return ( |
| 54 | <div class="min-h-0 flex-1 overflow-y-auto overscroll-contain"> | 56 | <div class="min-h-0 flex-1 overflow-y-auto overscroll-contain"> |
| 55 | - <Show when={threads.latest} fallback={<PageSpinner />}> | 57 | + {/* A failed first read used to spin forever: `latest` never arrives. */} |
| 58 | + <Show when={threads.error && !threads.latest}> | ||
| 59 | + <div class="space-y-2 px-2.5 py-6 text-center text-sm text-muted-foreground" role="alert"> | ||
| 60 | + <p>{props.labels.threadsFailed}</p> | ||
| 61 | + <button | ||
| 62 | + type="button" | ||
| 63 | + class="inline-flex h-10 items-center rounded-full border border-border-line px-3.5 text-[13px] font-medium text-foreground outline-hidden transition-colors hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring lg:h-8 touch:h-10" | ||
| 64 | + onClick={() => void refetch()} | ||
| 65 | + > | ||
| 66 | + {props.labels.tryAgain} | ||
| 67 | + </button> | ||
| 68 | + </div> | ||
| 69 | + </Show> | ||
| 70 | + <Show when={threads.latest} fallback={<Show when={!threads.error}><PageSpinner /></Show>}> | ||
| 56 | {(result) => ( | 71 | {(result) => ( |
| 57 | <Show | 72 | <Show |
| 58 | when={result().items.length > 0} | 73 | when={result().items.length > 0} |
| @@ -73,7 +88,7 @@ export function RagThreadList(props: { | |||
| 73 | <button | 88 | <button |
| 74 | type="button" | 89 | type="button" |
| 75 | class={cn( | 90 | class={cn( |
| 76 | - "min-w-0 flex-1 truncate rounded-lg py-1.5 pl-2.5 pr-8 text-left text-sm outline-hidden focus-visible:ring-2 focus-visible:ring-ring", | 91 | + "min-w-0 flex-1 truncate rounded-lg py-2.5 pl-2.5 pr-10 text-left text-sm lg:py-1.5 lg:pr-8 touch:py-2.5 outline-hidden focus-visible:ring-2 focus-visible:ring-ring", |
| 77 | active() ? "font-medium text-foreground" : "text-foreground/85", | 92 | active() ? "font-medium text-foreground" : "text-foreground/85", |
| 78 | )} | 93 | )} |
| 79 | title={thread.title || props.labels.untitled} | 94 | title={thread.title || props.labels.untitled} |
| @@ -84,7 +99,7 @@ export function RagThreadList(props: { | |||
| 84 | {/* The row menu shows on hover, on keyboard focus and on the open chat. */} | 99 | {/* The row menu shows on hover, on keyboard focus and on the open chat. */} |
| 85 | <div | 100 | <div |
| 86 | class={cn( | 101 | class={cn( |
| 87 | - "absolute right-1 top-1/2 -translate-y-1/2 transition-opacity focus-within:opacity-100 group-hover:opacity-100 [@media(pointer:coarse)]:opacity-100", | 102 | + "absolute right-0 top-1/2 -translate-y-1/2 transition-opacity lg:right-1 [&_[data-row-actions-trigger]]:size-10 lg:[&_[data-row-actions-trigger]]:size-7 touch:[&_[data-row-actions-trigger]]:size-10 focus-within:opacity-100 group-hover:opacity-100 [@media(pointer:coarse)]:opacity-100", |
| 88 | active() ? "opacity-100" : "opacity-0", | 103 | active() ? "opacity-100" : "opacity-0", |
| 89 | )} | 104 | )} |
| 90 | > | 105 | > |
| @@ -105,7 +120,7 @@ export function RagThreadList(props: { | |||
| 105 | <Show when={hasMore()}> | 120 | <Show when={hasMore()}> |
| 106 | <button | 121 | <button |
| 107 | type="button" | 122 | type="button" |
| 108 | - class="mt-1 w-full rounded-lg px-2.5 py-1.5 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground disabled:opacity-50" | 123 | + class="mt-1 h-10 w-full rounded-lg px-2.5 text-left text-xs font-medium text-muted-foreground outline-hidden transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50 lg:h-8 touch:h-10" |
| 109 | disabled={threads.loading} | 124 | disabled={threads.loading} |
| 110 | onClick={() => setLimit((value) => Math.min(THREAD_PAGE_MAX, value + THREAD_PAGE_SIZE))} | 125 | onClick={() => setLimit((value) => Math.min(THREAD_PAGE_MAX, value + THREAD_PAGE_SIZE))} |
| 111 | > | 126 | > |
src/components/sessions/course-sessions-panel.tsxmodified+22 -13
| @@ -213,7 +213,14 @@ export function CourseSessionsPanel(props: { | |||
| 213 | }; | 213 | }; |
| 214 | 214 | ||
| 215 | const panelOpen = () => props.createOpen || editingSession() != null; | 215 | const panelOpen = () => props.createOpen || editingSession() != null; |
| 216 | - createEffect(() => props.onCountChange(sessions()?.length ?? 0)); | 216 | + // Report a count only once the list has loaded (and not after a failed |
| 217 | + // read): the tab badge must not claim "0" while the lessons are loading. | ||
| 218 | + createEffect(() => { | ||
| 219 | + if (sessions.error) return; | ||
| 220 | + const list = sessions.latest; | ||
| 221 | + if (list) props.onCountChange(list.length); | ||
| 222 | + }); | ||
| 223 | + const rows = () => (sessions.error ? [] : sessions() ?? []); | ||
| 217 | const columns = createMemo<ColumnDef<CourseSession>[]>(() => [ | 224 | const columns = createMemo<ColumnDef<CourseSession>[]>(() => [ |
| 218 | { | 225 | { |
| 219 | accessorKey: "topic", | 226 | accessorKey: "topic", |
| @@ -276,13 +283,13 @@ export function CourseSessionsPanel(props: { | |||
| 276 | <Show when={sessions.error}> | 283 | <Show when={sessions.error}> |
| 277 | <ErrorAlert message={formatApiError(sessions.error)} onRetry={() => void refetch()} /> | 284 | <ErrorAlert message={formatApiError(sessions.error)} onRetry={() => void refetch()} /> |
| 278 | </Show> | 285 | </Show> |
| 286 | + <Show when={!sessions.error}> | ||
| 279 | <DataTable | 287 | <DataTable |
| 280 | columns={columns()} | 288 | columns={columns()} |
| 281 | - data={sessions() ?? []} | 289 | + data={rows()} |
| 282 | filterColumn="topic" | 290 | filterColumn="topic" |
| 291 | + filterHint={t("search.hint.sessions")} | ||
| 283 | storageKey={`instance-sessions-${props.instanceId}`} | 292 | storageKey={`instance-sessions-${props.instanceId}`} |
| 284 | - enablePagination | ||
| 285 | - pageSize={10} | ||
| 286 | empty={t("sessions.empty")} | 293 | empty={t("sessions.empty")} |
| 287 | onRowClick={setDetailSession} | 294 | onRowClick={setDetailSession} |
| 288 | actions={props.canManage ? ( | 295 | actions={props.canManage ? ( |
| @@ -291,6 +298,7 @@ export function CourseSessionsPanel(props: { | |||
| 291 | </Button> | 298 | </Button> |
| 292 | ) : undefined} | 299 | ) : undefined} |
| 293 | /> | 300 | /> |
| 301 | + </Show> | ||
| 294 | </Suspense> | 302 | </Suspense> |
| 295 | 303 | ||
| 296 | <SidePanel guardUnsaved | 304 | <SidePanel guardUnsaved |
| @@ -333,23 +341,27 @@ export function CourseSessionsPanel(props: { | |||
| 333 | <div class="space-y-1.5"> | 341 | <div class="space-y-1.5"> |
| 334 | <Label for="session-starts">{t("events.starts")}</Label> | 342 | <Label for="session-starts">{t("events.starts")}</Label> |
| 335 | <div class="grid grid-cols-2 gap-2"> | 343 | <div class="grid grid-cols-2 gap-2"> |
| 336 | - <DatePicker id="session-starts" class="h-10" placeholder={t("form.datePlaceholder")} value={startsDate()} required onChange={setStartsDate} /> | 344 | + <DatePicker id="session-starts" class="h-9" placeholder={t("form.datePlaceholder")} value={startsDate()} required onChange={setStartsDate} /> |
| 337 | - <Input class="h-10 rounded-sm font-mono placeholder:text-muted-foreground/35" placeholder="09:00" value={startsTime()} required onInput={(e) => setStartsTime(e.currentTarget.value)} /> | 345 | + <Input class="h-9 font-mono placeholder:text-muted-foreground/45" inputMode="numeric" placeholder="09:00" aria-label={t("appointments.startTime")} value={startsTime()} required onInput={(e) => setStartsTime(e.currentTarget.value)} /> |
| 338 | </div> | 346 | </div> |
| 339 | </div> | 347 | </div> |
| 340 | <div class="space-y-1.5"> | 348 | <div class="space-y-1.5"> |
| 341 | <Label for="session-ends">{t("events.ends")}</Label> | 349 | <Label for="session-ends">{t("events.ends")}</Label> |
| 342 | <div class="grid grid-cols-2 gap-2"> | 350 | <div class="grid grid-cols-2 gap-2"> |
| 343 | - <DatePicker id="session-ends" class="h-10" placeholder={t("form.datePlaceholder")} value={endsDate()} onChange={setEndsDate} /> | 351 | + <DatePicker id="session-ends" class="h-9" placeholder={t("form.datePlaceholder")} value={endsDate()} onChange={setEndsDate} /> |
| 344 | - <Input class="h-10 rounded-sm font-mono placeholder:text-muted-foreground/35" placeholder="10:00" value={endsTime()} onInput={(e) => setEndsTime(e.currentTarget.value)} /> | 352 | + <Input class="h-9 font-mono placeholder:text-muted-foreground/45" inputMode="numeric" placeholder="10:00" aria-label={t("appointments.endTime")} value={endsTime()} onInput={(e) => setEndsTime(e.currentTarget.value)} /> |
| 345 | </div> | 353 | </div> |
| 346 | </div> | 354 | </div> |
| 347 | </div> | 355 | </div> |
| 348 | <div class="flex flex-wrap items-center gap-2"> | 356 | <div class="flex flex-wrap items-center gap-2"> |
| 357 | + {/* Submit first, as in every other panel form of the course pages. */} | ||
| 358 | + <Button type="submit" class="rounded-lg" disabled={pending()}> | ||
| 359 | + {editingSession() ? t("common.update") : t("sessions.add")} | ||
| 360 | + </Button> | ||
| 349 | <Button | 361 | <Button |
| 350 | type="button" | 362 | type="button" |
| 351 | variant="outline" | 363 | variant="outline" |
| 352 | - class="h-10 rounded-lg" | 364 | + class="rounded-lg" |
| 353 | onClick={() => { | 365 | onClick={() => { |
| 354 | props.onCreateOpenChange(false); | 366 | props.onCreateOpenChange(false); |
| 355 | resetForm(); | 367 | resetForm(); |
| @@ -357,9 +369,6 @@ export function CourseSessionsPanel(props: { | |||
| 357 | > | 369 | > |
| 358 | {t("common.cancel")} | 370 | {t("common.cancel")} |
| 359 | </Button> | 371 | </Button> |
| 360 | - <Button type="submit" class="h-10 rounded-lg" disabled={pending()}> | ||
| 361 | - {editingSession() ? t("common.update") : t("sessions.add")} | ||
| 362 | - </Button> | ||
| 363 | </div> | 372 | </div> |
| 364 | </form> | 373 | </form> |
| 365 | </SidePanel> | 374 | </SidePanel> |
| @@ -378,7 +387,7 @@ export function CourseSessionsPanel(props: { | |||
| 378 | <DetailField label={t("events.starts")} value={formatDateTime(session.starts_at, locale())} /> | 387 | <DetailField label={t("events.starts")} value={formatDateTime(session.starts_at, locale())} /> |
| 379 | <DetailField label={t("events.ends")} value={formatDateTime(session.ends_at, locale())} /> | 388 | <DetailField label={t("events.ends")} value={formatDateTime(session.ends_at, locale())} /> |
| 380 | <Show when={props.canManage}> | 389 | <Show when={props.canManage}> |
| 381 | - <DetailField label={t("attendance.title")} value={`${detailAttendance()?.length ?? 0} / ${attendanceTargetCount(session)}`} /> | 390 | + <DetailField label={t("attendance.title")} value={detailAttendance.loading || detailAttendance.error ? "—" : `${detailAttendance()?.length ?? 0} / ${attendanceTargetCount(session)}`} /> |
| 382 | </Show> | 391 | </Show> |
| 383 | </div> | 392 | </div> |
| 384 | <Show when={props.canManage}> | 393 | <Show when={props.canManage}> |
src/components/sessions/session-roll-call.tsxmodified+16 -10
| @@ -8,6 +8,7 @@ import { Alert } from "@/components/ui/alert"; | |||
| 8 | import { Badge } from "@/components/ui/badge"; | 8 | import { Badge } from "@/components/ui/badge"; |
| 9 | import { Button } from "@/components/ui/button"; | 9 | import { Button } from "@/components/ui/button"; |
| 10 | import { EmptyState } from "@/components/ui/empty-state"; | 10 | import { EmptyState } from "@/components/ui/empty-state"; |
| 11 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 11 | import { IconCheck, IconX } from "@/components/ui/icons"; | 12 | import { IconCheck, IconX } from "@/components/ui/icons"; |
| 12 | import { ATTENDANCE_STATUSES, getAttendanceStatusMeta } from "@/lib/attendance-status"; | 13 | import { ATTENDANCE_STATUSES, getAttendanceStatusMeta } from "@/lib/attendance-status"; |
| 13 | import { cn } from "@/lib/cn"; | 14 | import { cn } from "@/lib/cn"; |
| @@ -39,10 +40,10 @@ export function SessionRollCall(props: { | |||
| 39 | // The school's statuses in its own order, except "present" leads: it is | 40 | // The school's statuses in its own order, except "present" leads: it is |
| 40 | // the one a teacher taps most, so it sits first on every row. | 41 | // the one a teacher taps most, so it sits first on every row. |
| 41 | const statuses = createMemo<AttendanceStatus[]>(() => { | 42 | const statuses = createMemo<AttendanceStatus[]>(() => { |
| 42 | - const list = settings.latest?.attendance_statuses ?? ATTENDANCE_STATUSES.map((item) => item.value); | 43 | + const list = (settings.error ? undefined : settings.latest)?.attendance_statuses ?? ATTENDANCE_STATUSES.map((item) => item.value); |
| 43 | return list.includes("present") ? ["present", ...list.filter((status) => status !== "present")] : list; | 44 | return list.includes("present") ? ["present", ...list.filter((status) => status !== "present")] : list; |
| 44 | }); | 45 | }); |
| 45 | - const [attendance] = createResource( | 46 | + const [attendance, { refetch: refetchAttendance }] = createResource( |
| 46 | () => props.sessionId, | 47 | () => props.sessionId, |
| 47 | async (sessionId) => (await getSessionAttendance(sessionId)).items, | 48 | async (sessionId) => (await getSessionAttendance(sessionId)).items, |
| 48 | ); | 49 | ); |
| @@ -50,6 +51,8 @@ export function SessionRollCall(props: { | |||
| 50 | // updates it optimistically instead of refetching the whole roster. | 51 | // updates it optimistically instead of refetching the whole roster. |
| 51 | const [marks, setMarks] = createSignal<Record<string, AttendanceStatus>>({}); | 52 | const [marks, setMarks] = createSignal<Record<string, AttendanceStatus>>({}); |
| 52 | createEffect(() => { | 53 | createEffect(() => { |
| 54 | + // An errored read throws on access; the ErrorAlert below offers a retry. | ||
| 55 | + if (attendance.error) return; | ||
| 53 | const rows = attendance.latest; | 56 | const rows = attendance.latest; |
| 54 | if (rows) setMarks(Object.fromEntries(rows.map((row) => [row.user.id, row.status]))); | 57 | if (rows) setMarks(Object.fromEntries(rows.map((row) => [row.user.id, row.status]))); |
| 55 | }); | 58 | }); |
| @@ -57,7 +60,7 @@ export function SessionRollCall(props: { | |||
| 57 | // The roster renders from props at once, but the saved marks arrive with | 60 | // The roster renders from props at once, but the saved marks arrive with |
| 58 | // the attendance read; a tap before then would be overwritten by it, so | 61 | // the attendance read; a tap before then would be overwritten by it, so |
| 59 | // the status buttons wait for it. | 62 | // the status buttons wait for it. |
| 60 | - const ready = () => attendance.latest !== undefined; | 63 | + const ready = () => !attendance.error && attendance.latest !== undefined; |
| 61 | const targets = createMemo<RollCallTarget[]>(() => [ | 64 | const targets = createMemo<RollCallTarget[]>(() => [ |
| 62 | ...props.roster.map((row) => ({ user: row.user, isTeacher: false })), | 65 | ...props.roster.map((row) => ({ user: row.user, isTeacher: false })), |
| 63 | ...(props.canMarkTeacher && !props.roster.some((row) => row.user.id === props.teacher.id) | 66 | ...(props.canMarkTeacher && !props.roster.some((row) => row.user.id === props.teacher.id) |
| @@ -166,6 +169,9 @@ export function SessionRollCall(props: { | |||
| 166 | <Show when={error()}> | 169 | <Show when={error()}> |
| 167 | <Alert variant="destructive">{error()}</Alert> | 170 | <Alert variant="destructive">{error()}</Alert> |
| 168 | </Show> | 171 | </Show> |
| 172 | + <Show when={attendance.error}> | ||
| 173 | + <ErrorAlert message={formatApiError(attendance.error)} onRetry={() => void refetchAttendance()} /> | ||
| 174 | + </Show> | ||
| 169 | <Show | 175 | <Show |
| 170 | when={targets().length > 0} | 176 | when={targets().length > 0} |
| 171 | fallback={<EmptyState kind="people" title={t("sessions.emptyRoster")} />} | 177 | fallback={<EmptyState kind="people" title={t("sessions.emptyRoster")} />} |
| @@ -173,7 +179,7 @@ export function SessionRollCall(props: { | |||
| 173 | <div class="sticky top-0 z-10 -mx-5 space-y-2.5 border-b border-border-hairline bg-surface-base px-5 pb-3"> | 179 | <div class="sticky top-0 z-10 -mx-5 space-y-2.5 border-b border-border-hairline bg-surface-base px-5 pb-3"> |
| 174 | <div class="flex items-center justify-between gap-3"> | 180 | <div class="flex items-center justify-between gap-3"> |
| 175 | <p class="text-sm font-semibold text-text-strong" role="status"> | 181 | <p class="text-sm font-semibold text-text-strong" role="status"> |
| 176 | - {ready() ? t("rollCall.progress", { marked: markedCount(), total: targets().length }) : t("common.loading")} | 182 | + {ready() ? t("rollCall.progress", { marked: markedCount(), total: targets().length }) : attendance.error ? "—" : t("common.loading")} |
| 177 | </p> | 183 | </p> |
| 178 | <div class="flex flex-wrap justify-end gap-1.5"> | 184 | <div class="flex flex-wrap justify-end gap-1.5"> |
| 179 | <For each={statuses()}> | 185 | <For each={statuses()}> |
| @@ -198,7 +204,7 @@ export function SessionRollCall(props: { | |||
| 198 | type="button" | 204 | type="button" |
| 199 | size="sm" | 205 | size="sm" |
| 200 | variant={studentsLeft() > 0 || bulk() ? "default" : "outline"} | 206 | variant={studentsLeft() > 0 || bulk() ? "default" : "outline"} |
| 201 | - class="h-9 rounded-lg" | 207 | + class="h-10 rounded-lg sm:h-9 touch:h-10" |
| 202 | disabled={!ready() || bulk() != null || studentsLeft() === 0} | 208 | disabled={!ready() || bulk() != null || studentsLeft() === 0} |
| 203 | onClick={() => void markRestPresent()} | 209 | onClick={() => void markRestPresent()} |
| 204 | > | 210 | > |
| @@ -213,7 +219,7 @@ export function SessionRollCall(props: { | |||
| 213 | type="button" | 219 | type="button" |
| 214 | size="sm" | 220 | size="sm" |
| 215 | variant="outline" | 221 | variant="outline" |
| 216 | - class="h-9 rounded-lg" | 222 | + class="h-10 rounded-lg sm:h-9 touch:h-10" |
| 217 | aria-pressed={onlyUnmarked()} | 223 | aria-pressed={onlyUnmarked()} |
| 218 | onClick={() => setOnlyUnmarked((value) => !value)} | 224 | onClick={() => setOnlyUnmarked((value) => !value)} |
| 219 | > | 225 | > |
| @@ -250,7 +256,7 @@ export function SessionRollCall(props: { | |||
| 250 | </Show> | 256 | </Show> |
| 251 | </div> | 257 | </div> |
| 252 | <div class="flex items-center gap-1.5"> | 258 | <div class="flex items-center gap-1.5"> |
| 253 | - <div role="radiogroup" aria-label={groupLabel()} class="grid flex-1 grid-cols-4 gap-1 sm:flex sm:flex-none"> | 259 | + <div role="radiogroup" aria-label={groupLabel()} class="flex min-w-0 flex-1 gap-1 sm:flex-none"> |
| 254 | <For each={statuses()}> | 260 | <For each={statuses()}> |
| 255 | {(status) => { | 261 | {(status) => { |
| 256 | const selected = () => current() === status; | 262 | const selected = () => current() === status; |
| @@ -261,7 +267,7 @@ export function SessionRollCall(props: { | |||
| 261 | aria-checked={selected()} | 267 | aria-checked={selected()} |
| 262 | disabled={!ready() || busy() || bulk() != null} | 268 | disabled={!ready() || busy() || bulk() != null} |
| 263 | class={cn( | 269 | class={cn( |
| 264 | - "h-9 min-w-0 rounded-lg border px-2.5 text-xs font-semibold transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60", | 270 | + "h-10 min-w-0 flex-1 truncate rounded-lg border px-1 text-xs sm:h-9 sm:px-2.5 sm:flex-none touch:h-10 font-semibold transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-60", |
| 265 | selected() | 271 | selected() |
| 266 | ? getAttendanceStatusMeta(status)?.class ?? "border-primary bg-primary/10 text-primary-text" | 272 | ? getAttendanceStatusMeta(status)?.class ?? "border-primary bg-primary/10 text-primary-text" |
| 267 | : "border-border-line bg-surface-base text-muted-foreground hover:bg-muted/60 hover:text-foreground", | 273 | : "border-border-line bg-surface-base text-muted-foreground hover:bg-muted/60 hover:text-foreground", |
| @@ -278,8 +284,8 @@ export function SessionRollCall(props: { | |||
| 278 | type="button" | 284 | type="button" |
| 279 | variant="ghost" | 285 | variant="ghost" |
| 280 | size="icon" | 286 | size="icon" |
| 281 | - class={cn("h-9 w-9 shrink-0 text-muted-foreground", !current() && "invisible")} | 287 | + class={cn("h-10 w-10 shrink-0 text-muted-foreground sm:h-9 sm:w-9 touch:h-10 touch:w-10", !current() && "invisible")} |
| 282 | - aria-label={t("rollCall.clear")} | 288 | + aria-label={`${t("rollCall.clear")}: ${groupLabel()}`} |
| 283 | disabled={busy() || !current()} | 289 | disabled={busy() || !current()} |
| 284 | onClick={() => void clear(target.user.id)} | 290 | onClick={() => void clear(target.user.id)} |
| 285 | > | 291 | > |
src/components/system/not-found-page.tsxmodified+4 -3
| @@ -1,9 +1,10 @@ | |||
| 1 | import { Link } from "@tanstack/solid-router"; | 1 | import { Link } from "@tanstack/solid-router"; |
| 2 | -import { Button } from "@/components/ui/button"; | 2 | +import { Button, buttonVariants } from "@/components/ui/button"; |
| 3 | import { EmptyState } from "@/components/ui/empty-state"; | 3 | import { EmptyState } from "@/components/ui/empty-state"; |
| 4 | import { IconChevronLeft, IconHome } from "@/components/ui/icons"; | 4 | import { IconChevronLeft, IconHome } from "@/components/ui/icons"; |
| 5 | import { PAGE_STATE_CARD, PageCenter } from "@/components/layout/page-center"; | 5 | import { PAGE_STATE_CARD, PageCenter } from "@/components/layout/page-center"; |
| 6 | import { useGoBack } from "@/lib/use-go-back"; | 6 | import { useGoBack } from "@/lib/use-go-back"; |
| 7 | +import { cn } from "@/lib/cn"; | ||
| 7 | import { useT } from "@/stores/preferences-context"; | 8 | import { useT } from "@/stores/preferences-context"; |
| 8 | 9 | ||
| 9 | /** The router's 404: same centered, illustrated card as a missing record. */ | 10 | /** The router's 404: same centered, illustrated card as a missing record. */ |
| @@ -21,13 +22,13 @@ export function NotFoundPage() { | |||
| 21 | description={t("errors.notFoundDescription")} | 22 | description={t("errors.notFoundDescription")} |
| 22 | action={ | 23 | action={ |
| 23 | <div class="flex flex-wrap items-center justify-center gap-2"> | 24 | <div class="flex flex-wrap items-center justify-center gap-2"> |
| 24 | - <Button type="button" variant="outline" size="sm" class="h-9 rounded-lg px-4" onClick={goBack}> | 25 | + <Button type="button" variant="outline" size="sm" class="h-9 rounded-lg px-4 text-sm" onClick={goBack}> |
| 25 | <IconChevronLeft class="mr-1 h-4 w-4" /> | 26 | <IconChevronLeft class="mr-1 h-4 w-4" /> |
| 26 | {t("common.back")} | 27 | {t("common.back")} |
| 27 | </Button> | 28 | </Button> |
| 28 | <Link | 29 | <Link |
| 29 | to="/" | 30 | to="/" |
| 30 | - class="inline-flex h-9 items-center justify-center gap-1.5 whitespace-nowrap rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90" | 31 | + class={cn(buttonVariants(), "h-9 px-4")} |
| 31 | > | 32 | > |
| 32 | <IconHome class="mr-1 h-4 w-4" /> | 33 | <IconHome class="mr-1 h-4 w-4" /> |
| 33 | {t("common.goHome")} | 34 | {t("common.goHome")} |
src/components/ui/chart-line.tsxmodified+33 -15
| @@ -1,4 +1,4 @@ | |||
| 1 | -import { For, Show, createMemo, type Component } from "solid-js"; | 1 | +import { For, Show, createMemo, createSignal, onCleanup, type Component } from "solid-js"; |
| 2 | import { cn } from "@/lib/cn"; | 2 | import { cn } from "@/lib/cn"; |
| 3 | import { usePreferences } from "@/stores/preferences-context"; | 3 | import { usePreferences } from "@/stores/preferences-context"; |
| 4 | import { formatDecimal } from "@/lib/format"; | 4 | import { formatDecimal } from "@/lib/format"; |
| @@ -20,7 +20,13 @@ export type ChartLineProps = { | |||
| 20 | class?: string; | 20 | class?: string; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | -const VIEW_WIDTH = 720; | 23 | +// The drawing is laid out in real pixels: the viewBox follows the measured |
| 24 | +// width, so a wide card is filled edge to edge (a fixed 720-wide viewBox in a | ||
| 25 | +// 240px-tall box letterboxed it) and axis text keeps its 11px size. | ||
| 26 | +const DEFAULT_VIEW_WIDTH = 720; | ||
| 27 | +const MIN_VIEW_WIDTH = 260; | ||
| 28 | +// Room one x-axis caption needs, so a phone gets fewer ticks, not overlaps. | ||
| 29 | +const TICK_SLOT = 96; | ||
| 24 | const VIEW_HEIGHT = 240; | 30 | const VIEW_HEIGHT = 240; |
| 25 | const PADDING = { top: 18, right: 18, bottom: 34, left: 38 }; | 31 | const PADDING = { top: 18, right: 18, bottom: 34, left: 38 }; |
| 26 | const Y_TICKS = [0, 25, 50, 75, 100]; | 32 | const Y_TICKS = [0, 25, 50, 75, 100]; |
| @@ -34,12 +40,22 @@ export const ChartLine: Component<ChartLineProps> = (props) => { | |||
| 34 | const maxValue = () => props.maxScale != null && props.maxScale > 0 | 40 | const maxValue = () => props.maxScale != null && props.maxScale > 0 |
| 35 | ? props.maxScale | 41 | ? props.maxScale |
| 36 | : Math.max(...props.items.map((item) => item.value), 1); | 42 | : Math.max(...props.items.map((item) => item.value), 1); |
| 37 | - const plotWidth = VIEW_WIDTH - PADDING.left - PADDING.right; | 43 | + const [viewWidth, setViewWidth] = createSignal(DEFAULT_VIEW_WIDTH); |
| 44 | + const observeWidth = (el: HTMLDivElement) => { | ||
| 45 | + if (typeof ResizeObserver === "undefined") return; | ||
| 46 | + const observer = new ResizeObserver((entries) => { | ||
| 47 | + const width = Math.round(entries[0]?.contentRect.width ?? 0); | ||
| 48 | + if (width > 0) setViewWidth(Math.max(MIN_VIEW_WIDTH, width)); | ||
| 49 | + }); | ||
| 50 | + observer.observe(el); | ||
| 51 | + onCleanup(() => observer.disconnect()); | ||
| 52 | + }; | ||
| 53 | + const plotWidth = () => viewWidth() - PADDING.left - PADDING.right; | ||
| 38 | const plotHeight = VIEW_HEIGHT - PADDING.top - PADDING.bottom; | 54 | const plotHeight = VIEW_HEIGHT - PADDING.top - PADDING.bottom; |
| 39 | const pointFor = (item: ChartLineItem, index: number) => { | 55 | const pointFor = (item: ChartLineItem, index: number) => { |
| 40 | const x = props.items.length === 1 | 56 | const x = props.items.length === 1 |
| 41 | - ? PADDING.left + plotWidth / 2 | 57 | + ? PADDING.left + plotWidth() / 2 |
| 42 | - : PADDING.left + (index / (props.items.length - 1)) * plotWidth; | 58 | + : PADDING.left + (index / (props.items.length - 1)) * plotWidth(); |
| 43 | const y = PADDING.top + (1 - Math.min(1, Math.max(0, item.value / maxValue()))) * plotHeight; | 59 | const y = PADDING.top + (1 - Math.min(1, Math.max(0, item.value / maxValue()))) * plotHeight; |
| 44 | return { x, y }; | 60 | return { x, y }; |
| 45 | }; | 61 | }; |
| @@ -50,7 +66,7 @@ export const ChartLine: Component<ChartLineProps> = (props) => { | |||
| 50 | const areaPoints = createMemo(() => { | 66 | const areaPoints = createMemo(() => { |
| 51 | if (props.items.length < 2) return ""; | 67 | if (props.items.length < 2) return ""; |
| 52 | const baseline = PADDING.top + plotHeight; | 68 | const baseline = PADDING.top + plotHeight; |
| 53 | - return `${PADDING.left},${baseline} ${points()} ${PADDING.left + plotWidth},${baseline}`; | 69 | + return `${PADDING.left},${baseline} ${points()} ${PADDING.left + plotWidth()},${baseline}`; |
| 54 | }); | 70 | }); |
| 55 | const summary = createMemo(() => { | 71 | const summary = createMemo(() => { |
| 56 | if (props.items.length === 0) return null; | 72 | if (props.items.length === 0) return null; |
| @@ -64,7 +80,8 @@ export const ChartLine: Component<ChartLineProps> = (props) => { | |||
| 64 | }); | 80 | }); |
| 65 | const xTickIndexes = createMemo(() => { | 81 | const xTickIndexes = createMemo(() => { |
| 66 | if (props.items.length <= 1) return [0]; | 82 | if (props.items.length <= 1) return [0]; |
| 67 | - const step = Math.max(1, Math.ceil((props.items.length - 1) / 5)); | 83 | + const slots = Math.max(1, Math.min(5, Math.floor(plotWidth() / TICK_SLOT))); |
| 84 | + const step = Math.max(1, Math.ceil((props.items.length - 1) / slots)); | ||
| 68 | const indexes = Array.from({ length: props.items.length }, (_, index) => index) | 85 | const indexes = Array.from({ length: props.items.length }, (_, index) => index) |
| 69 | .filter((index) => index % step === 0); | 86 | .filter((index) => index % step === 0); |
| 70 | if (indexes[indexes.length - 1] !== props.items.length - 1) indexes.push(props.items.length - 1); | 87 | if (indexes[indexes.length - 1] !== props.items.length - 1) indexes.push(props.items.length - 1); |
| @@ -118,12 +135,13 @@ export const ChartLine: Component<ChartLineProps> = (props) => { | |||
| 118 | </div> | 135 | </div> |
| 119 | </dl> | 136 | </dl> |
| 120 | 137 | ||
| 121 | - {/* The floor only keeps axis text legible on a phone: at 640px it | 138 | + {/* Fits any width: the viewBox follows the box and a narrow |
| 122 | - forced a sideways scroller into the card on a 1280px screen. */} | 139 | + screen gets fewer x ticks, so a phone needs no sideways |
| 123 | - <div class="overflow-x-auto pb-1"> | 140 | + scroller (a 480px floor cut the line with no scroll cue). */} |
| 141 | + <div ref={observeWidth} class="pb-1"> | ||
| 124 | <svg | 142 | <svg |
| 125 | - class="h-60 min-w-[480px] w-full" | 143 | + class="h-60 w-full" |
| 126 | - viewBox={`0 0 ${VIEW_WIDTH} ${VIEW_HEIGHT}`} | 144 | + viewBox={`0 0 ${viewWidth()} ${VIEW_HEIGHT}`} |
| 127 | role="img" | 145 | role="img" |
| 128 | aria-label={props.items.map((item) => `${item.label}${item.caption ? ` (${item.caption})` : ""}: ${item.formattedValue ?? item.value}`).join(", ")} | 146 | aria-label={props.items.map((item) => `${item.label}${item.caption ? ` (${item.caption})` : ""}: ${item.formattedValue ?? item.value}`).join(", ")} |
| 129 | > | 147 | > |
| @@ -132,7 +150,7 @@ export const ChartLine: Component<ChartLineProps> = (props) => { | |||
| 132 | const y = () => PADDING.top + (1 - tick / 100) * plotHeight; | 150 | const y = () => PADDING.top + (1 - tick / 100) * plotHeight; |
| 133 | return ( | 151 | return ( |
| 134 | <g> | 152 | <g> |
| 135 | - <line x1={PADDING.left} x2={PADDING.left + plotWidth} y1={y()} y2={y()} class="stroke-border/70" stroke-width="1" /> | 153 | + <line x1={PADDING.left} x2={PADDING.left + plotWidth()} y1={y()} y2={y()} class="stroke-border/70" stroke-width="1" /> |
| 136 | <text x={PADDING.left - 8} y={y() + 3} text-anchor="end" class="fill-muted-foreground text-[11px]">{tick}</text> | 154 | <text x={PADDING.left - 8} y={y() + 3} text-anchor="end" class="fill-muted-foreground text-[11px]">{tick}</text> |
| 137 | </g> | 155 | </g> |
| 138 | ); | 156 | ); |
| @@ -143,7 +161,7 @@ export const ChartLine: Component<ChartLineProps> = (props) => { | |||
| 143 | <polygon points={areaPoints()} class="fill-primary opacity-10" /> | 161 | <polygon points={areaPoints()} class="fill-primary opacity-10" /> |
| 144 | <line | 162 | <line |
| 145 | x1={PADDING.left} | 163 | x1={PADDING.left} |
| 146 | - x2={PADDING.left + plotWidth} | 164 | + x2={PADDING.left + plotWidth()} |
| 147 | y1={averageY()} | 165 | y1={averageY()} |
| 148 | y2={averageY()} | 166 | y2={averageY()} |
| 149 | class="stroke-muted-foreground" | 167 | class="stroke-muted-foreground" |
| @@ -157,7 +175,7 @@ export const ChartLine: Component<ChartLineProps> = (props) => { | |||
| 157 | {(item, index) => { | 175 | {(item, index) => { |
| 158 | const point = () => pointFor(item, index()); | 176 | const point = () => pointFor(item, index()); |
| 159 | const tooltipX = () => Math.min( | 177 | const tooltipX = () => Math.min( |
| 160 | - VIEW_WIDTH - PADDING.right - TOOLTIP_WIDTH, | 178 | + viewWidth() - PADDING.right - TOOLTIP_WIDTH, |
| 161 | Math.max(PADDING.left, point().x - TOOLTIP_WIDTH / 2), | 179 | Math.max(PADDING.left, point().x - TOOLTIP_WIDTH / 2), |
| 162 | ); | 180 | ); |
| 163 | const tooltipY = () => { | 181 | const tooltipY = () => { |
src/components/ui/combobox.tsxmodified+1 -0
| @@ -38,6 +38,7 @@ export function ComboboxControl<T extends ValidComponent = "div">( | |||
| 38 | const [local, rest] = splitProps(props as ComponentProps<typeof ComboboxPrimitive.Control>, ["class"]); | 38 | const [local, rest] = splitProps(props as ComponentProps<typeof ComboboxPrimitive.Control>, ["class"]); |
| 39 | return ( | 39 | return ( |
| 40 | <ComboboxPrimitive.Control | 40 | <ComboboxPrimitive.Control |
| 41 | + data-slot="combobox-control" | ||
| 41 | class={cn( | 42 | class={cn( |
| 42 | "relative flex h-9 w-full items-center rounded-md border border-input bg-background/90 shadow-sm transition-all", | 43 | "relative flex h-9 w-full items-center rounded-md border border-input bg-background/90 shadow-sm transition-all", |
| 43 | "hover:border-ring/45 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 data-disabled:cursor-not-allowed data-disabled:opacity-50", | 44 | "hover:border-ring/45 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 data-disabled:cursor-not-allowed data-disabled:opacity-50", |
src/components/ui/data-section.tsxmodified+7 -6
| @@ -6,20 +6,21 @@ import { cn } from "@/lib/cn"; | |||
| 6 | * The card every list page sits in: title, description and header actions, | 6 | * The card every list page sits in: title, description and header actions, |
| 7 | * then the page's toolbar and content. It matches the header DataTable draws, | 7 | * then the page's toolbar and content. It matches the header DataTable draws, |
| 8 | * so card-grid pages (classes, courses, boards…) read the same as table pages. | 8 | * so card-grid pages (classes, courses, boards…) read the same as table pages. |
| 9 | + * | ||
| 10 | + * Like DataTable, the title is not drawn: the shell already names the page | ||
| 11 | + * (the header on desktop, its own h1 on phones), and a second copy read as a | ||
| 12 | + * duplicate heading. It still labels the section for assistive tech. | ||
| 9 | */ | 13 | */ |
| 10 | export function DataSection( | 14 | export function DataSection( |
| 11 | props: ParentProps<{ title?: string; description?: string; actions?: JSX.Element; class?: string }>, | 15 | props: ParentProps<{ title?: string; description?: string; actions?: JSX.Element; class?: string }>, |
| 12 | ) { | 16 | ) { |
| 13 | return ( | 17 | return ( |
| 14 | - <section class={cn("data-shell space-y-4 p-4 [&_.empty-state]:border-0 [&_.empty-state]:bg-transparent", props.class)}> | 18 | + <section aria-label={props.title} class={cn("data-shell space-y-4 p-4 [&_.empty-state]:border-0 [&_.empty-state]:bg-transparent", props.class)}> |
| 15 | - <Show when={props.title || props.description || props.actions}> | 19 | + <Show when={props.description || props.actions}> |
| 16 | <div class="flex flex-wrap items-start justify-between gap-3"> | 20 | <div class="flex flex-wrap items-start justify-between gap-3"> |
| 17 | <div class="min-w-0"> | 21 | <div class="min-w-0"> |
| 18 | - <Show when={props.title}> | ||
| 19 | - <h2 class="truncate text-lg font-semibold tracking-tight text-foreground">{props.title}</h2> | ||
| 20 | - </Show> | ||
| 21 | <Show when={props.description}> | 22 | <Show when={props.description}> |
| 22 | - <p class="mt-1 text-sm text-muted-foreground">{props.description}</p> | 23 | + <p class="text-sm text-muted-foreground">{props.description}</p> |
| 23 | </Show> | 24 | </Show> |
| 24 | </div> | 25 | </div> |
| 25 | <Show when={props.actions}> | 26 | <Show when={props.actions}> |
src/components/ui/data-table-search.tsxmodified+2 -2
| @@ -52,14 +52,14 @@ export function DataTableSearch(props: DataTableSearchProps) { | |||
| 52 | // Touch screens get a touch-sized box at 16px (index.css): below that | 52 | // Touch screens get a touch-sized box at 16px (index.css): below that |
| 53 | // iOS Safari zooms the page into a focused field. Compact otherwise. | 53 | // iOS Safari zooms the page into a focused field. Compact otherwise. |
| 54 | // A pill, like every other toolbar control beside it. | 54 | // A pill, like every other toolbar control beside it. |
| 55 | - class={cn("h-10 rounded-full bg-muted/40 text-base sm:h-8 sm:text-[13px] md:text-[13px] touch:h-10", props.value ? "pl-9 pr-8" : "pl-9")} | 55 | + class={cn("h-10 rounded-full bg-muted/40 text-base shadow-none sm:h-8 sm:text-[13px] md:text-[13px] touch:h-10", props.value ? "pl-9 pr-10 sm:pr-8" : "pl-9")} |
| 56 | /> | 56 | /> |
| 57 | <Show when={props.value}> | 57 | <Show when={props.value}> |
| 58 | <button | 58 | <button |
| 59 | type="button" | 59 | type="button" |
| 60 | aria-label={t("common.clearSearch")} | 60 | aria-label={t("common.clearSearch")} |
| 61 | onClick={() => props.onChange("")} | 61 | onClick={() => props.onChange("")} |
| 62 | - class="absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground" | 62 | + class="absolute right-1 top-1/2 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-full text-muted-foreground outline-hidden transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring sm:h-6 sm:w-6 touch:h-8 touch:w-8" |
| 63 | > | 63 | > |
| 64 | <IconX class="h-4 w-4" /> | 64 | <IconX class="h-4 w-4" /> |
| 65 | </button> | 65 | </button> |
src/components/ui/data-table.tsxmodified+11 -54
| @@ -1,4 +1,4 @@ | |||
| 1 | -import { For, Show, createEffect, createSignal, on, onCleanup, onMount } from "solid-js"; | 1 | +import { For, Show, createEffect, createSignal, on, onCleanup } from "solid-js"; |
| 2 | import type { JSX, ParentProps } from "solid-js"; | 2 | import type { JSX, ParentProps } from "solid-js"; |
| 3 | import { | 3 | import { |
| 4 | type Column, | 4 | type Column, |
| @@ -24,6 +24,7 @@ import { InfoTip } from "@/components/ui/info-tip"; | |||
| 24 | import { cn } from "@/lib/cn"; | 24 | import { cn } from "@/lib/cn"; |
| 25 | import { createMediaQuery } from "@/lib/create-media-query"; | 25 | import { createMediaQuery } from "@/lib/create-media-query"; |
| 26 | import { COMPACT_SCREEN_QUERY } from "@/lib/create-page-size"; | 26 | import { COMPACT_SCREEN_QUERY } from "@/lib/create-page-size"; |
| 27 | +import { createScrollRestore } from "@/lib/scroll-restore"; | ||
| 27 | import { createTablePreferences } from "@/lib/table-preferences"; | 28 | import { createTablePreferences } from "@/lib/table-preferences"; |
| 28 | import { createUrlParam, createUrlString, decodeSort, encodeSort, listParamKeys } from "@/lib/url-state"; | 29 | import { createUrlParam, createUrlString, decodeSort, encodeSort, listParamKeys } from "@/lib/url-state"; |
| 29 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; | 30 | import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; |
| @@ -183,15 +184,6 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData, | |||
| 183 | } | 184 | } |
| 184 | }, { defer: true })); | 185 | }, { defer: true })); |
| 185 | const resetReveal = () => setRevealed(REVEAL_STEP); | 186 | const resetReveal = () => setRevealed(REVEAL_STEP); |
| 186 | - // The router's own scroll restoration runs before a list's rows arrive, so | ||
| 187 | - // a long list came back at the top. Remember the page offset against this | ||
| 188 | - // history entry and put it back once the rows are drawn — only on a return | ||
| 189 | - // to the same entry (Back), never on a fresh visit. | ||
| 190 | - const scrollKey = revealKey ? `${revealKey}:scroll` : null; | ||
| 191 | - const historyEntry = () => { | ||
| 192 | - const state = history.state as Record<string, unknown> | null; | ||
| 193 | - return String(state?.__TSR_key ?? state?.key ?? ""); | ||
| 194 | - }; | ||
| 195 | createEffect(on(() => props.pageResetKey, resetReveal, { defer: true })); | 187 | createEffect(on(() => props.pageResetKey, resetReveal, { defer: true })); |
| 196 | // The search box's text when the table owns it — the `searchPredicate` | 188 | // The search box's text when the table owns it — the `searchPredicate` |
| 197 | // query, or the `filterColumn` filter value. | 189 | // query, or the `filterColumn` filter value. |
| @@ -401,47 +393,8 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData, | |||
| 401 | if (busy === false && observing) queueMicrotask(revealMore); | 393 | if (busy === false && observing) queueMicrotask(revealMore); |
| 402 | }, { defer: true })); | 394 | }, { defer: true })); |
| 403 | if (!observing) setRevealed(Number.MAX_SAFE_INTEGER); | 395 | if (!observing) setRevealed(Number.MAX_SAFE_INTEGER); |
| 404 | - if (scrollKey) { | 396 | + // Back from a detail page lands on the same row once the rows are drawn. |
| 405 | - let saveTimer: ReturnType<typeof setTimeout> | undefined; | 397 | + createScrollRestore(revealKey, () => visibleRows().length > 0); |
| 406 | - const saveScroll = () => { | ||
| 407 | - clearTimeout(saveTimer); | ||
| 408 | - saveTimer = setTimeout(() => { | ||
| 409 | - try { | ||
| 410 | - sessionStorage.setItem(scrollKey, JSON.stringify({ y: Math.round(window.scrollY), entry: historyEntry() })); | ||
| 411 | - } catch { | ||
| 412 | - // storage blocked: no restore, nothing else breaks | ||
| 413 | - } | ||
| 414 | - }, 150); | ||
| 415 | - }; | ||
| 416 | - onMount(() => { | ||
| 417 | - window.addEventListener("scroll", saveScroll, { passive: true }); | ||
| 418 | - onCleanup(() => { | ||
| 419 | - clearTimeout(saveTimer); | ||
| 420 | - window.removeEventListener("scroll", saveScroll); | ||
| 421 | - }); | ||
| 422 | - }); | ||
| 423 | - let restored = false; | ||
| 424 | - createEffect(() => { | ||
| 425 | - if (restored || visibleRows().length === 0) return; | ||
| 426 | - restored = true; | ||
| 427 | - try { | ||
| 428 | - const saved = JSON.parse(sessionStorage.getItem(scrollKey) ?? "null") as { y?: number; entry?: string } | null; | ||
| 429 | - // The router may already have tried, clamped to a page that was still | ||
| 430 | - // short; correct it once the rows are laid out, and once more after | ||
| 431 | - // late content (avatars, badges) settles. | ||
| 432 | - const target = saved?.y; | ||
| 433 | - if (target && saved.entry === historyEntry()) { | ||
| 434 | - const settle = () => { | ||
| 435 | - if (Math.abs(window.scrollY - target) > 8) window.scrollTo(0, target); | ||
| 436 | - }; | ||
| 437 | - requestAnimationFrame(settle); | ||
| 438 | - setTimeout(settle, 300); | ||
| 439 | - } | ||
| 440 | - } catch { | ||
| 441 | - // malformed entry: start at the top | ||
| 442 | - } | ||
| 443 | - }); | ||
| 444 | - } | ||
| 445 | const searchFieldValue = () => { | 398 | const searchFieldValue = () => { |
| 446 | if (props.onSearchInput || props.searchPredicate || props.filterColumn) return searchValue(); | 399 | if (props.onSearchInput || props.searchPredicate || props.filterColumn) return searchValue(); |
| 447 | return ""; | 400 | return ""; |
| @@ -592,7 +545,7 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData, | |||
| 592 | /> | 545 | /> |
| 593 | </Show> | 546 | </Show> |
| 594 | <Show when={props.filters}> | 547 | <Show when={props.filters}> |
| 595 | - <div class="order-3 -my-1 flex w-full items-center gap-2 overflow-x-auto py-1 [scrollbar-width:none] sm:my-0 sm:py-0 sm:flex-wrap sm:overflow-visible lg:order-2 lg:w-auto [&_button]:h-10 [&_button]:shrink-0 [&_button]:rounded-full [&_button]:px-3 [&_button]:text-[13px] [&_[data-filter-active]]:border-primary [&_[data-filter-active]]:text-primary-text sm:[&_button]:h-8 touch:[&_button]:h-10 [&_select]:h-10 [&_select]:rounded-full [&_select]:text-[13px] sm:[&_select]:h-8 touch:[&_select]:h-10 max-sm:[&>*]:flex-nowrap max-sm:[&>*]:shrink-0">{props.filters}</div> | 548 | + <div class="order-3 -my-1 flex w-full items-center gap-2 overflow-x-auto py-1 [scrollbar-width:none] sm:my-0 sm:py-0 sm:flex-wrap sm:overflow-visible lg:order-2 lg:w-auto [&_button]:h-10 [&_button]:shrink-0 [&_button]:rounded-full [&_button]:px-3 [&_button]:text-[13px] [&_[data-filter-active]]:border-primary [&_[data-filter-active]]:text-primary-text [&_[data-slot=combobox-control]]:h-10 [&_[data-slot=combobox-control]]:rounded-full [&_[data-slot=combobox-control]]:text-[13px] sm:[&_[data-slot=combobox-control]]:h-8 touch:[&_[data-slot=combobox-control]]:h-10 sm:[&_button]:h-8 touch:[&_button]:h-10 [&_select]:h-10 [&_select]:rounded-full [&_select]:text-[13px] sm:[&_select]:h-8 touch:[&_select]:h-10 max-sm:[&>*]:flex-nowrap max-sm:[&>*]:shrink-0">{props.filters}</div> |
| 596 | </Show> | 549 | </Show> |
| 597 | <Show when={props.actions || showColumnMenu()}> | 550 | <Show when={props.actions || showColumnMenu()}> |
| 598 | {/* Beside the search the actions keep their own width (the search | 551 | {/* Beside the search the actions keep their own width (the search |
| @@ -798,7 +751,7 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData, | |||
| 798 | else el.removeAttribute("title"); | 751 | else el.removeAttribute("title"); |
| 799 | }} | 752 | }} |
| 800 | > | 753 | > |
| 801 | - <Show when={!isEmpty} fallback={<span class="text-muted-foreground/40">-</span>}> | 754 | + <Show when={!isEmpty} fallback={<span class="text-muted-foreground">—</span>}> |
| 802 | {flexRender(cell.column.columnDef.cell, cell.getContext())} | 755 | {flexRender(cell.column.columnDef.cell, cell.getContext())} |
| 803 | </Show> | 756 | </Show> |
| 804 | </TableCell> | 757 | </TableCell> |
| @@ -827,7 +780,10 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData, | |||
| 827 | )} | 780 | )} |
| 828 | </Show> | 781 | </Show> |
| 829 | <Show when={(revealing() || props.infinite) && totalRows() > 0}> | 782 | <Show when={(revealing() || props.infinite) && totalRows() > 0}> |
| 830 | - <div ref={sentinel} aria-hidden="true" class="h-px" /> | 783 | + {/* One block, so the parent's space-y gap is paid once: the sentinel |
| 784 | + and the count as siblings put two gaps under the scroll hint. */} | ||
| 785 | + <div class="-mt-1.5 flex flex-col gap-2"> | ||
| 786 | + <div ref={sentinel} aria-hidden="true" class="-mb-2 h-px" /> | ||
| 831 | <p class="px-1 text-xs font-medium tabular-nums text-muted-foreground sm:text-[11px]" aria-live="polite"> | 787 | <p class="px-1 text-xs font-medium tabular-nums text-muted-foreground sm:text-[11px]" aria-live="polite"> |
| 832 | {props.infinite?.loading | 788 | {props.infinite?.loading |
| 833 | ? t("common.loadingMore") | 789 | ? t("common.loadingMore") |
| @@ -842,6 +798,7 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData, | |||
| 842 | {t("common.loadMore")} | 798 | {t("common.loadMore")} |
| 843 | </Button> | 799 | </Button> |
| 844 | </Show> | 800 | </Show> |
| 801 | + </div> | ||
| 845 | </Show> | 802 | </Show> |
| 846 | </div> | 803 | </div> |
| 847 | ); | 804 | ); |
src/components/ui/dialog.tsxmodified+32 -7
| @@ -3,18 +3,37 @@ import type { ComponentProps, ParentProps, ValidComponent } from "solid-js"; | |||
| 3 | import { Show, splitProps } from "solid-js"; | 3 | import { Show, splitProps } from "solid-js"; |
| 4 | import { IconX } from "@/components/ui/icons"; | 4 | import { IconX } from "@/components/ui/icons"; |
| 5 | import { cn } from "@/lib/cn"; | 5 | import { cn } from "@/lib/cn"; |
| 6 | +import { useT } from "@/stores/preferences-context"; | ||
| 6 | 7 | ||
| 7 | export const Dialog = DialogPrimitive; | 8 | export const Dialog = DialogPrimitive; |
| 8 | export const DialogTrigger = DialogPrimitive.Trigger; | 9 | export const DialogTrigger = DialogPrimitive.Trigger; |
| 9 | export const DialogClose = DialogPrimitive.CloseButton; | 10 | export const DialogClose = DialogPrimitive.CloseButton; |
| 10 | 11 | ||
| 12 | +type DialogContentExtras = { | ||
| 13 | + dismissable?: boolean; | ||
| 14 | + closeButton?: boolean; | ||
| 15 | + /** "top" pins the dialog high on the screen, so a panel whose height | ||
| 16 | + * follows its content (the command palette's results) grows downward | ||
| 17 | + * instead of jumping up and down around the centre while you type. */ | ||
| 18 | + position?: "center" | "top"; | ||
| 19 | +}; | ||
| 20 | + | ||
| 11 | export function DialogContent<T extends ValidComponent = "div">( | 21 | export function DialogContent<T extends ValidComponent = "div">( |
| 12 | - props: ComponentProps<typeof DialogPrimitive.Content<T>> & { dismissable?: boolean; closeButton?: boolean }, | 22 | + props: ComponentProps<typeof DialogPrimitive.Content<T>> & DialogContentExtras, |
| 13 | ) { | 23 | ) { |
| 14 | const [local, rest] = splitProps( | 24 | const [local, rest] = splitProps( |
| 15 | - props as ComponentProps<typeof DialogPrimitive.Content> & { dismissable?: boolean; closeButton?: boolean }, | 25 | + props as ComponentProps<typeof DialogPrimitive.Content> & DialogContentExtras, |
| 16 | - ["class", "children", "dismissable", "closeButton"], | 26 | + ["class", "children", "dismissable", "closeButton", "position"], |
| 17 | ); | 27 | ); |
| 28 | + // The close button speaks the app language; a bare render (unit tests, | ||
| 29 | + // no PreferencesProvider) falls back to English instead of throwing. | ||
| 30 | + let t: ReturnType<typeof useT> | undefined; | ||
| 31 | + try { | ||
| 32 | + t = useT(); | ||
| 33 | + } catch { | ||
| 34 | + t = undefined; | ||
| 35 | + } | ||
| 36 | + const closeLabel = () => t?.("common.close") ?? "Close"; | ||
| 18 | return ( | 37 | return ( |
| 19 | <DialogPrimitive.Portal> | 38 | <DialogPrimitive.Portal> |
| 20 | {/* z-[70]: above the mobile nav sheet (z-60) and tab bar (z-40). */} | 39 | {/* z-[70]: above the mobile nav sheet (z-60) and tab bar (z-40). */} |
| @@ -22,13 +41,18 @@ export function DialogContent<T extends ValidComponent = "div">( | |||
| 22 | {/* flex center — animate-fade-up must not own transform positioning */} | 41 | {/* flex center — animate-fade-up must not own transform positioning */} |
| 23 | {/* The centring box is inset by the system bars, so a tall dialog is | 42 | {/* The centring box is inset by the system bars, so a tall dialog is |
| 24 | never clipped by the status bar or the gesture bar. */} | 43 | never clipped by the status bar or the gesture bar. */} |
| 25 | - <div class="pointer-events-none fixed inset-0 z-[70] flex items-center justify-center p-3 pb-[calc(0.75rem+max(env(safe-area-inset-bottom),var(--android-nav-inset,0px)))] pt-[calc(0.75rem+env(safe-area-inset-top))] sm:p-4"> | 44 | + <div |
| 45 | + class={cn( | ||
| 46 | + "pointer-events-none fixed inset-0 z-[70] flex justify-center p-3 pb-[calc(0.75rem+max(env(safe-area-inset-bottom),var(--android-nav-inset,0px)))] pt-[calc(0.75rem+env(safe-area-inset-top))] sm:p-4", | ||
| 47 | + local.position === "top" ? "items-start sm:pt-[12vh]" : "items-center", | ||
| 48 | + )} | ||
| 49 | + > | ||
| 26 | <DialogPrimitive.Content | 50 | <DialogPrimitive.Content |
| 27 | // Explicit: with any AlertDialog in the tree, Kobalte hands plain | 51 | // Explicit: with any AlertDialog in the tree, Kobalte hands plain |
| 28 | // dialogs its "alertdialog" role too. | 52 | // dialogs its "alertdialog" role too. |
| 29 | role="dialog" | 53 | role="dialog" |
| 30 | class={cn( | 54 | class={cn( |
| 31 | - "pointer-events-auto relative flex max-h-[min(100%,48rem)] w-full max-w-[480px] flex-col overflow-hidden border border-border-line bg-surface-base text-foreground shadow-[0_16px_40px_rgba(0,0,0,0.16)] outline-hidden animate-fade-up sm:rounded-2xl", | 55 | + "pointer-events-auto relative flex max-h-[min(100%,48rem)] w-full max-w-[480px] flex-col overflow-hidden border border-border-line bg-surface-base text-foreground shadow-[0_16px_40px_rgba(0,0,0,0.16)] outline-hidden animate-fade-up rounded-xl sm:rounded-2xl", |
| 32 | local.class, | 56 | local.class, |
| 33 | )} | 57 | )} |
| 34 | // Standard dialogs dismiss outside/ESC; pass false only when losing | 58 | // Standard dialogs dismiss outside/ESC; pass false only when losing |
| @@ -43,8 +67,9 @@ export function DialogContent<T extends ValidComponent = "div">( | |||
| 43 | <Show when={local.closeButton !== false}> | 67 | <Show when={local.closeButton !== false}> |
| 44 | <DialogPrimitive.CloseButton | 68 | <DialogPrimitive.CloseButton |
| 45 | type="button" | 69 | type="button" |
| 46 | - class="absolute right-4 top-4 z-10 inline-flex h-8 w-8 items-center justify-center rounded-sm text-muted-foreground transition-all hover:bg-accent hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" | 70 | + class="absolute right-4 top-4 z-10 inline-flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-all hover:bg-accent hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2" |
| 47 | - aria-label="Close" | 71 | + aria-label={closeLabel()} |
| 72 | + title={closeLabel()} | ||
| 48 | > | 73 | > |
| 49 | <IconX class="h-4 w-4" /> | 74 | <IconX class="h-4 w-4" /> |
| 50 | </DialogPrimitive.CloseButton> | 75 | </DialogPrimitive.CloseButton> |
src/components/ui/dropdown-menu.tsxmodified+4 -4
| @@ -42,7 +42,7 @@ export function DropdownMenuItem<T extends ValidComponent = "div">( | |||
| 42 | return ( | 42 | return ( |
| 43 | <DropdownMenuPrimitive.Item | 43 | <DropdownMenuPrimitive.Item |
| 44 | class={cn( | 44 | class={cn( |
| 45 | - "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors", | 45 | + "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors max-sm:min-h-10 touch:min-h-10", |
| 46 | "focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground", | 46 | "focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground", |
| 47 | "data-disabled:pointer-events-none data-disabled:opacity-40", | 47 | "data-disabled:pointer-events-none data-disabled:opacity-40", |
| 48 | local.inset && "pl-9", | 48 | local.inset && "pl-9", |
| @@ -62,7 +62,7 @@ export function DropdownMenuCheckboxItem<T extends ValidComponent = "div">( | |||
| 62 | return ( | 62 | return ( |
| 63 | <DropdownMenuPrimitive.CheckboxItem | 63 | <DropdownMenuPrimitive.CheckboxItem |
| 64 | class={cn( | 64 | class={cn( |
| 65 | - "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors", | 65 | + "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors max-sm:min-h-10 touch:min-h-10", |
| 66 | "focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground", | 66 | "focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground", |
| 67 | "data-disabled:pointer-events-none data-disabled:opacity-40", | 67 | "data-disabled:pointer-events-none data-disabled:opacity-40", |
| 68 | local.class, | 68 | local.class, |
| @@ -103,7 +103,7 @@ export function DropdownMenuRadioItem<T extends ValidComponent = "div">( | |||
| 103 | return ( | 103 | return ( |
| 104 | <DropdownMenuPrimitive.RadioItem | 104 | <DropdownMenuPrimitive.RadioItem |
| 105 | class={cn( | 105 | class={cn( |
| 106 | - "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors", | 106 | + "relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-hidden transition-colors max-sm:min-h-10 touch:min-h-10", |
| 107 | "focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground", | 107 | "focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground", |
| 108 | "data-disabled:pointer-events-none data-disabled:opacity-40", | 108 | "data-disabled:pointer-events-none data-disabled:opacity-40", |
| 109 | local.class, | 109 | local.class, |
| @@ -129,7 +129,7 @@ export function DropdownMenuSubTrigger<T extends ValidComponent = "div">( | |||
| 129 | return ( | 129 | return ( |
| 130 | <DropdownMenuPrimitive.SubTrigger | 130 | <DropdownMenuPrimitive.SubTrigger |
| 131 | class={cn( | 131 | class={cn( |
| 132 | - "flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors", | 132 | + "flex w-full cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden transition-colors max-sm:min-h-10 touch:min-h-10", |
| 133 | "focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-expanded:bg-accent", | 133 | "focus:bg-accent focus:text-accent-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground data-expanded:bg-accent", |
| 134 | local.inset && "pl-9", | 134 | local.inset && "pl-9", |
| 135 | local.class, | 135 | local.class, |
src/components/ui/searchable-select.tsxmodified+9 -0
| @@ -30,6 +30,9 @@ export function SearchableSelect(props: { | |||
| 30 | disabled?: boolean; | 30 | disabled?: boolean; |
| 31 | required?: boolean; | 31 | required?: boolean; |
| 32 | class?: string; | 32 | class?: string; |
| 33 | + /** Filter-chip prefix drawn inside the pill ("Ders: Tümü"), like | ||
| 34 | + * DropdownSelect's `labelPrefix`; it also labels the field. */ | ||
| 35 | + labelPrefix?: string; | ||
| 33 | }) { | 36 | }) { |
| 34 | const t = useT(); | 37 | const t = useT(); |
| 35 | const [query, setQuery] = createSignal(""); | 38 | const [query, setQuery] = createSignal(""); |
| @@ -85,8 +88,14 @@ export function SearchableSelect(props: { | |||
| 85 | )} | 88 | )} |
| 86 | > | 89 | > |
| 87 | <ComboboxControl class={props.class}> | 90 | <ComboboxControl class={props.class}> |
| 91 | + <Show when={props.labelPrefix}> | ||
| 92 | + <label for={props.id} class="shrink-0 cursor-pointer pl-3 text-xs font-semibold text-muted-foreground"> | ||
| 93 | + {props.labelPrefix}: | ||
| 94 | + </label> | ||
| 95 | + </Show> | ||
| 88 | <ComboboxInput | 96 | <ComboboxInput |
| 89 | id={props.id} | 97 | id={props.id} |
| 98 | + class={props.labelPrefix ? "pl-1.5 font-medium" : undefined} | ||
| 90 | ref={inputRef} | 99 | ref={inputRef} |
| 91 | // The field is the affordance: a plain click toggles the list. The | 100 | // The field is the affordance: a plain click toggles the list. The |
| 92 | // chevron is a sibling button, so its own pointerdown toggle never | 101 | // chevron is a sibling button, so its own pointerdown toggle never |
src/components/ui/side-panel.tsxmodified+1 -1
| @@ -212,7 +212,7 @@ export function SidePanel( | |||
| 212 | <DialogPrimitive.CloseButton | 212 | <DialogPrimitive.CloseButton |
| 213 | type="button" | 213 | type="button" |
| 214 | aria-label={t("common.close")} | 214 | aria-label={t("common.close")} |
| 215 | - class="inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" | 215 | + class="inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-md text-muted-foreground sm:h-9 sm:w-9 touch:h-10 touch:w-10 transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring" |
| 216 | > | 216 | > |
| 217 | <IconX class="h-4 w-4" /> | 217 | <IconX class="h-4 w-4" /> |
| 218 | </DialogPrimitive.CloseButton> | 218 | </DialogPrimitive.CloseButton> |
src/components/ui/table-row-actions.tsxmodified+2 -2
| @@ -51,8 +51,8 @@ export function TableRowActions(props: { label: string; actions: TableRowAction[ | |||
| 51 | <DropdownMenu placement="bottom-end" gutter={6}> | 51 | <DropdownMenu placement="bottom-end" gutter={6}> |
| 52 | <DropdownMenuTrigger | 52 | <DropdownMenuTrigger |
| 53 | class={props.compact | 53 | class={props.compact |
| 54 | - ? "inline-flex h-7 w-7 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted-foreground outline-hidden transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-expanded:bg-muted data-expanded:text-foreground" | 54 | + ? "inline-flex h-10 w-10 sm:h-7 sm:w-7 touch:h-10 touch:w-10 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted-foreground outline-hidden transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-expanded:bg-muted data-expanded:text-foreground" |
| 55 | - : "inline-flex h-8 min-w-[78px] cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-border/80 bg-muted/45 px-2 text-xs font-semibold text-foreground outline-hidden transition-colors hover:border-border hover:bg-primary/8 hover:text-primary-text focus-visible:ring-2 focus-visible:ring-ring data-expanded:border-border data-expanded:bg-primary/10 data-expanded:text-primary-text"} | 55 | + : "inline-flex h-10 min-w-[78px] cursor-pointer items-center justify-center gap-1.5 rounded-full border border-border/80 bg-muted/45 px-3 text-xs font-semibold text-foreground outline-hidden sm:h-8 touch:h-10 transition-colors hover:border-border hover:bg-primary/8 hover:text-primary-text focus-visible:ring-2 focus-visible:ring-ring data-expanded:border-border data-expanded:bg-primary/10 data-expanded:text-primary-text"} |
| 56 | data-row-actions-trigger | 56 | data-row-actions-trigger |
| 57 | aria-label={props.label} | 57 | aria-label={props.label} |
| 58 | title={props.label} | 58 | title={props.label} |
src/components/users/account-profile-dialog.tsxmodified+12 -8
| @@ -27,7 +27,7 @@ export function AccountProfileDialog(props: { open: boolean; onOpenChange: (open | |||
| 27 | onClick={() => setSection(id)} | 27 | onClick={() => setSection(id)} |
| 28 | aria-current={section() === id ? "page" : undefined} | 28 | aria-current={section() === id ? "page" : undefined} |
| 29 | class={cn( | 29 | class={cn( |
| 30 | - "flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring", | 30 | + "flex h-10 min-w-0 items-center gap-2.5 rounded-lg px-3 text-left text-sm font-medium transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring max-sm:flex-1 max-sm:justify-center sm:h-9 sm:w-full touch:h-10", |
| 31 | section() === id ? "bg-primary/10 text-primary-text" : "text-muted-foreground hover:bg-muted/70 hover:text-foreground", | 31 | section() === id ? "bg-primary/10 text-primary-text" : "text-muted-foreground hover:bg-muted/70 hover:text-foreground", |
| 32 | )} | 32 | )} |
| 33 | > | 33 | > |
| @@ -42,7 +42,7 @@ export function AccountProfileDialog(props: { open: boolean; onOpenChange: (open | |||
| 42 | aria-pressed={active} | 42 | aria-pressed={active} |
| 43 | onClick={onClick} | 43 | onClick={onClick} |
| 44 | class={cn( | 44 | class={cn( |
| 45 | - "flex-1 rounded-md px-3 py-1.5 text-sm font-medium transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring", | 45 | + "h-10 flex-1 rounded-md px-3 text-sm font-medium sm:h-8 touch:h-10 transition-colors outline-hidden focus-visible:ring-2 focus-visible:ring-ring", |
| 46 | active ? "bg-background text-foreground shadow-xs" : "text-muted-foreground hover:text-foreground", | 46 | active ? "bg-background text-foreground shadow-xs" : "text-muted-foreground hover:text-foreground", |
| 47 | )} | 47 | )} |
| 48 | > | 48 | > |
| @@ -55,9 +55,13 @@ export function AccountProfileDialog(props: { open: boolean; onOpenChange: (open | |||
| 55 | {(user) => ( | 55 | {(user) => ( |
| 56 | <Dialog open={props.open} onOpenChange={props.onOpenChange}> | 56 | <Dialog open={props.open} onOpenChange={props.onOpenChange}> |
| 57 | <DialogContent class="max-w-2xl p-0"> | 57 | <DialogContent class="max-w-2xl p-0"> |
| 58 | - <div class="flex h-[min(80vh,32rem)] min-h-0"> | 58 | + {/* Phones stack the section rail above the panel as one row (the |
| 59 | - <nav class="flex w-40 shrink-0 flex-col gap-1 border-r border-border/70 bg-muted/20 p-2"> | 59 | + close button keeps the row's right end); from `sm` it is a |
| 60 | - <DialogTitle class="px-3 pb-2 pt-1.5 text-sm">{t("nav.settings")}</DialogTitle> | 60 | + left column. A 160px column beside a 390px screen left the |
| 61 | + form ~130px wide and clipped its fields. */} | ||
| 62 | + <div class="flex h-[min(85dvh,36rem)] min-h-0 flex-col sm:h-[min(80vh,32rem)] sm:flex-row"> | ||
| 63 | + <nav class="flex shrink-0 items-center gap-1 border-b border-border/70 bg-muted/20 p-2 pr-14 sm:w-40 sm:flex-col sm:items-stretch sm:border-b-0 sm:border-r sm:pr-2"> | ||
| 64 | + <DialogTitle class="px-3 pb-2 pt-1.5 text-sm max-sm:sr-only">{t("nav.settings")}</DialogTitle> | ||
| 61 | {navItem("account", t("nav.account"), <IconUserCog class="h-4 w-4 shrink-0" />)} | 65 | {navItem("account", t("nav.account"), <IconUserCog class="h-4 w-4 shrink-0" />)} |
| 62 | {navItem("appearance", t("settings.tabAppearance"), <IconSun class="h-4 w-4 shrink-0" />)} | 66 | {navItem("appearance", t("settings.tabAppearance"), <IconSun class="h-4 w-4 shrink-0" />)} |
| 63 | </nav> | 67 | </nav> |
| @@ -65,12 +69,12 @@ export function AccountProfileDialog(props: { open: boolean; onOpenChange: (open | |||
| 65 | {/* The account form's save bar is sticky at the bottom of this | 69 | {/* The account form's save bar is sticky at the bottom of this |
| 66 | scroll area, so that section drops the bottom padding — any | 70 | scroll area, so that section drops the bottom padding — any |
| 67 | padding under a sticky bar shows content scrolling past it. */} | 71 | padding under a sticky bar shows content scrolling past it. */} |
| 68 | - <div class={cn("min-w-0 flex-1 overflow-y-auto p-5 pr-12", section() === "account" && "pb-0")}> | 72 | + <div class={cn("min-w-0 flex-1 overflow-y-auto p-5 sm:pr-12", section() === "account" && "pb-0")}> |
| 69 | <Switch> | 73 | <Switch> |
| 70 | <Match when={section() === "account"}> | 74 | <Match when={section() === "account"}> |
| 71 | <ProfileForm | 75 | <ProfileForm |
| 72 | user={user} | 76 | user={user} |
| 73 | - footerClass="-mr-12 pr-12 pb-5" | 77 | + footerClass="pb-5 sm:-mr-12 sm:pr-12" |
| 74 | onSaved={async () => { | 78 | onSaved={async () => { |
| 75 | await auth.refresh(); | 79 | await auth.refresh(); |
| 76 | props.onOpenChange(false); | 80 | props.onOpenChange(false); |
| @@ -128,7 +132,7 @@ export function AccountProfileDialog(props: { open: boolean; onOpenChange: (open | |||
| 128 | </div> | 132 | </div> |
| 129 | <button | 133 | <button |
| 130 | type="button" | 134 | type="button" |
| 131 | - class="rounded-lg border border-border px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-40" | 135 | + class="h-10 rounded-lg border border-border px-3 text-xs font-medium text-muted-foreground transition-colors outline-hidden hover:bg-accent hover:text-accent-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-40 sm:h-8 touch:h-10" |
| 132 | disabled={prefs.paletteColor() === null} | 136 | disabled={prefs.paletteColor() === null} |
| 133 | onClick={() => prefs.setPaletteColor(null)} | 137 | onClick={() => prefs.setPaletteColor(null)} |
| 134 | > | 138 | > |
src/components/users/roster-person-cell.tsxmodified+3 -2
| @@ -5,8 +5,9 @@ import { UserAvatar } from "@/components/users/user-avatar"; | |||
| 5 | export function RosterPersonCell(props: { person: PersonRef }) { | 5 | export function RosterPersonCell(props: { person: PersonRef }) { |
| 6 | return ( | 6 | return ( |
| 7 | <div class="flex min-w-0 items-center gap-2.5"> | 7 | <div class="flex min-w-0 items-center gap-2.5"> |
| 8 | - <UserAvatar userId={props.person.id} name={props.person.display_name || "?"} hasAvatar={false} size="sm" /> | 8 | + {/* self-center: phone cards turn the row's items-center into items-start. */} |
| 9 | - <div class="min-w-0"> | 9 | + <UserAvatar userId={props.person.id} name={props.person.display_name || "?"} hasAvatar={false} size="sm" class="self-center" /> |
| 10 | + <div class="min-w-0 self-center"> | ||
| 10 | <p class="truncate text-sm font-medium text-text-strong">{props.person.display_name || "—"}</p> | 11 | <p class="truncate text-sm font-medium text-text-strong">{props.person.display_name || "—"}</p> |
| 11 | </div> | 12 | </div> |
| 12 | </div> | 13 | </div> |
src/components/users/user-avatar.tsxmodified+4 -1
| @@ -40,10 +40,13 @@ export function UserAvatar(props: { | |||
| 40 | 40 | ||
| 41 | const showImage = () => props.hasAvatar !== false && !broken(); | 41 | const showImage = () => props.hasAvatar !== false && !broken(); |
| 42 | 42 | ||
| 43 | + // grid + place-items, not flex + items/justify-center: DataTable's phone | ||
| 44 | + // cards rewrite descendant .items-center/.justify-center to start, which | ||
| 45 | + // pushed the initials into the circle's top-left corner. | ||
| 43 | return ( | 46 | return ( |
| 44 | <span | 47 | <span |
| 45 | class={cn( | 48 | class={cn( |
| 46 | - "relative flex shrink-0 items-center justify-center overflow-hidden rounded-full bg-primary/15 font-bold text-primary-text shadow-xs ring-1 ring-border/70 dark:bg-emerald-100 dark:text-emerald-950 dark:ring-white/20", | 49 | + "relative grid shrink-0 place-items-center overflow-hidden rounded-full bg-primary/15 font-bold text-primary-text shadow-xs ring-1 ring-border/70 dark:bg-emerald-100 dark:text-emerald-950 dark:ring-white/20", |
| 47 | SIZES[props.size ?? "sm"], | 50 | SIZES[props.size ?? "sm"], |
| 48 | props.class, | 51 | props.class, |
| 49 | )} | 52 | )} |
src/components/users/user-table.tsxmodified+3 -2
| @@ -37,7 +37,8 @@ function UserRoleActions(props: { | |||
| 37 | <div class="flex min-w-0 items-center gap-1.5"> | 37 | <div class="flex min-w-0 items-center gap-1.5"> |
| 38 | <Select | 38 | <Select |
| 39 | wrapperClass="min-w-0 flex-1" | 39 | wrapperClass="min-w-0 flex-1" |
| 40 | - class="h-8 rounded-md text-xs" | 40 | + // 40px on phones and touch screens (touch-target minimum), 32px from sm. |
| 41 | + class="h-10 rounded-md text-xs sm:h-8 touch:h-10" | ||
| 41 | value={pendingRole()} | 42 | value={pendingRole()} |
| 42 | disabled={isSelf()} | 43 | disabled={isSelf()} |
| 43 | onChange={(e) => setPendingRole(e.currentTarget.value as Role)} | 44 | onChange={(e) => setPendingRole(e.currentTarget.value as Role)} |
| @@ -51,7 +52,7 @@ function UserRoleActions(props: { | |||
| 51 | <Button | 52 | <Button |
| 52 | type="button" | 53 | type="button" |
| 53 | size="icon" | 54 | size="icon" |
| 54 | - class="h-8 w-8 shrink-0 rounded-md" | 55 | + class="h-10 w-10 shrink-0 rounded-md sm:h-8 sm:w-8 touch:h-10 touch:w-10" |
| 55 | aria-label={t("common.update")} | 56 | aria-label={t("common.update")} |
| 56 | title={t("common.update")} | 57 | title={t("common.update")} |
| 57 | onClick={(e) => { e.stopPropagation(); setConfirmOpen(true); }} | 58 | onClick={(e) => { e.stopPropagation(); setConfirmOpen(true); }} |
src/components/whiteboard/board-bulk-invite.tsxmodified+5 -4
| @@ -89,7 +89,7 @@ export function BoardBulkInvite(props: { | |||
| 89 | }; | 89 | }; |
| 90 | 90 | ||
| 91 | return ( | 91 | return ( |
| 92 | - <section class="space-y-3 rounded-xl border border-border/70 bg-card p-4 shadow-xs"> | 92 | + <section class="space-y-3 rounded-xl border border-border-line bg-card p-4 shadow-xs"> |
| 93 | <div> | 93 | <div> |
| 94 | <h3 class="text-sm font-semibold">{t("whiteboard.bulkInvite")}</h3> | 94 | <h3 class="text-sm font-semibold">{t("whiteboard.bulkInvite")}</h3> |
| 95 | <p class="mt-1 text-xs text-muted-foreground">{t("whiteboard.bulkInviteHint")}</p> | 95 | <p class="mt-1 text-xs text-muted-foreground">{t("whiteboard.bulkInviteHint")}</p> |
| @@ -101,7 +101,7 @@ export function BoardBulkInvite(props: { | |||
| 101 | <button | 101 | <button |
| 102 | type="button" | 102 | type="button" |
| 103 | class={cn( | 103 | class={cn( |
| 104 | - "rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors", | 104 | + "inline-flex h-8 items-center rounded-full border px-3.5 text-[13px] font-medium outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring touch:h-10", |
| 105 | kind() === k | 105 | kind() === k |
| 106 | ? "border-primary bg-primary/10 text-primary-text" | 106 | ? "border-primary bg-primary/10 text-primary-text" |
| 107 | : "border-border/70 text-muted-foreground hover:bg-muted/60", | 107 | : "border-border/70 text-muted-foreground hover:bg-muted/60", |
| @@ -129,16 +129,17 @@ export function BoardBulkInvite(props: { | |||
| 129 | <div class="space-y-1.5"> | 129 | <div class="space-y-1.5"> |
| 130 | <Label for="board-invite-source">{t("whiteboard.inviteSelect")}</Label> | 130 | <Label for="board-invite-source">{t("whiteboard.inviteSelect")}</Label> |
| 131 | <div class="flex flex-wrap gap-2"> | 131 | <div class="flex flex-wrap gap-2"> |
| 132 | + <div class="min-w-0 flex-1"> | ||
| 132 | <SearchableSelect | 133 | <SearchableSelect |
| 133 | id="board-invite-source" | 134 | id="board-invite-source" |
| 134 | - class="min-w-0 flex-1" | ||
| 135 | value={picked()} | 135 | value={picked()} |
| 136 | onChange={setPicked} | 136 | onChange={setPicked} |
| 137 | options={options.latest ?? []} | 137 | options={options.latest ?? []} |
| 138 | placeholder={t("whiteboard.inviteSelect")} | 138 | placeholder={t("whiteboard.inviteSelect")} |
| 139 | disabled={options.loading || (options.latest?.length ?? 0) === 0} | 139 | disabled={options.loading || (options.latest?.length ?? 0) === 0} |
| 140 | /> | 140 | /> |
| 141 | - <Button type="button" size="sm" class="rounded-lg" disabled={pending() || !picked()} onClick={() => void invite()}> | 141 | + </div> |
| 142 | + <Button type="button" size="sm" class="h-9 rounded-lg px-4 text-sm touch:h-10" disabled={pending() || !picked()} onClick={() => void invite()}> | ||
| 142 | {t("whiteboard.inviteAction")} | 143 | {t("whiteboard.inviteAction")} |
| 143 | </Button> | 144 | </Button> |
| 144 | </div> | 145 | </div> |
src/components/whiteboard/board-settings-panel.tsxmodified+12 -9
| @@ -131,24 +131,28 @@ export function BoardSettingsPanel(props: { | |||
| 131 | <SidePanel open={props.open} onOpenChange={props.onOpenChange} title={t("whiteboard.edit")} size="wide"> | 131 | <SidePanel open={props.open} onOpenChange={props.onOpenChange} title={t("whiteboard.edit")} size="wide"> |
| 132 | <div class="space-y-6"> | 132 | <div class="space-y-6"> |
| 133 | <Show when={error()}><ErrorAlert message={error()} /></Show> | 133 | <Show when={error()}><ErrorAlert message={error()} /></Show> |
| 134 | - <section class="space-y-3 rounded-lg border border-border/70 bg-card p-4 shadow-sm"> | 134 | + <section class="space-y-3 rounded-xl border border-border-line bg-card p-4 shadow-xs"> |
| 135 | - <div> | 135 | + <h3 class="text-sm font-semibold">{t("whiteboard.titleLabel")}</h3> |
| 136 | - <h3 class="text-sm font-semibold">{t("whiteboard.titleLabel")}</h3> | ||
| 137 | - <p class="mt-1 text-xs text-muted-foreground">{t("whiteboard.edit")}</p> | ||
| 138 | - </div> | ||
| 139 | <div class="grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end"> | 136 | <div class="grid gap-2 sm:grid-cols-[minmax(0,1fr)_auto] sm:items-end"> |
| 140 | <div class="space-y-1.5"> | 137 | <div class="space-y-1.5"> |
| 141 | <Label for="whiteboard-title" class="sr-only">{t("whiteboard.titleLabel")}</Label> | 138 | <Label for="whiteboard-title" class="sr-only">{t("whiteboard.titleLabel")}</Label> |
| 142 | <Input id="whiteboard-title" maxlength={200} value={title()} onInput={(event) => setTitle(event.currentTarget.value)} /> | 139 | <Input id="whiteboard-title" maxlength={200} value={title()} onInput={(event) => setTitle(event.currentTarget.value)} /> |
| 143 | </div> | 140 | </div> |
| 144 | - <Button type="button" size="sm" class="rounded-lg" disabled={pending() || !title().trim() || title().trim() === props.title()} onClick={() => void saveTitle()}> | 141 | + <Button type="button" size="sm" class="h-9 rounded-lg px-4 text-sm touch:h-10" disabled={pending() || !title().trim() || title().trim() === props.title()} onClick={() => void saveTitle()}> |
| 145 | {t("common.save")} | 142 | {t("common.save")} |
| 146 | </Button> | 143 | </Button> |
| 147 | </div> | 144 | </div> |
| 148 | </section> | 145 | </section> |
| 149 | 146 | ||
| 150 | - <section class="space-y-3"> | 147 | + {/* One card: heading, picker, then the roster table. The table's own |
| 151 | - <Show when={props.canManageParticipants()} fallback={<p class="text-xs text-muted-foreground">{t("whiteboard.creator")}</p>}> | 148 | + title is not drawn (DataTable keeps headers off), so the card |
| 149 | + names the section. */} | ||
| 150 | + <section class="space-y-3 rounded-xl border border-border-line bg-card p-4 shadow-xs"> | ||
| 151 | + <div> | ||
| 152 | + <h3 class="text-sm font-semibold">{t("whiteboard.participants")}</h3> | ||
| 153 | + <p class="mt-1 text-xs text-muted-foreground">{t("whiteboard.participantsHint")}</p> | ||
| 154 | + </div> | ||
| 155 | + <Show when={props.canManageParticipants()}> | ||
| 152 | <Show | 156 | <Show |
| 153 | when={props.canSearchPeople()} | 157 | when={props.canSearchPeople()} |
| 154 | fallback={<p class="rounded-lg border border-dashed border-border/70 px-3 py-2 text-xs text-muted-foreground">{t("form.searchNoPermission")}</p>} | 158 | fallback={<p class="rounded-lg border border-dashed border-border/70 px-3 py-2 text-xs text-muted-foreground">{t("form.searchNoPermission")}</p>} |
| @@ -171,7 +175,6 @@ export function BoardSettingsPanel(props: { | |||
| 171 | empty={t("whiteboard.empty")} | 175 | empty={t("whiteboard.empty")} |
| 172 | title={t("whiteboard.participants")} | 176 | title={t("whiteboard.participants")} |
| 173 | description={t("whiteboard.participantsHint")} | 177 | description={t("whiteboard.participantsHint")} |
| 174 | - class="rounded-lg border border-border/70 bg-card p-4 shadow-sm" | ||
| 175 | tableClass="min-w-[26rem]" | 178 | tableClass="min-w-[26rem]" |
| 176 | enableColumnVisibility={false} | 179 | enableColumnVisibility={false} |
| 177 | enableSorting={false} | 180 | enableSorting={false} |
src/components/whiteboard/whiteboard-canvas.tsxmodified+10 -7
| @@ -524,7 +524,7 @@ export function WhiteboardCanvas(props: { | |||
| 524 | ); | 524 | ); |
| 525 | 525 | ||
| 526 | const plainButton = | 526 | const plainButton = |
| 527 | - "flex h-9 w-9 items-center justify-center text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"; | 527 | + "flex h-10 w-10 items-center justify-center text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring sm:h-9 sm:w-9"; |
| 528 | 528 | ||
| 529 | const Section = (sectionProps: { label: string; children: JSX.Element }) => ( | 529 | const Section = (sectionProps: { label: string; children: JSX.Element }) => ( |
| 530 | <div role="group" aria-label={sectionProps.label}> | 530 | <div role="group" aria-label={sectionProps.label}> |
| @@ -592,7 +592,7 @@ export function WhiteboardCanvas(props: { | |||
| 592 | <button | 592 | <button |
| 593 | type="button" | 593 | type="button" |
| 594 | class={cn( | 594 | class={cn( |
| 595 | - "relative flex h-9 w-9 items-center justify-center rounded-md transition-colors sm:h-10 sm:w-10 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring", | 595 | + "relative flex h-10 w-10 items-center justify-center rounded-md transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring", |
| 596 | activeTool() === entry.tool | 596 | activeTool() === entry.tool |
| 597 | ? "bg-primary/15 text-primary-text" | 597 | ? "bg-primary/15 text-primary-text" |
| 598 | : "text-foreground/80 hover:bg-muted", | 598 | : "text-foreground/80 hover:bg-muted", |
| @@ -639,8 +639,8 @@ export function WhiteboardCanvas(props: { | |||
| 639 | <div | 639 | <div |
| 640 | class={cn( | 640 | class={cn( |
| 641 | ISLAND, | 641 | ISLAND, |
| 642 | - "absolute left-2 z-10 w-44 space-y-3 p-3", | 642 | + "absolute left-2 z-10 w-52 space-y-3 p-3 sm:w-44", |
| 643 | - toolbarRow2() ? "top-26" : "top-14", | 643 | + toolbarRow2() ? "top-28" : "top-14", |
| 644 | styleOpen() ? "block" : "hidden sm:block", | 644 | styleOpen() ? "block" : "hidden sm:block", |
| 645 | )} | 645 | )} |
| 646 | > | 646 | > |
| @@ -653,7 +653,7 @@ export function WhiteboardCanvas(props: { | |||
| 653 | aria-label={`${t("draw.color")}: ${t(COLOR_NAMES[swatch])}`} | 653 | aria-label={`${t("draw.color")}: ${t(COLOR_NAMES[swatch])}`} |
| 654 | aria-pressed={color() === swatch} | 654 | aria-pressed={color() === swatch} |
| 655 | class={cn( | 655 | class={cn( |
| 656 | - "h-6 w-6 rounded-md transition-shadow focus-visible:outline-hidden", | 656 | + "h-8 w-8 rounded-md transition-shadow focus-visible:outline-hidden sm:h-6 sm:w-6", |
| 657 | color() === swatch | 657 | color() === swatch |
| 658 | ? "ring-2 ring-primary ring-offset-2 ring-offset-card" | 658 | ? "ring-2 ring-primary ring-offset-2 ring-offset-card" |
| 659 | : "hover:ring-2 hover:ring-border hover:ring-offset-1 hover:ring-offset-card focus-visible:ring-2 focus-visible:ring-ring", | 659 | : "hover:ring-2 hover:ring-border hover:ring-offset-1 hover:ring-offset-card focus-visible:ring-2 focus-visible:ring-ring", |
| @@ -733,7 +733,7 @@ export function WhiteboardCanvas(props: { | |||
| 733 | </div> | 733 | </div> |
| 734 | </Show> | 734 | </Show> |
| 735 | 735 | ||
| 736 | - {/* Bottom-left: zoom, then paper and (phones) the style toggle. */} | 736 | + {/* Bottom-left: zoom, then paper and (phones) the style and full-screen toggles. */} |
| 737 | <div class="absolute bottom-2 left-2 z-10 flex items-center gap-2"> | 737 | <div class="absolute bottom-2 left-2 z-10 flex items-center gap-2"> |
| 738 | <div class={cn(ISLAND, "flex items-center overflow-hidden")}> | 738 | <div class={cn(ISLAND, "flex items-center overflow-hidden")}> |
| 739 | <button type="button" class={plainButton} title={t("draw.zoomOut")} aria-label={t("draw.zoomOut")} onClick={() => zoomBy(1 / ZOOM_STEP)}> | 739 | <button type="button" class={plainButton} title={t("draw.zoomOut")} aria-label={t("draw.zoomOut")} onClick={() => zoomBy(1 / ZOOM_STEP)}> |
| @@ -775,11 +775,14 @@ export function WhiteboardCanvas(props: { | |||
| 775 | <span class="h-4.5 w-4.5 rounded-md border border-border" style={{ "background-color": color() }} /> | 775 | <span class="h-4.5 w-4.5 rounded-md border border-border" style={{ "background-color": color() }} /> |
| 776 | </button> | 776 | </button> |
| 777 | </Show> | 777 | </Show> |
| 778 | + {/* Phones: full screen joins this island — the bottom-right corner | ||
| 779 | + belongs to the app's floating action button there. */} | ||
| 780 | + <FullscreenToggle class="h-10 w-10 sm:hidden" active={fullscreen.active()} onToggle={fullscreen.toggle} /> | ||
| 778 | </div> | 781 | </div> |
| 779 | </div> | 782 | </div> |
| 780 | 783 | ||
| 781 | {/* Bottom-right: full screen. */} | 784 | {/* Bottom-right: full screen. */} |
| 782 | - <div class={cn(ISLAND, "absolute bottom-2 right-2 z-10 overflow-hidden")}> | 785 | + <div class={cn(ISLAND, "absolute bottom-2 right-2 z-10 hidden overflow-hidden sm:block")}> |
| 783 | <FullscreenToggle active={fullscreen.active()} onToggle={fullscreen.toggle} /> | 786 | <FullscreenToggle active={fullscreen.active()} onToggle={fullscreen.toggle} /> |
| 784 | </div> | 787 | </div> |
| 785 | </div> | 788 | </div> |
src/i18n/locales/en.tsmodified+32 -8
| @@ -100,6 +100,8 @@ export const en: Dict = { | |||
| 100 | "classBlueprints.tab": "Grade blueprints", | 100 | "classBlueprints.tab": "Grade blueprints", |
| 101 | "classBlueprints.classesTab": "Classes", | 101 | "classBlueprints.classesTab": "Classes", |
| 102 | "classBlueprints.title": "Grade blueprints", | 102 | "classBlueprints.title": "Grade blueprints", |
| 103 | + "classBlueprints.searchPlaceholder": "Search by grade…", | ||
| 104 | + "search.hint.blueprints": "Matches the grade.", | ||
| 103 | "classBlueprints.subtitle": "Every class at a grade takes this set of courses.", | 105 | "classBlueprints.subtitle": "Every class at a grade takes this set of courses.", |
| 104 | "classBlueprints.new": "New blueprint", | 106 | "classBlueprints.new": "New blueprint", |
| 105 | "classBlueprints.edit": "Edit blueprint", | 107 | "classBlueprints.edit": "Edit blueprint", |
| @@ -541,6 +543,8 @@ export const en: Dict = { | |||
| 541 | "roster.studentsSubtitle": "Every student in the school, with their class.", | 543 | "roster.studentsSubtitle": "Every student in the school, with their class.", |
| 542 | "roster.teachersSubtitle": "Every teacher in the school, the sections they teach and the classes they lead.", | 544 | "roster.teachersSubtitle": "Every teacher in the school, the sections they teach and the classes they lead.", |
| 543 | "roster.searchStudents": "Search student name or username…", | 545 | "roster.searchStudents": "Search student name or username…", |
| 546 | + "roster.searchDirectory": "Search by name, number or class…", | ||
| 547 | + "search.hint.studentDirectory": "Matches the student's name, student number and class.", | ||
| 544 | "roster.searchTeachers": "Search teacher name or username…", | 548 | "roster.searchTeachers": "Search teacher name or username…", |
| 545 | "roster.noTeachers": "No teachers yet.", | 549 | "roster.noTeachers": "No teachers yet.", |
| 546 | "roster.taughtSections": "Sections taught", | 550 | "roster.taughtSections": "Sections taught", |
| @@ -787,6 +791,7 @@ export const en: Dict = { | |||
| 787 | "rollCall.bulkFailed": "{count} rows could not be saved: {reason}", | 791 | "rollCall.bulkFailed": "{count} rows could not be saved: {reason}", |
| 788 | "common.skipToContent": "Skip to content", | 792 | "common.skipToContent": "Skip to content", |
| 789 | "form.fieldRequired": "This field is required.", | 793 | "form.fieldRequired": "This field is required.", |
| 794 | + "form.selectAcademicYear": "Pick an academic year.", | ||
| 790 | "common.close": "Close", | 795 | "common.close": "Close", |
| 791 | "common.dismiss": "Dismiss", | 796 | "common.dismiss": "Dismiss", |
| 792 | "sidePanel.discardTitle": "Discard your changes?", | 797 | "sidePanel.discardTitle": "Discard your changes?", |
| @@ -1242,6 +1247,9 @@ export const en: Dict = { | |||
| 1242 | "notes.addFile": "Add file", | 1247 | "notes.addFile": "Add file", |
| 1243 | "notes.import": "Import", | 1248 | "notes.import": "Import", |
| 1244 | "notes.importHelp": "Upload a PDF, TXT, or Markdown file. Line breaks, page numbers, and noise will be automatically cleaned into a structured note.", | 1249 | "notes.importHelp": "Upload a PDF, TXT, or Markdown file. Line breaks, page numbers, and noise will be automatically cleaned into a structured note.", |
| 1250 | + "notes.importGarbled": "Some content may be unreadable due to OCR/extraction issues. Check the text before creating the note.", | ||
| 1251 | + "notes.importChangeFile": "Change file", | ||
| 1252 | + "notes.importReading": "Reading the file…", | ||
| 1245 | "notes.importReadError": "Text could not be extracted from this file. If it is a scanned PDF, run OCR first.", | 1253 | "notes.importReadError": "Text could not be extracted from this file. If it is a scanned PDF, run OCR first.", |
| 1246 | "notes.draw": "Draw", | 1254 | "notes.draw": "Draw", |
| 1247 | "notes.drawTitle": "Draw a picture", | 1255 | "notes.drawTitle": "Draw a picture", |
| @@ -1398,6 +1406,9 @@ export const en: Dict = { | |||
| 1398 | "appointments.mySlots": "Times I opened", | 1406 | "appointments.mySlots": "Times I opened", |
| 1399 | "appointments.availableSlots": "Teachers’ open times", | 1407 | "appointments.availableSlots": "Teachers’ open times", |
| 1400 | "appointments.requests": "Booking requests", | 1408 | "appointments.requests": "Booking requests", |
| 1409 | + "appointments.allSlots": "Open times", | ||
| 1410 | + "appointments.allSlotsHint": "Every hour teachers opened for meetings.", | ||
| 1411 | + "appointments.allRequestsHint": "Every booking request in the school and its outcome.", | ||
| 1401 | "appointments.myBookings": "My bookings", | 1412 | "appointments.myBookings": "My bookings", |
| 1402 | "appointments.publish": "Open a time", | 1413 | "appointments.publish": "Open a time", |
| 1403 | "appointments.book": "Book", | 1414 | "appointments.book": "Book", |
| @@ -1734,7 +1745,7 @@ export const en: Dict = { | |||
| 1734 | "guide.subtitle": "How the platform fits together, from classes and exams to report cards, notes, and events.", | 1745 | "guide.subtitle": "How the platform fits together, from classes and exams to report cards, notes, and events.", |
| 1735 | "guide.roles.title": "Role permission map", | 1746 | "guide.roles.title": "Role permission map", |
| 1736 | "guide.roles.subtitle": "What each role on the platform can reach and manage.", | 1747 | "guide.roles.subtitle": "What each role on the platform can reach and manage.", |
| 1737 | - "guide.roles.adminTab": "Manager & admin", | 1748 | + "guide.roles.adminTab": "Management", |
| 1738 | "guide.roles.student.heading": "Student study and participation tools", | 1749 | "guide.roles.student.heading": "Student study and participation tools", |
| 1739 | "guide.roles.student.i1": "Keep notes in a private notebook, import PDFs and draw", | 1750 | "guide.roles.student.i1": "Keep notes in a private notebook, import PDFs and draw", |
| 1740 | "guide.roles.student.i2": "Ask in the question pool and write solutions for others", | 1751 | "guide.roles.student.i2": "Ask in the question pool and write solutions for others", |
| @@ -1827,7 +1838,7 @@ export const en: Dict = { | |||
| 1827 | "form.day": "Day", | 1838 | "form.day": "Day", |
| 1828 | "form.datePlaceholder": "DD/MM/YYYY", | 1839 | "form.datePlaceholder": "DD/MM/YYYY", |
| 1829 | "form.mark": "Mark", | 1840 | "form.mark": "Mark", |
| 1830 | - "form.studentId": "Student user id", | 1841 | + "form.studentId": "Student", |
| 1831 | "form.selectStudent": "Select student", | 1842 | "form.selectStudent": "Select student", |
| 1832 | "form.noStudents": "No available students", | 1843 | "form.noStudents": "No available students", |
| 1833 | "form.noTeachers": "No available teachers", | 1844 | "form.noTeachers": "No available teachers", |
| @@ -1841,6 +1852,8 @@ export const en: Dict = { | |||
| 1841 | "form.weightRange": "Weight must be an integer from 1 to 100", | 1852 | "form.weightRange": "Weight must be an integer from 1 to 100", |
| 1842 | "form.markRange": "Mark must be an integer from 0 to 100", | 1853 | "form.markRange": "Mark must be an integer from 0 to 100", |
| 1843 | "events.markedBy": "Recorded by", | 1854 | "events.markedBy": "Recorded by", |
| 1855 | + "events.attendanceSearchHint": "Matches the student's name.", | ||
| 1856 | + "events.createHint": "Set the title, audience and time window.", | ||
| 1844 | "exams.gradedBy": "Graded by", | 1857 | "exams.gradedBy": "Graded by", |
| 1845 | "status.present": "Present", | 1858 | "status.present": "Present", |
| 1846 | "status.absent": "Absent", | 1859 | "status.absent": "Absent", |
| @@ -1880,10 +1893,10 @@ export const en: Dict = { | |||
| 1880 | "courses.weight": "Weight", | 1893 | "courses.weight": "Weight", |
| 1881 | "courses.delete": "Delete course", | 1894 | "courses.delete": "Delete course", |
| 1882 | "courses.kind": "Course type", | 1895 | "courses.kind": "Course type", |
| 1883 | - "courses.kind.course": "Classes", | 1896 | + "courses.kind.course": "Courses", |
| 1884 | - "courses.kind.study": "Study", | 1897 | + "courses.kind.study": "Study sessions", |
| 1885 | - "courses.kind.club": "Club", | 1898 | + "courses.kind.club": "Clubs", |
| 1886 | - "courses.kind.courseSingular": "Class", | 1899 | + "courses.kind.courseSingular": "Course", |
| 1887 | "courses.kind.studySingular": "Study session", | 1900 | "courses.kind.studySingular": "Study session", |
| 1888 | "courses.kind.clubSingular": "Club", | 1901 | "courses.kind.clubSingular": "Club", |
| 1889 | "courses.capacity": "Capacity", | 1902 | "courses.capacity": "Capacity", |
| @@ -1954,7 +1967,7 @@ export const en: Dict = { | |||
| 1954 | "marks.band": "Grade band", | 1967 | "marks.band": "Grade band", |
| 1955 | "marks.bandLabel": "Band {grade}", | 1968 | "marks.bandLabel": "Band {grade}", |
| 1956 | "marks.examCount": "Exams", | 1969 | "marks.examCount": "Exams", |
| 1957 | - "marks.averageCapped": "The average column is filled in for schools of up to {cap} students. Open a student to see their report.", | 1970 | + "marks.averageCapped": "The average column is filled in when up to {cap} students are listed. Pick a class, or open a student to see their report.", |
| 1958 | "marks.courseAvg": "Course average", | 1971 | "marks.courseAvg": "Course average", |
| 1959 | "marks.empty": "Not enrolled in any course yet.", | 1972 | "marks.empty": "Not enrolled in any course yet.", |
| 1960 | "marks.lookup": "Look up a student", | 1973 | "marks.lookup": "Look up a student", |
| @@ -1996,6 +2009,9 @@ export const en: Dict = { | |||
| 1996 | "exams.finalState": "Final state", | 2009 | "exams.finalState": "Final state", |
| 1997 | "exams.finalStateDesc": "Final exam results, progress, and marks.", | 2010 | "exams.finalStateDesc": "Final exam results, progress, and marks.", |
| 1998 | "exams.liveRoster": "Live roster", | 2011 | "exams.liveRoster": "Live roster", |
| 2012 | + "exams.liveSearch": "Search students…", | ||
| 2013 | + "exams.minutesLeft": "{minutes} min", | ||
| 2014 | + "search.hint.liveRoster": "Matches the student's first and last name.", | ||
| 1999 | "exams.notStarted": "Not started", | 2015 | "exams.notStarted": "Not started", |
| 2000 | "exams.lastActivity": "Last activity", | 2016 | "exams.lastActivity": "Last activity", |
| 2001 | "exams.answerSheet": "Answer Sheet", | 2017 | "exams.answerSheet": "Answer Sheet", |
| @@ -2336,7 +2352,7 @@ export const en: Dict = { | |||
| 2336 | "payments.settled": "Settled", | 2352 | "payments.settled": "Settled", |
| 2337 | "terms.title": "Terms", | 2353 | "terms.title": "Terms", |
| 2338 | "terms.subtitle": "Manage academic terms and assign courses to each one.", | 2354 | "terms.subtitle": "Manage academic terms and assign courses to each one.", |
| 2339 | - "terms.create": "Create term", | 2355 | + "terms.create": "New term", |
| 2340 | "terms.edit": "Edit term", | 2356 | "terms.edit": "Edit term", |
| 2341 | "terms.empty": "No terms yet.", | 2357 | "terms.empty": "No terms yet.", |
| 2342 | "terms.term": "Term", | 2358 | "terms.term": "Term", |
| @@ -2409,9 +2425,12 @@ export const en: Dict = { | |||
| 2409 | "search.hint.people": "Matches name, surname, username and user id.", | 2425 | "search.hint.people": "Matches name, surname, username and user id.", |
| 2410 | "search.hint.users": "Matches username, phone, name, e-mail, user id and role.", | 2426 | "search.hint.users": "Matches username, phone, name, e-mail, user id and role.", |
| 2411 | "search.hint.exams": "Matches exam title, description, course, exam kind and status.", | 2427 | "search.hint.exams": "Matches exam title, description, course, exam kind and status.", |
| 2428 | + "search.hint.examResults": "Matches the student’s name and username.", | ||
| 2412 | "search.hint.events": "Matches event title, description, audience and date.", | 2429 | "search.hint.events": "Matches event title, description, audience and date.", |
| 2413 | "search.hint.courses": "Matches course title and description.", | 2430 | "search.hint.courses": "Matches course title and description.", |
| 2414 | "search.hint.courseNotes": "Matches note title and content.", | 2431 | "search.hint.courseNotes": "Matches note title and content.", |
| 2432 | + "search.hint.subjects": "Matches topic name and description.", | ||
| 2433 | + "search.hint.sessions": "Matches the lesson topic.", | ||
| 2415 | "search.hint.classes": "Matches class name, grade and homeroom teacher.", | 2434 | "search.hint.classes": "Matches class name, grade and homeroom teacher.", |
| 2416 | "search.hint.classMembers": "Matches student name, username and student number.", | 2435 | "search.hint.classMembers": "Matches student name, username and student number.", |
| 2417 | "search.hint.bank": "Matches a phrase inside the question text.", | 2436 | "search.hint.bank": "Matches a phrase inside the question text.", |
| @@ -2506,6 +2525,8 @@ export const en: Dict = { | |||
| 2506 | "karne.failed": "Failed", | 2525 | "karne.failed": "Failed", |
| 2507 | "karne.empty": "No karne line for this term yet.", | 2526 | "karne.empty": "No karne line for this term yet.", |
| 2508 | "karne.band": "Band", | 2527 | "karne.band": "Band", |
| 2528 | + "karne.subtitle": "Course averages, grade bands and the year-end result for the chosen term.", | ||
| 2529 | + "attendance.recordCount": "{count} records", | ||
| 2509 | "courses.members": "Members", | 2530 | "courses.members": "Members", |
| 2510 | "courses.memberItem": "member", | 2531 | "courses.memberItem": "member", |
| 2511 | "courses.addMember": "Add member", | 2532 | "courses.addMember": "Add member", |
| @@ -2539,6 +2560,8 @@ export const en: Dict = { | |||
| 2539 | "exams.createSubtitle": "Set the course, term and timing first; you add the questions in the next step.", | 2560 | "exams.createSubtitle": "Set the course, term and timing first; you add the questions in the next step.", |
| 2540 | "homework.gradeStatusPlaceholder": "Choose a status", | 2561 | "homework.gradeStatusPlaceholder": "Choose a status", |
| 2541 | "homework.gradeStatusRequired": "Choose a status before saving.", | 2562 | "homework.gradeStatusRequired": "Choose a status before saving.", |
| 2563 | + "homework.duePast": "The due time must be in the future.", | ||
| 2564 | + "homework.dueTime": "Due time (HH:mm)", | ||
| 2542 | "combobox.showSuggestions": "Show suggestions", | 2565 | "combobox.showSuggestions": "Show suggestions", |
| 2543 | "combobox.suggestions": "Suggestions", | 2566 | "combobox.suggestions": "Suggestions", |
| 2544 | "combobox.optionSelected": "{option}, selected", | 2567 | "combobox.optionSelected": "{option}, selected", |
| @@ -2601,6 +2624,7 @@ export const en: Dict = { | |||
| 2601 | "instances.weightInvalid": "The weight must be a whole number from 1 to 100.", | 2624 | "instances.weightInvalid": "The weight must be a whole number from 1 to 100.", |
| 2602 | "instances.examKind": "Exam kind", | 2625 | "instances.examKind": "Exam kind", |
| 2603 | "instances.addWeight": "Add weight", | 2626 | "instances.addWeight": "Add weight", |
| 2627 | + "instances.noWeights": "No weight rows yet.", | ||
| 2604 | "weeklyPlan.tab": "Weekly plan", | 2628 | "weeklyPlan.tab": "Weekly plan", |
| 2605 | "weeklyPlan.title": "Weekly timetable", | 2629 | "weeklyPlan.title": "Weekly timetable", |
| 2606 | "weeklyPlan.help": "The lesson times that repeat every week.", | 2630 | "weeklyPlan.help": "The lesson times that repeat every week.", |
src/i18n/locales/tr.tsmodified+35 -11
| @@ -86,7 +86,7 @@ export const tr: Dict = { | |||
| 86 | "classGroups.noTeacher": "Atanmadı", | 86 | "classGroups.noTeacher": "Atanmadı", |
| 87 | "classGroups.selectTeacher": "Bir öğretmen seç", | 87 | "classGroups.selectTeacher": "Bir öğretmen seç", |
| 88 | "classGroups.yourClass": "Şube", | 88 | "classGroups.yourClass": "Şube", |
| 89 | - "classGroups.searchPlaceholder": "Şube, sınıf veya danışman ara…", | 89 | + "classGroups.searchPlaceholder": "Şube, sınıf veya sınıf öğretmeni ara…", |
| 90 | "classGroups.studentsCount": "{count} öğrenci", | 90 | "classGroups.studentsCount": "{count} öğrenci", |
| 91 | "classGroups.noGrade": "Sınıf yok", | 91 | "classGroups.noGrade": "Sınıf yok", |
| 92 | "classGroups.attendanceRate": "Devam", | 92 | "classGroups.attendanceRate": "Devam", |
| @@ -96,6 +96,8 @@ export const tr: Dict = { | |||
| 96 | "classBlueprints.tab": "Seviye şablonları", | 96 | "classBlueprints.tab": "Seviye şablonları", |
| 97 | "classBlueprints.classesTab": "Şubeler", | 97 | "classBlueprints.classesTab": "Şubeler", |
| 98 | "classBlueprints.title": "Seviye şablonları", | 98 | "classBlueprints.title": "Seviye şablonları", |
| 99 | + "classBlueprints.searchPlaceholder": "Seviye ara…", | ||
| 100 | + "search.hint.blueprints": "Seviye adında arar.", | ||
| 99 | "classBlueprints.subtitle": "Bir seviyedeki her şube bu ders kümesini alır.", | 101 | "classBlueprints.subtitle": "Bir seviyedeki her şube bu ders kümesini alır.", |
| 100 | "classBlueprints.new": "Yeni şablon", | 102 | "classBlueprints.new": "Yeni şablon", |
| 101 | "classBlueprints.edit": "Şablonu düzenle", | 103 | "classBlueprints.edit": "Şablonu düzenle", |
| @@ -537,6 +539,8 @@ export const tr: Dict = { | |||
| 537 | "roster.studentsSubtitle": "Kurumdaki tüm öğrenciler, sınıflarıyla birlikte.", | 539 | "roster.studentsSubtitle": "Kurumdaki tüm öğrenciler, sınıflarıyla birlikte.", |
| 538 | "roster.teachersSubtitle": "Kurumdaki öğretmenler, verdikleri dersler ve sınıf öğretmenliği yaptıkları sınıflar.", | 540 | "roster.teachersSubtitle": "Kurumdaki öğretmenler, verdikleri dersler ve sınıf öğretmenliği yaptıkları sınıflar.", |
| 539 | "roster.searchStudents": "Öğrenci adı veya kullanıcı adı ara…", | 541 | "roster.searchStudents": "Öğrenci adı veya kullanıcı adı ara…", |
| 542 | + "roster.searchDirectory": "Ad, numara veya sınıf ara…", | ||
| 543 | + "search.hint.studentDirectory": "Öğrencinin adında, öğrenci numarasında ve sınıfında arar.", | ||
| 540 | "roster.searchTeachers": "Öğretmen adı veya kullanıcı adı ara…", | 544 | "roster.searchTeachers": "Öğretmen adı veya kullanıcı adı ara…", |
| 541 | "roster.noTeachers": "Henüz öğretmen yok.", | 545 | "roster.noTeachers": "Henüz öğretmen yok.", |
| 542 | "roster.taughtSections": "Verdiği dersler", | 546 | "roster.taughtSections": "Verdiği dersler", |
| @@ -783,6 +787,7 @@ export const tr: Dict = { | |||
| 783 | "rollCall.bulkFailed": "{count} satır kaydedilemedi: {reason}", | 787 | "rollCall.bulkFailed": "{count} satır kaydedilemedi: {reason}", |
| 784 | "common.skipToContent": "İçeriğe geç", | 788 | "common.skipToContent": "İçeriğe geç", |
| 785 | "form.fieldRequired": "Bu alan zorunlu.", | 789 | "form.fieldRequired": "Bu alan zorunlu.", |
| 790 | + "form.selectAcademicYear": "Bir eğitim yılı seç.", | ||
| 786 | "common.close": "Kapat", | 791 | "common.close": "Kapat", |
| 787 | "common.dismiss": "Gizle", | 792 | "common.dismiss": "Gizle", |
| 788 | "sidePanel.discardTitle": "Değişiklikler atılsın mı?", | 793 | "sidePanel.discardTitle": "Değişiklikler atılsın mı?", |
| @@ -1238,6 +1243,9 @@ export const tr: Dict = { | |||
| 1238 | "notes.addFile": "Dosya ekle", | 1243 | "notes.addFile": "Dosya ekle", |
| 1239 | "notes.import": "İçe aktar", | 1244 | "notes.import": "İçe aktar", |
| 1240 | "notes.importHelp": "PDF, TXT veya Markdown dosyanızı yükleyin. Satır sonları, sayfa numaraları ve gürültüler temizlenip düzenli bir nota dönüştürülür.", | 1245 | "notes.importHelp": "PDF, TXT veya Markdown dosyanızı yükleyin. Satır sonları, sayfa numaraları ve gürültüler temizlenip düzenli bir nota dönüştürülür.", |
| 1246 | + "notes.importGarbled": "OCR/metin çıkarma sorunları nedeniyle bazı içerikler okunamıyor olabilir. Notu oluşturmadan önce metni kontrol et.", | ||
| 1247 | + "notes.importChangeFile": "Dosyayı değiştir", | ||
| 1248 | + "notes.importReading": "Dosya okunuyor…", | ||
| 1241 | "notes.importReadError": "Bu dosyadan metin çıkarılamadı. Taranmış PDF ise önce OCR uygulayın.", | 1249 | "notes.importReadError": "Bu dosyadan metin çıkarılamadı. Taranmış PDF ise önce OCR uygulayın.", |
| 1242 | "notes.draw": "Çiz", | 1250 | "notes.draw": "Çiz", |
| 1243 | "notes.drawTitle": "Resim çiz", | 1251 | "notes.drawTitle": "Resim çiz", |
| @@ -1394,6 +1402,9 @@ export const tr: Dict = { | |||
| 1394 | "appointments.mySlots": "Açtığım saatler", | 1402 | "appointments.mySlots": "Açtığım saatler", |
| 1395 | "appointments.availableSlots": "Öğretmenlerin açık saatleri", | 1403 | "appointments.availableSlots": "Öğretmenlerin açık saatleri", |
| 1396 | "appointments.requests": "Randevu talepleri", | 1404 | "appointments.requests": "Randevu talepleri", |
| 1405 | + "appointments.allSlots": "Açık saatler", | ||
| 1406 | + "appointments.allSlotsHint": "Öğretmenlerin görüşmeye açtığı tüm saatler.", | ||
| 1407 | + "appointments.allRequestsHint": "Okuldaki tüm randevu talepleri ve kararları.", | ||
| 1397 | "appointments.myBookings": "Randevularım", | 1408 | "appointments.myBookings": "Randevularım", |
| 1398 | "appointments.publish": "Saat aç", | 1409 | "appointments.publish": "Saat aç", |
| 1399 | "appointments.book": "Randevu al", | 1410 | "appointments.book": "Randevu al", |
| @@ -1435,7 +1446,7 @@ export const tr: Dict = { | |||
| 1435 | "appointments.proposal": "Saat önerisi", | 1446 | "appointments.proposal": "Saat önerisi", |
| 1436 | "appointments.date": "Tarih", | 1447 | "appointments.date": "Tarih", |
| 1437 | "appointments.status": "Durum", | 1448 | "appointments.status": "Durum", |
| 1438 | - "appointments.publishSubtitle": "Öğrencilerin alabileceği bir saat aralığı sunun. İsterseniz haftalık tekrarlayın.", | 1449 | + "appointments.publishSubtitle": "Öğrencilerin alabileceği bir saat aralığı aç; istersen haftalık tekrarla.", |
| 1439 | "appointments.bookSubtitle": "Öğretmene neden görüşmek istediğinizi belirtin.", | 1450 | "appointments.bookSubtitle": "Öğretmene neden görüşmek istediğinizi belirtin.", |
| 1440 | "appointments.rescheduleSubtitle": "Farklı bir saat önerin; talep eden bunu kabul edebilir ya da reddedebilir.", | 1451 | "appointments.rescheduleSubtitle": "Farklı bir saat önerin; talep eden bunu kabul edebilir ya da reddedebilir.", |
| 1441 | "appointments.reasonPlaceholder": "Ne hakkında konuşmak istiyorsunuz?", | 1452 | "appointments.reasonPlaceholder": "Ne hakkında konuşmak istiyorsunuz?", |
| @@ -1730,7 +1741,7 @@ export const tr: Dict = { | |||
| 1730 | "guide.subtitle": "Derslerden sınavlara, karnelerden notlara ve etkinliklere kadar platformun nasıl bir arada çalıştığı.", | 1741 | "guide.subtitle": "Derslerden sınavlara, karnelerden notlara ve etkinliklere kadar platformun nasıl bir arada çalıştığı.", |
| 1731 | "guide.roles.title": "Rol bazlı yetki haritası", | 1742 | "guide.roles.title": "Rol bazlı yetki haritası", |
| 1732 | "guide.roles.subtitle": "Platformdaki her bir rolün erişebildiği ve yönetebildiği alanlar.", | 1743 | "guide.roles.subtitle": "Platformdaki her bir rolün erişebildiği ve yönetebildiği alanlar.", |
| 1733 | - "guide.roles.adminTab": "Yönetici ve admin", | 1744 | + "guide.roles.adminTab": "Yönetim", |
| 1734 | "guide.roles.student.heading": "Öğrenci çalışma ve katılım araçları", | 1745 | "guide.roles.student.heading": "Öğrenci çalışma ve katılım araçları", |
| 1735 | "guide.roles.student.i1": "Kendi özel defterinde not tutma, PDF aktarma ve çizim yapma", | 1746 | "guide.roles.student.i1": "Kendi özel defterinde not tutma, PDF aktarma ve çizim yapma", |
| 1736 | "guide.roles.student.i2": "Soru havuzunda soru sorma, diğer sorulara çözüm yazma", | 1747 | "guide.roles.student.i2": "Soru havuzunda soru sorma, diğer sorulara çözüm yazma", |
| @@ -1823,7 +1834,7 @@ export const tr: Dict = { | |||
| 1823 | "form.day": "Gün", | 1834 | "form.day": "Gün", |
| 1824 | "form.datePlaceholder": "GG/AA/YYYY", | 1835 | "form.datePlaceholder": "GG/AA/YYYY", |
| 1825 | "form.mark": "Not", | 1836 | "form.mark": "Not", |
| 1826 | - "form.studentId": "Öğrenci kullanıcı id", | 1837 | + "form.studentId": "Öğrenci", |
| 1827 | "form.selectStudent": "Öğrenci seç", | 1838 | "form.selectStudent": "Öğrenci seç", |
| 1828 | "form.noStudents": "Uygun öğrenci yok", | 1839 | "form.noStudents": "Uygun öğrenci yok", |
| 1829 | "form.noTeachers": "Uygun öğretmen yok", | 1840 | "form.noTeachers": "Uygun öğretmen yok", |
| @@ -1837,6 +1848,8 @@ export const tr: Dict = { | |||
| 1837 | "form.weightRange": "Ağırlık 1–100 arası tam sayı olmalı", | 1848 | "form.weightRange": "Ağırlık 1–100 arası tam sayı olmalı", |
| 1838 | "form.markRange": "Not 0–100 arası tam sayı olmalı", | 1849 | "form.markRange": "Not 0–100 arası tam sayı olmalı", |
| 1839 | "events.markedBy": "Kaydeden", | 1850 | "events.markedBy": "Kaydeden", |
| 1851 | + "events.attendanceSearchHint": "Öğrencinin adında arar.", | ||
| 1852 | + "events.createHint": "Başlığı, hedef kitleyi ve zaman aralığını belirle.", | ||
| 1840 | "exams.gradedBy": "Notlayan", | 1853 | "exams.gradedBy": "Notlayan", |
| 1841 | "status.present": "Var", | 1854 | "status.present": "Var", |
| 1842 | "status.absent": "Yok", | 1855 | "status.absent": "Yok", |
| @@ -1877,8 +1890,8 @@ export const tr: Dict = { | |||
| 1877 | "courses.delete": "Dersi sil", | 1890 | "courses.delete": "Dersi sil", |
| 1878 | "courses.kind": "Ders türü", | 1891 | "courses.kind": "Ders türü", |
| 1879 | "courses.kind.course": "Dersler", | 1892 | "courses.kind.course": "Dersler", |
| 1880 | - "courses.kind.study": "Etüt", | 1893 | + "courses.kind.study": "Etütler", |
| 1881 | - "courses.kind.club": "Kulüp", | 1894 | + "courses.kind.club": "Kulüpler", |
| 1882 | "courses.kind.courseSingular": "Ders", | 1895 | "courses.kind.courseSingular": "Ders", |
| 1883 | "courses.kind.studySingular": "Etüt", | 1896 | "courses.kind.studySingular": "Etüt", |
| 1884 | "courses.kind.clubSingular": "Kulüp", | 1897 | "courses.kind.clubSingular": "Kulüp", |
| @@ -1943,14 +1956,14 @@ export const tr: Dict = { | |||
| 1943 | "homework.noAnswer": "Yazılı cevap yok.", | 1956 | "homework.noAnswer": "Yazılı cevap yok.", |
| 1944 | "homework.status.done": "Tamamlandı", | 1957 | "homework.status.done": "Tamamlandı", |
| 1945 | "homework.status.incomplete": "Eksik", | 1958 | "homework.status.incomplete": "Eksik", |
| 1946 | - "homework.status.missing": "Yok", | 1959 | + "homework.status.missing": "Yapılmadı", |
| 1947 | "marks.title": "Karnem", | 1960 | "marks.title": "Karnem", |
| 1948 | "marks.subtitle": "Kayıtlı olduğunuz tüm derslerdeki ağırlıklı not ortalamalarınız.", | 1961 | "marks.subtitle": "Kayıtlı olduğunuz tüm derslerdeki ağırlıklı not ortalamalarınız.", |
| 1949 | "marks.overall": "Genel ortalama", | 1962 | "marks.overall": "Genel ortalama", |
| 1950 | "marks.band": "Not bandı", | 1963 | "marks.band": "Not bandı", |
| 1951 | "marks.bandLabel": "Bant {grade}", | 1964 | "marks.bandLabel": "Bant {grade}", |
| 1952 | "marks.examCount": "Sınav sayısı", | 1965 | "marks.examCount": "Sınav sayısı", |
| 1953 | - "marks.averageCapped": "Ortalama sütunu en fazla {cap} öğrencili okullarda doldurulur. Raporu görmek için öğrenciyi aç.", | 1966 | + "marks.averageCapped": "Ortalama sütunu en fazla {cap} öğrenci listelendiğinde doldurulur. Bir sınıf seç ya da raporu görmek için öğrenciyi aç.", |
| 1954 | "marks.courseAvg": "Ders ortalaması", | 1967 | "marks.courseAvg": "Ders ortalaması", |
| 1955 | "marks.empty": "Henüz hiçbir derse kayıtlı değilsin.", | 1968 | "marks.empty": "Henüz hiçbir derse kayıtlı değilsin.", |
| 1956 | "marks.lookup": "Öğrenci ara", | 1969 | "marks.lookup": "Öğrenci ara", |
| @@ -1992,6 +2005,9 @@ export const tr: Dict = { | |||
| 1992 | "exams.finalState": "Son durum", | 2005 | "exams.finalState": "Son durum", |
| 1993 | "exams.finalStateDesc": "Sınav sonuçları, ilerleme ve notlar.", | 2006 | "exams.finalStateDesc": "Sınav sonuçları, ilerleme ve notlar.", |
| 1994 | "exams.liveRoster": "Canlı liste", | 2007 | "exams.liveRoster": "Canlı liste", |
| 2008 | + "exams.liveSearch": "Öğrenci ara…", | ||
| 2009 | + "exams.minutesLeft": "{minutes} dk", | ||
| 2010 | + "search.hint.liveRoster": "Öğrencinin adında ve soyadında arar.", | ||
| 1995 | "exams.notStarted": "Başlamadı", | 2011 | "exams.notStarted": "Başlamadı", |
| 1996 | "exams.lastActivity": "Son hareket", | 2012 | "exams.lastActivity": "Son hareket", |
| 1997 | "exams.answerSheet": "Cevap Kâğıdı", | 2013 | "exams.answerSheet": "Cevap Kâğıdı", |
| @@ -2332,7 +2348,7 @@ export const tr: Dict = { | |||
| 2332 | "payments.settled": "Borçsuz", | 2348 | "payments.settled": "Borçsuz", |
| 2333 | "terms.title": "Dönemler", | 2349 | "terms.title": "Dönemler", |
| 2334 | "terms.subtitle": "Akademik dönemleri yönetin ve dersleri ilgili dönemlere atayın.", | 2350 | "terms.subtitle": "Akademik dönemleri yönetin ve dersleri ilgili dönemlere atayın.", |
| 2335 | - "terms.create": "Dönem oluştur", | 2351 | + "terms.create": "Yeni dönem", |
| 2336 | "terms.edit": "Dönemi düzenle", | 2352 | "terms.edit": "Dönemi düzenle", |
| 2337 | "terms.empty": "Henüz dönem yok.", | 2353 | "terms.empty": "Henüz dönem yok.", |
| 2338 | "terms.term": "Dönem", | 2354 | "terms.term": "Dönem", |
| @@ -2340,7 +2356,7 @@ export const tr: Dict = { | |||
| 2340 | "terms.dateRequired": "Başlangıç ve bitiş tarihi gerekli.", | 2356 | "terms.dateRequired": "Başlangıç ve bitiş tarihi gerekli.", |
| 2341 | "terms.archive": "Dönemi arşivle", | 2357 | "terms.archive": "Dönemi arşivle", |
| 2342 | "terms.unarchive": "Dönemi yeniden aç", | 2358 | "terms.unarchive": "Dönemi yeniden aç", |
| 2343 | - "terms.archived": "Arşivli", | 2359 | + "terms.archived": "Arşivlendi", |
| 2344 | "sessions.title": "Ders oturumları", | 2360 | "sessions.title": "Ders oturumları", |
| 2345 | "sessions.subtitle": "Ders oturumlarını planlayın ve her ders için yoklama alın.", | 2361 | "sessions.subtitle": "Ders oturumlarını planlayın ve her ders için yoklama alın.", |
| 2346 | "sessions.topic": "Konu", | 2362 | "sessions.topic": "Konu", |
| @@ -2405,10 +2421,13 @@ export const tr: Dict = { | |||
| 2405 | "search.hint.people": "Ad, soyad, kullan\u0131c\u0131 ad\u0131 ve kullan\u0131c\u0131 ID'sinde arar.", | 2421 | "search.hint.people": "Ad, soyad, kullan\u0131c\u0131 ad\u0131 ve kullan\u0131c\u0131 ID'sinde arar.", |
| 2406 | "search.hint.users": "Kullan\u0131c\u0131 ad\u0131, telefon, ad, e-posta, kullan\u0131c\u0131 ID'si ve rolde arar.", | 2422 | "search.hint.users": "Kullan\u0131c\u0131 ad\u0131, telefon, ad, e-posta, kullan\u0131c\u0131 ID'si ve rolde arar.", |
| 2407 | "search.hint.exams": "S\u0131nav ad\u0131, a\u00e7\u0131klama, ders, s\u0131nav t\u00fcr\u00fc ve durumda arar.", | 2423 | "search.hint.exams": "S\u0131nav ad\u0131, a\u00e7\u0131klama, ders, s\u0131nav t\u00fcr\u00fc ve durumda arar.", |
| 2424 | + "search.hint.examResults": "Öğrencinin adında ve kullanıcı adında arar.", | ||
| 2408 | "search.hint.events": "Etkinlik ad\u0131, a\u00e7\u0131klama, kat\u0131l\u0131mc\u0131 kitlesi ve tarihte arar.", | 2425 | "search.hint.events": "Etkinlik ad\u0131, a\u00e7\u0131klama, kat\u0131l\u0131mc\u0131 kitlesi ve tarihte arar.", |
| 2409 | "search.hint.courses": "Ders ad\u0131 ve a\u00e7\u0131klamas\u0131nda arar.", | 2426 | "search.hint.courses": "Ders ad\u0131 ve a\u00e7\u0131klamas\u0131nda arar.", |
| 2410 | "search.hint.courseNotes": "Not ba\u015fl\u0131\u011f\u0131 ve i\u00e7eri\u011finde arar.", | 2427 | "search.hint.courseNotes": "Not ba\u015fl\u0131\u011f\u0131 ve i\u00e7eri\u011finde arar.", |
| 2411 | - "search.hint.classes": "\u015eube ad\u0131, s\u0131n\u0131f d\u00fczeyi ve dan\u0131\u015fman \u00f6\u011fretmende arar.", | 2428 | + "search.hint.subjects": "Konu ad\u0131 ve a\u00e7\u0131klamas\u0131nda arar.", |
| 2429 | + "search.hint.sessions": "Ders oturumunun konusunda arar.", | ||
| 2430 | + "search.hint.classes": "\u015eube ad\u0131, s\u0131n\u0131f d\u00fczeyi ve s\u0131n\u0131f \u00f6\u011fretmeninde arar.", | ||
| 2412 | "search.hint.classMembers": "Öğrenci adı, kullanıcı adı ve öğrenci numarasında arar.", | 2431 | "search.hint.classMembers": "Öğrenci adı, kullanıcı adı ve öğrenci numarasında arar.", |
| 2413 | "search.hint.bank": "Soru metninde ge\u00e7en bir ifadeyi arar.", | 2432 | "search.hint.bank": "Soru metninde ge\u00e7en bir ifadeyi arar.", |
| 2414 | "search.hint.whiteboards": "A\u00e7\u0131k olan sayfadaki tahta ba\u015fl\u0131klar\u0131nda arar.", | 2433 | "search.hint.whiteboards": "A\u00e7\u0131k olan sayfadaki tahta ba\u015fl\u0131klar\u0131nda arar.", |
| @@ -2502,6 +2521,8 @@ export const tr: Dict = { | |||
| 2502 | "karne.failed": "Kaldı", | 2521 | "karne.failed": "Kaldı", |
| 2503 | "karne.empty": "Bu döneme ait karne satırı yok.", | 2522 | "karne.empty": "Bu döneme ait karne satırı yok.", |
| 2504 | "karne.band": "Not aralığı", | 2523 | "karne.band": "Not aralığı", |
| 2524 | + "karne.subtitle": "Seçtiğin dönemin ders ortalamaları, not aralıkları ve yıl sonu sonucu.", | ||
| 2525 | + "attendance.recordCount": "{count} kayıt", | ||
| 2505 | "courses.members": "Üyeler", | 2526 | "courses.members": "Üyeler", |
| 2506 | "courses.memberItem": "üye", | 2527 | "courses.memberItem": "üye", |
| 2507 | "courses.addMember": "Üye ekle", | 2528 | "courses.addMember": "Üye ekle", |
| @@ -2535,6 +2556,8 @@ export const tr: Dict = { | |||
| 2535 | "exams.createSubtitle": "Önce ders, dönem ve zamanlamayı belirle; soruları bir sonraki adımda eklersin.", | 2556 | "exams.createSubtitle": "Önce ders, dönem ve zamanlamayı belirle; soruları bir sonraki adımda eklersin.", |
| 2536 | "homework.gradeStatusPlaceholder": "Durum seç", | 2557 | "homework.gradeStatusPlaceholder": "Durum seç", |
| 2537 | "homework.gradeStatusRequired": "Kaydetmeden önce bir durum seç.", | 2558 | "homework.gradeStatusRequired": "Kaydetmeden önce bir durum seç.", |
| 2559 | + "homework.duePast": "Son teslim gelecekte bir zaman olmalı.", | ||
| 2560 | + "homework.dueTime": "Son teslim saati (SS:DD)", | ||
| 2538 | "combobox.showSuggestions": "Önerileri göster", | 2561 | "combobox.showSuggestions": "Önerileri göster", |
| 2539 | "combobox.suggestions": "Öneriler", | 2562 | "combobox.suggestions": "Öneriler", |
| 2540 | "combobox.optionSelected": "{option}, seçili", | 2563 | "combobox.optionSelected": "{option}, seçili", |
| @@ -2597,6 +2620,7 @@ export const tr: Dict = { | |||
| 2597 | "instances.weightInvalid": "Ağırlık 1 ile 100 arasında bir tam sayı olmalı.", | 2620 | "instances.weightInvalid": "Ağırlık 1 ile 100 arasında bir tam sayı olmalı.", |
| 2598 | "instances.examKind": "Sınav türü", | 2621 | "instances.examKind": "Sınav türü", |
| 2599 | "instances.addWeight": "Ağırlık ekle", | 2622 | "instances.addWeight": "Ağırlık ekle", |
| 2623 | + "instances.noWeights": "Henüz ağırlık satırı yok.", | ||
| 2600 | "weeklyPlan.tab": "Haftalık plan", | 2624 | "weeklyPlan.tab": "Haftalık plan", |
| 2601 | "weeklyPlan.title": "Haftalık ders planı", | 2625 | "weeklyPlan.title": "Haftalık ders planı", |
| 2602 | "weeklyPlan.help": "Her hafta tekrarlayan ders saatleri.", | 2626 | "weeklyPlan.help": "Her hafta tekrarlayan ders saatleri.", |
src/i18n/messages.tsmodified+24 -0
| @@ -89,6 +89,8 @@ export type MessageKey = | |||
| 89 | | "classBlueprints.tab" | 89 | | "classBlueprints.tab" |
| 90 | | "classBlueprints.classesTab" | 90 | | "classBlueprints.classesTab" |
| 91 | | "classBlueprints.title" | 91 | | "classBlueprints.title" |
| 92 | + | "classBlueprints.searchPlaceholder" | ||
| 93 | + | "search.hint.blueprints" | ||
| 92 | | "classBlueprints.subtitle" | 94 | | "classBlueprints.subtitle" |
| 93 | | "classBlueprints.new" | 95 | | "classBlueprints.new" |
| 94 | | "classBlueprints.edit" | 96 | | "classBlueprints.edit" |
| @@ -477,6 +479,8 @@ export type MessageKey = | |||
| 477 | | "roster.studentsSubtitle" | 479 | | "roster.studentsSubtitle" |
| 478 | | "roster.teachersSubtitle" | 480 | | "roster.teachersSubtitle" |
| 479 | | "roster.searchStudents" | 481 | | "roster.searchStudents" |
| 482 | + | "roster.searchDirectory" | ||
| 483 | + | "search.hint.studentDirectory" | ||
| 480 | | "roster.searchTeachers" | 484 | | "roster.searchTeachers" |
| 481 | | "roster.noTeachers" | 485 | | "roster.noTeachers" |
| 482 | | "roster.taughtSections" | 486 | | "roster.taughtSections" |
| @@ -774,6 +778,7 @@ export type MessageKey = | |||
| 774 | | "rollCall.bulkFailed" | 778 | | "rollCall.bulkFailed" |
| 775 | | "common.skipToContent" | 779 | | "common.skipToContent" |
| 776 | | "form.fieldRequired" | 780 | | "form.fieldRequired" |
| 781 | + | "form.selectAcademicYear" | ||
| 777 | | "common.close" | 782 | | "common.close" |
| 778 | | "common.dismiss" | 783 | | "common.dismiss" |
| 779 | | "sidePanel.discardTitle" | 784 | | "sidePanel.discardTitle" |
| @@ -1229,6 +1234,9 @@ export type MessageKey = | |||
| 1229 | | "notes.addFile" | 1234 | | "notes.addFile" |
| 1230 | | "notes.import" | 1235 | | "notes.import" |
| 1231 | | "notes.importHelp" | 1236 | | "notes.importHelp" |
| 1237 | + | "notes.importGarbled" | ||
| 1238 | + | "notes.importChangeFile" | ||
| 1239 | + | "notes.importReading" | ||
| 1232 | | "notes.importReadError" | 1240 | | "notes.importReadError" |
| 1233 | | "notes.draw" | 1241 | | "notes.draw" |
| 1234 | | "notes.drawTitle" | 1242 | | "notes.drawTitle" |
| @@ -1727,6 +1735,8 @@ export type MessageKey = | |||
| 1727 | | "form.weightRange" | 1735 | | "form.weightRange" |
| 1728 | | "form.markRange" | 1736 | | "form.markRange" |
| 1729 | | "events.markedBy" | 1737 | | "events.markedBy" |
| 1738 | + | "events.attendanceSearchHint" | ||
| 1739 | + | "events.createHint" | ||
| 1730 | | "exams.gradedBy" | 1740 | | "exams.gradedBy" |
| 1731 | | "status.present" | 1741 | | "status.present" |
| 1732 | | "status.absent" | 1742 | | "status.absent" |
| @@ -1882,6 +1892,9 @@ export type MessageKey = | |||
| 1882 | | "exams.finalState" | 1892 | | "exams.finalState" |
| 1883 | | "exams.finalStateDesc" | 1893 | | "exams.finalStateDesc" |
| 1884 | | "exams.liveRoster" | 1894 | | "exams.liveRoster" |
| 1895 | + | "exams.liveSearch" | ||
| 1896 | + | "exams.minutesLeft" | ||
| 1897 | + | "search.hint.liveRoster" | ||
| 1885 | | "exams.notStarted" | 1898 | | "exams.notStarted" |
| 1886 | | "exams.lastActivity" | 1899 | | "exams.lastActivity" |
| 1887 | | "exams.answerSheet" | 1900 | | "exams.answerSheet" |
| @@ -2302,9 +2315,12 @@ export type MessageKey = | |||
| 2302 | | "search.hint.people" | 2315 | | "search.hint.people" |
| 2303 | | "search.hint.users" | 2316 | | "search.hint.users" |
| 2304 | | "search.hint.exams" | 2317 | | "search.hint.exams" |
| 2318 | + | "search.hint.examResults" | ||
| 2305 | | "search.hint.events" | 2319 | | "search.hint.events" |
| 2306 | | "search.hint.courses" | 2320 | | "search.hint.courses" |
| 2307 | | "search.hint.courseNotes" | 2321 | | "search.hint.courseNotes" |
| 2322 | + | "search.hint.subjects" | ||
| 2323 | + | "search.hint.sessions" | ||
| 2308 | | "search.hint.classes" | 2324 | | "search.hint.classes" |
| 2309 | | "search.hint.classMembers" | 2325 | | "search.hint.classMembers" |
| 2310 | | "search.hint.bank" | 2326 | | "search.hint.bank" |
| @@ -2377,6 +2393,9 @@ export type MessageKey = | |||
| 2377 | | "appointments.mySlots" | 2393 | | "appointments.mySlots" |
| 2378 | | "appointments.availableSlots" | 2394 | | "appointments.availableSlots" |
| 2379 | | "appointments.requests" | 2395 | | "appointments.requests" |
| 2396 | + | "appointments.allSlots" | ||
| 2397 | + | "appointments.allSlotsHint" | ||
| 2398 | + | "appointments.allRequestsHint" | ||
| 2380 | | "appointments.myBookings" | 2399 | | "appointments.myBookings" |
| 2381 | | "appointments.publish" | 2400 | | "appointments.publish" |
| 2382 | | "appointments.book" | 2401 | | "appointments.book" |
| @@ -2486,6 +2505,8 @@ export type MessageKey = | |||
| 2486 | | "karne.failed" | 2505 | | "karne.failed" |
| 2487 | | "karne.empty" | 2506 | | "karne.empty" |
| 2488 | | "karne.band" | 2507 | | "karne.band" |
| 2508 | + | "karne.subtitle" | ||
| 2509 | + | "attendance.recordCount" | ||
| 2489 | | "courses.members" | 2510 | | "courses.members" |
| 2490 | | "courses.memberItem" | 2511 | | "courses.memberItem" |
| 2491 | | "courses.addMember" | 2512 | | "courses.addMember" |
| @@ -2519,6 +2540,8 @@ export type MessageKey = | |||
| 2519 | | "exams.createSubtitle" | 2540 | | "exams.createSubtitle" |
| 2520 | | "homework.gradeStatusPlaceholder" | 2541 | | "homework.gradeStatusPlaceholder" |
| 2521 | | "homework.gradeStatusRequired" | 2542 | | "homework.gradeStatusRequired" |
| 2543 | + | "homework.duePast" | ||
| 2544 | + | "homework.dueTime" | ||
| 2522 | | "combobox.showSuggestions" | 2545 | | "combobox.showSuggestions" |
| 2523 | | "combobox.suggestions" | 2546 | | "combobox.suggestions" |
| 2524 | | "combobox.optionSelected" | 2547 | | "combobox.optionSelected" |
| @@ -2581,6 +2604,7 @@ export type MessageKey = | |||
| 2581 | | "instances.weightInvalid" | 2604 | | "instances.weightInvalid" |
| 2582 | | "instances.examKind" | 2605 | | "instances.examKind" |
| 2583 | | "instances.addWeight" | 2606 | | "instances.addWeight" |
| 2607 | + | "instances.noWeights" | ||
| 2584 | | "weeklyPlan.tab" | 2608 | | "weeklyPlan.tab" |
| 2585 | | "weeklyPlan.title" | 2609 | | "weeklyPlan.title" |
| 2586 | | "weeklyPlan.help" | 2610 | | "weeklyPlan.help" |
src/index.cssmodified+7 -3
| @@ -322,7 +322,9 @@ | |||
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | @utility detail-action-group { | 324 | @utility detail-action-group { |
| 325 | - @apply flex w-full flex-wrap items-center gap-1.5 rounded-lg border border-border/80 bg-card p-1.5 shadow-sm sm:w-auto; | 325 | + /* A plain row: the pill buttons inside carry their own borders, and a |
| 326 | + * boxed frame around them read as one more, squarer control. */ | ||
| 327 | + @apply flex w-full flex-wrap items-center gap-2 sm:w-auto; | ||
| 326 | } | 328 | } |
| 327 | 329 | ||
| 328 | @utility detail-action-divider { | 330 | @utility detail-action-divider { |
| @@ -422,12 +424,14 @@ | |||
| 422 | @apply sticky bottom-0 -mx-5 mb-0 justify-end border-t border-border bg-background px-5 py-3; | 424 | @apply sticky bottom-0 -mx-5 mb-0 justify-end border-t border-border bg-background px-5 py-3; |
| 423 | } | 425 | } |
| 424 | 426 | ||
| 427 | + /* Save / Cancel: touch-sized (h-10) on phones and touch screens, h-9 on | ||
| 428 | + a desktop pointer. */ | ||
| 425 | & form > .flex:last-child button { | 429 | & form > .flex:last-child button { |
| 426 | - @apply h-9 rounded-md px-4 font-medium; | 430 | + @apply h-9 rounded-md px-4 font-medium touch:h-10; |
| 427 | } | 431 | } |
| 428 | 432 | ||
| 429 | & form > .flex.flex-wrap:last-child button { | 433 | & form > .flex.flex-wrap:last-child button { |
| 430 | - @apply h-9 rounded-md px-4 font-medium; | 434 | + @apply h-9 rounded-md px-4 font-medium touch:h-10; |
| 431 | } | 435 | } |
| 432 | } | 436 | } |
| 433 | 437 | ||
src/lib/instance-labels.test.tsmodified+25 -9
| @@ -6,16 +6,22 @@ vi.mock("@/api/instances", () => ({ | |||
| 6 | getInstanceById: async (id: string) => { | 6 | getInstanceById: async (id: string) => { |
| 7 | calls.push(`instance:${id}`); | 7 | calls.push(`instance:${id}`); |
| 8 | if (id === "missing") throw new Error("404"); | 8 | if (id === "missing") throw new Error("404"); |
| 9 | - return { id, course: id === "i2" ? "c-math" : "c-math", class: id === "i2" ? "k-9a" : "k-10b" }; | 9 | + // The instance carries its resolved display title, so no course read. |
| 10 | - }, | 10 | + return { id, course: "c-math", class: id === "i2" ? "k-9a" : "k-10b", title: "Matematik" }; |
| 11 | -})); | ||
| 12 | -vi.mock("@/api/courses", () => ({ | ||
| 13 | - getCourseById: async (id: string) => { | ||
| 14 | - calls.push(`course:${id}`); | ||
| 15 | - return { id, title: "Matematik" }; | ||
| 16 | }, | 11 | }, |
| 17 | })); | 12 | })); |
| 18 | vi.mock("@/api/classes", () => ({ | 13 | vi.mock("@/api/classes", () => ({ |
| 14 | + getClasses: async () => { | ||
| 15 | + calls.push("classes:list"); | ||
| 16 | + return { items: [{ id: "k-9a", name: "9-A" }, { id: "k-10b", name: "10-B" }], total: 2, limit: 200, offset: 0 }; | ||
| 17 | + }, | ||
| 18 | + getClassInstances: async (classId: string) => { | ||
| 19 | + calls.push(`class-instances:${classId}`); | ||
| 20 | + const items = classId === "k-9a" | ||
| 21 | + ? [{ id: "i2", course: "c-math", class: "k-9a", title: "Matematik" }] | ||
| 22 | + : [{ id: "i1", course: "c-math", class: "k-10b", title: "Matematik" }, { id: "i3", course: "c-fiz", class: "k-10b", title: "Fizik" }]; | ||
| 23 | + return { items, total: items.length, limit: 200, offset: 0 }; | ||
| 24 | + }, | ||
| 19 | getClassById: async (id: string) => { | 25 | getClassById: async (id: string) => { |
| 20 | calls.push(`class:${id}`); | 26 | calls.push(`class:${id}`); |
| 21 | return { id, name: id === "k-9a" ? "9-A" : "10-B" }; | 27 | return { id, name: id === "k-9a" ? "9-A" : "10-B" }; |
| @@ -36,8 +42,9 @@ describe("instance labels", () => { | |||
| 36 | const labels = await loadInstanceLabels(["i1", "i2", "i1"], "admin"); | 42 | const labels = await loadInstanceLabels(["i1", "i2", "i1"], "admin"); |
| 37 | expect(labels.get("i1")?.label).toBe("Matematik — 10-B"); | 43 | expect(labels.get("i1")?.label).toBe("Matematik — 10-B"); |
| 38 | expect(labels.get("i2")?.label).toBe("Matematik — 9-A"); | 44 | expect(labels.get("i2")?.label).toBe("Matematik — 9-A"); |
| 39 | - // The shared course is read once. | 45 | + // No per-course or per-class reads: one class list covers every section. |
| 40 | - expect(calls.filter((call) => call === "course:c-math")).toHaveLength(1); | 46 | + expect(calls.some((call) => call.startsWith("course:") || call.startsWith("class:"))).toBe(false); |
| 47 | + expect(calls.filter((call) => call === "classes:list")).toHaveLength(1); | ||
| 41 | }); | 48 | }); |
| 42 | 49 | ||
| 43 | it("reads a student's class names from /classes/me, never /classes/{id}", async () => { | 50 | it("reads a student's class names from /classes/me, never /classes/{id}", async () => { |
| @@ -59,4 +66,13 @@ describe("instance labels", () => { | |||
| 59 | expect(formatInstanceLabel(null, "9-A")).toBe("9-A"); | 66 | expect(formatInstanceLabel(null, "9-A")).toBe("9-A"); |
| 60 | expect(formatInstanceLabel(null, null)).toBe(""); | 67 | expect(formatInstanceLabel(null, null)).toBe(""); |
| 61 | }); | 68 | }); |
| 69 | + | ||
| 70 | + it("reads the school's sections class by class when labels outnumber classes", async () => { | ||
| 71 | + const labels = await loadInstanceLabels(["i1", "i2", "i3"], "admin"); | ||
| 72 | + expect(labels.get("i3")?.label).toBe("Fizik — 10-B"); | ||
| 73 | + expect(labels.get("i2")?.label).toBe("Matematik — 9-A"); | ||
| 74 | + // Two classes, three sections: two list reads instead of three instance reads. | ||
| 75 | + expect(calls.filter((call) => call.startsWith("instance:"))).toHaveLength(0); | ||
| 76 | + expect(calls.filter((call) => call.startsWith("class-instances:"))).toHaveLength(2); | ||
| 77 | + }); | ||
| 62 | }); | 78 | }); |
src/lib/instance-labels.tsmodified+105 -26
| @@ -1,8 +1,7 @@ | |||
| 1 | import { createEffect, createSignal, onCleanup } from "solid-js"; | 1 | import { createEffect, createSignal, onCleanup } from "solid-js"; |
| 2 | -import { getClassById, getMyClasses } from "@/api/classes"; | 2 | +import { getClassById, getClassInstances, getClasses, getMyClasses } from "@/api/classes"; |
| 3 | -import { getCourseById } from "@/api/courses"; | ||
| 4 | import { getInstanceById } from "@/api/instances"; | 3 | import { getInstanceById } from "@/api/instances"; |
| 5 | -import type { Role } from "@/api/client"; | 4 | +import type { ClassCourse, ClassGroup, Role } from "@/api/client"; |
| 6 | import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; | 5 | import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; |
| 7 | import { hasMinRole } from "@/lib/roles"; | 6 | import { hasMinRole } from "@/lib/roles"; |
| 8 | 7 | ||
| @@ -15,10 +14,11 @@ import { hasMinRole } from "@/lib/roles"; | |||
| 15 | * row through here instead of showing the catalog title alone. | 14 | * row through here instead of showing the catalog title alone. |
| 16 | * | 15 | * |
| 17 | * Reads, all cached for the tab (a section never changes its course or class): | 16 | * Reads, all cached for the tab (a section never changes its course or class): |
| 18 | - * - `GET /instances/{id}` for the course and class ids, | 17 | + * - `GET /instances/{id}`: ids plus the resolved display `title` (override, |
| 19 | - * - `GET /courses/{id}` for the catalog title, | 18 | + * else offering, else catalog), so no per-course read is needed; |
| 20 | - * - the class name: `GET /classes/{id}` for teacher+ (that route is teacher+ | 19 | + * - the class name: one `GET /classes` list for teacher+, `GET /classes/me` |
| 21 | - * only), `GET /classes/me` once for anyone else. | 20 | + * once for anyone else; a class missing from the list falls back to |
| 21 | + * `GET /classes/{id}`. | ||
| 22 | * A read the caller may not make just leaves that part out of the label. | 22 | * A read the caller may not make just leaves that part out of the label. |
| 23 | */ | 23 | */ |
| 24 | export type InstanceLabel = { | 24 | export type InstanceLabel = { |
| @@ -30,27 +30,100 @@ export type InstanceLabel = { | |||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | const instanceCache = new Map<string, Promise<InstanceLabel | null>>(); | 32 | const instanceCache = new Map<string, Promise<InstanceLabel | null>>(); |
| 33 | -const courseCache = new Map<string, Promise<string | null>>(); | ||
| 34 | const classCache = new Map<string, Promise<string | null>>(); | 33 | const classCache = new Map<string, Promise<string | null>>(); |
| 35 | let myClassesCache: Promise<Map<string, string>> | null = null; | 34 | let myClassesCache: Promise<Map<string, string>> | null = null; |
| 35 | +let allClassesCache: Promise<Map<string, string>> | null = null; | ||
| 36 | +let classListCache: Promise<ClassGroup[]> | null = null; | ||
| 37 | +let schoolSectionsCache: Promise<{ klass: ClassGroup; sections: ClassCourse[] }[]> | null = null; | ||
| 38 | +let schoolIndexCache: Promise<boolean> | null = null; | ||
| 36 | 39 | ||
| 37 | -function courseTitle(id: string): Promise<string | null> { | 40 | +/** Teacher+: the school's class list, read once per tab. */ |
| 38 | - let hit = courseCache.get(id); | 41 | +export function classList(): Promise<ClassGroup[]> { |
| 39 | - if (!hit) { | 42 | + if (!classListCache) { |
| 40 | - hit = getCourseById(id).then( | 43 | + classListCache = getClasses({ limit: 200 }).then( |
| 41 | - (course) => course.title, | 44 | + (page) => page.items, |
| 42 | () => { | 45 | () => { |
| 43 | - courseCache.delete(id); | 46 | + classListCache = null; |
| 44 | - return null; | 47 | + return []; |
| 45 | }, | 48 | }, |
| 46 | ); | 49 | ); |
| 47 | - courseCache.set(id, hit); | ||
| 48 | } | 50 | } |
| 49 | - return hit; | 51 | + return classListCache; |
| 52 | +} | ||
| 53 | + | ||
| 54 | +/** | ||
| 55 | + * Teacher+: every section of the school, class by class (there is no | ||
| 56 | + * school-wide section route), read once per tab and shared by the label | ||
| 57 | + * cache and the section pickers. A class that cannot be read comes back empty. | ||
| 58 | + */ | ||
| 59 | +export function loadSchoolSections(): Promise<{ klass: ClassGroup; sections: ClassCourse[] }[]> { | ||
| 60 | + if (!schoolSectionsCache) { | ||
| 61 | + schoolSectionsCache = classList().then((classes) => | ||
| 62 | + mapConcurrent(classes, FAN_OUT_LIMIT, (klass) => | ||
| 63 | + getClassInstances(klass.id, { limit: 200 }).then( | ||
| 64 | + (page) => ({ klass, sections: page.items }), | ||
| 65 | + () => ({ klass, sections: [] as ClassCourse[] }), | ||
| 66 | + ), | ||
| 67 | + ), | ||
| 68 | + ).catch(() => { | ||
| 69 | + schoolSectionsCache = null; | ||
| 70 | + return []; | ||
| 71 | + }); | ||
| 72 | + } | ||
| 73 | + return schoolSectionsCache; | ||
| 74 | +} | ||
| 75 | + | ||
| 76 | +/** | ||
| 77 | + * Teacher+ only: read every section of the school through the class list — | ||
| 78 | + * one request per class — and seed the label cache with all of them. Used | ||
| 79 | + * when a page needs more labels than there are classes (a dashboard or a | ||
| 80 | + * calendar full of homework), where it replaces one read per section. | ||
| 81 | + */ | ||
| 82 | +function seedSchoolIndex(role: Role | undefined): Promise<boolean> { | ||
| 83 | + if (!schoolIndexCache) { | ||
| 84 | + schoolIndexCache = loadSchoolSections().then((pages) => { | ||
| 85 | + if (pages.length === 0) return false; | ||
| 86 | + for (const entry of pages) { | ||
| 87 | + for (const instance of entry.sections) { | ||
| 88 | + const title = instance.title?.trim() || null; | ||
| 89 | + const label = formatInstanceLabel(title, entry.klass.name); | ||
| 90 | + if (!label) continue; | ||
| 91 | + instanceCache.set(`${role ?? ""}:${instance.id}`, Promise.resolve({ | ||
| 92 | + course: instance.course, | ||
| 93 | + class: instance.class, | ||
| 94 | + courseTitle: title, | ||
| 95 | + className: entry.klass.name, | ||
| 96 | + label, | ||
| 97 | + })); | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + return true; | ||
| 101 | + }).catch(() => { | ||
| 102 | + schoolIndexCache = null; | ||
| 103 | + return false; | ||
| 104 | + }); | ||
| 105 | + } | ||
| 106 | + return schoolIndexCache; | ||
| 50 | } | 107 | } |
| 51 | 108 | ||
| 52 | function className(id: string, role: Role | undefined): Promise<string | null> { | 109 | function className(id: string, role: Role | undefined): Promise<string | null> { |
| 53 | if (hasMinRole(role, "teacher")) { | 110 | if (hasMinRole(role, "teacher")) { |
| 111 | + if (!allClassesCache) { | ||
| 112 | + allClassesCache = classList().then((classes) => new Map(classes.map((klass) => [klass.id, klass.name]))); | ||
| 113 | + } | ||
| 114 | + return allClassesCache.then((names) => names.get(id) ?? classById(id)); | ||
| 115 | + } | ||
| 116 | + if (!myClassesCache) { | ||
| 117 | + myClassesCache = getMyClasses().then( | ||
| 118 | + (page) => new Map(page.items.map((klass) => [klass.id, klass.name])), | ||
| 119 | + () => new Map<string, string>(), | ||
| 120 | + ); | ||
| 121 | + } | ||
| 122 | + return myClassesCache.then((names) => names.get(id) ?? null); | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +function classById(id: string): Promise<string | null> { | ||
| 126 | + { | ||
| 54 | let hit = classCache.get(id); | 127 | let hit = classCache.get(id); |
| 55 | if (!hit) { | 128 | if (!hit) { |
| 56 | hit = getClassById(id).then( | 129 | hit = getClassById(id).then( |
| @@ -64,13 +137,6 @@ function className(id: string, role: Role | undefined): Promise<string | null> { | |||
| 64 | } | 137 | } |
| 65 | return hit; | 138 | return hit; |
| 66 | } | 139 | } |
| 67 | - if (!myClassesCache) { | ||
| 68 | - myClassesCache = getMyClasses().then( | ||
| 69 | - (page) => new Map(page.items.map((klass) => [klass.id, klass.name])), | ||
| 70 | - () => new Map<string, string>(), | ||
| 71 | - ); | ||
| 72 | - } | ||
| 73 | - return myClassesCache.then((names) => names.get(id) ?? null); | ||
| 74 | } | 140 | } |
| 75 | 141 | ||
| 76 | /** Joins a course title and a class name; either may be missing. */ | 142 | /** Joins a course title and a class name; either may be missing. */ |
| @@ -86,7 +152,8 @@ export function loadInstanceLabel(id: string, role: Role | undefined): Promise<I | |||
| 86 | hit = Promise.resolve() | 152 | hit = Promise.resolve() |
| 87 | .then(() => getInstanceById(id)) | 153 | .then(() => getInstanceById(id)) |
| 88 | .then(async (instance) => { | 154 | .then(async (instance) => { |
| 89 | - const [title, klass] = await Promise.all([courseTitle(instance.course), className(instance.class, role)]); | 155 | + const title = instance.title?.trim() || null; |
| 156 | + const klass = await className(instance.class, role); | ||
| 90 | // A part that failed to load (a rate limit, a blip) is not kept, so | 157 | // A part that failed to load (a rate limit, a blip) is not kept, so |
| 91 | // the next list asks again instead of showing a half label all session. | 158 | // the next list asks again instead of showing a half label all session. |
| 92 | if (title == null || klass == null) instanceCache.delete(key); | 159 | if (title == null || klass == null) instanceCache.delete(key); |
| @@ -106,6 +173,15 @@ export function loadInstanceLabel(id: string, role: Role | undefined): Promise<I | |||
| 106 | /** Labels for a bounded set of instance ids, fetched a few at a time. */ | 173 | /** Labels for a bounded set of instance ids, fetched a few at a time. */ |
| 107 | export async function loadInstanceLabels(ids: readonly string[], role: Role | undefined): Promise<Map<string, InstanceLabel>> { | 174 | export async function loadInstanceLabels(ids: readonly string[], role: Role | undefined): Promise<Map<string, InstanceLabel>> { |
| 108 | const unique = [...new Set(ids)]; | 175 | const unique = [...new Set(ids)]; |
| 176 | + // Many labels at once: reading the school's sections class by class is | ||
| 177 | + // cheaper than one read per section, once they outnumber the classes. | ||
| 178 | + if (hasMinRole(role, "teacher")) { | ||
| 179 | + const uncached = unique.filter((id) => !instanceCache.has(`${role ?? ""}:${id}`)); | ||
| 180 | + if (uncached.length > 0) { | ||
| 181 | + const classes = await classList(); | ||
| 182 | + if (classes.length > 0 && uncached.length > classes.length) await seedSchoolIndex(role); | ||
| 183 | + } | ||
| 184 | + } | ||
| 109 | const labels = await mapConcurrent(unique, FAN_OUT_LIMIT, (id) => loadInstanceLabel(id, role)); | 185 | const labels = await mapConcurrent(unique, FAN_OUT_LIMIT, (id) => loadInstanceLabel(id, role)); |
| 110 | const out = new Map<string, InstanceLabel>(); | 186 | const out = new Map<string, InstanceLabel>(); |
| 111 | unique.forEach((id, index) => { | 187 | unique.forEach((id, index) => { |
| @@ -147,7 +223,10 @@ export function createInstanceLabels(ids: () => readonly string[], role: () => R | |||
| 147 | /** Test hook: forget every cached read. */ | 223 | /** Test hook: forget every cached read. */ |
| 148 | export function resetInstanceLabelCache(): void { | 224 | export function resetInstanceLabelCache(): void { |
| 149 | instanceCache.clear(); | 225 | instanceCache.clear(); |
| 150 | - courseCache.clear(); | ||
| 151 | classCache.clear(); | 226 | classCache.clear(); |
| 152 | myClassesCache = null; | 227 | myClassesCache = null; |
| 228 | + allClassesCache = null; | ||
| 229 | + classListCache = null; | ||
| 230 | + schoolSectionsCache = null; | ||
| 231 | + schoolIndexCache = null; | ||
| 153 | } | 232 | } |
src/lib/instance-options.tsmodified+16 -30
| @@ -1,8 +1,8 @@ | |||
| 1 | -import { getClasses, getClassInstances, getMyClasses } from "@/api/classes"; | 1 | +import { getClasses, getMyClasses } from "@/api/classes"; |
| 2 | -import { getCourseById } from "@/api/courses"; | ||
| 3 | import { getMyInstances } from "@/api/instances"; | 2 | import { getMyInstances } from "@/api/instances"; |
| 4 | import type { ClassGroup, Role } from "@/api/client"; | 3 | import type { ClassGroup, Role } from "@/api/client"; |
| 5 | import { hasMinRole } from "@/lib/roles"; | 4 | import { hasMinRole } from "@/lib/roles"; |
| 5 | +import { loadSchoolSections } from "@/lib/instance-labels"; | ||
| 6 | import { compareClasses } from "@/lib/student-directory"; | 6 | import { compareClasses } from "@/lib/student-directory"; |
| 7 | 7 | ||
| 8 | /** One pickable section: "<ders> — <şube>", plus the ids behind the label. */ | 8 | /** One pickable section: "<ders> — <şube>", plus the ids behind the label. */ |
| @@ -25,24 +25,18 @@ export async function loadInstanceOptions(role: Role | undefined): Promise<Insta | |||
| 25 | if (!role) return []; | 25 | if (!role) return []; |
| 26 | const office = hasMinRole(role, "manager"); | 26 | const office = hasMinRole(role, "manager"); |
| 27 | 27 | ||
| 28 | - const rows: { id: string; course: string; class: string }[] = []; | 28 | + // Each section carries its resolved display title, so no per-course read. |
| 29 | + const rows: { id: string; course: string; class: string; title: string }[] = []; | ||
| 29 | const classesById = new Map<string, ClassGroup>(); | 30 | const classesById = new Map<string, ClassGroup>(); |
| 30 | 31 | ||
| 31 | if (office) { | 32 | if (office) { |
| 32 | - const classes = (await getClasses({ limit: 200 })).items; | 33 | + // Shared with the label cache: the school is walked once per tab. One |
| 33 | - const perClass = await Promise.all( | 34 | + // unreadable şube comes back empty instead of emptying the picker. |
| 34 | - classes.map(async (klass) => { | 35 | + for (const { klass, sections } of await loadSchoolSections()) { |
| 35 | - classesById.set(klass.id, klass); | 36 | + classesById.set(klass.id, klass); |
| 36 | - try { | 37 | + for (const instance of sections) { |
| 37 | - return (await getClassInstances(klass.id, { limit: 200 })).items; | 38 | + rows.push({ id: instance.id, course: instance.course, class: instance.class, title: instance.title }); |
| 38 | - } catch { | 39 | + } |
| 39 | - // One unreadable şube must not empty the whole picker. | ||
| 40 | - return []; | ||
| 41 | - } | ||
| 42 | - }), | ||
| 43 | - ); | ||
| 44 | - for (const instance of perClass.flat()) { | ||
| 45 | - rows.push({ id: instance.id, course: instance.course, class: instance.class }); | ||
| 46 | } | 40 | } |
| 47 | } else { | 41 | } else { |
| 48 | const [mine, classes] = await Promise.all([ | 42 | const [mine, classes] = await Promise.all([ |
| @@ -53,25 +47,15 @@ export async function loadInstanceOptions(role: Role | undefined): Promise<Insta | |||
| 53 | ]); | 47 | ]); |
| 54 | for (const klass of classes.items) classesById.set(klass.id, klass); | 48 | for (const klass of classes.items) classesById.set(klass.id, klass); |
| 55 | for (const instance of mine.items) { | 49 | for (const instance of mine.items) { |
| 56 | - rows.push({ id: instance.id, course: instance.course, class: instance.class }); | 50 | + rows.push({ id: instance.id, course: instance.course, class: instance.class, title: instance.title }); |
| 57 | } | 51 | } |
| 58 | } | 52 | } |
| 59 | 53 | ||
| 60 | - const titles = new Map<string, string>(); | ||
| 61 | - await Promise.all( | ||
| 62 | - [...new Set(rows.map((row) => row.course))].map(async (courseId) => { | ||
| 63 | - try { | ||
| 64 | - titles.set(courseId, (await getCourseById(courseId)).title); | ||
| 65 | - } catch { | ||
| 66 | - // Shows as a dash in the label below, never the raw id. | ||
| 67 | - } | ||
| 68 | - }), | ||
| 69 | - ); | ||
| 70 | 54 | ||
| 71 | // Class by class (9-A, 9-B, 10-A…), then by ders inside a class, the order a | 55 | // Class by class (9-A, 9-B, 10-A…), then by ders inside a class, the order a |
| 72 | // school reads its timetable in; a şube this caller cannot name goes last. | 56 | // school reads its timetable in; a şube this caller cannot name goes last. |
| 73 | const collator = new Intl.Collator("tr", { numeric: true, sensitivity: "base" }); | 57 | const collator = new Intl.Collator("tr", { numeric: true, sensitivity: "base" }); |
| 74 | - const courseTitle = (row: { course: string }) => titles.get(row.course) ?? "—"; | 58 | + const courseTitle = (row: { title: string }) => row.title?.trim() || "—"; |
| 75 | return rows | 59 | return rows |
| 76 | .sort((a, b) => { | 60 | .sort((a, b) => { |
| 77 | const classA = classesById.get(a.class); | 61 | const classA = classesById.get(a.class); |
| @@ -85,7 +69,9 @@ export async function loadInstanceOptions(role: Role | undefined): Promise<Insta | |||
| 85 | return collator.compare(courseTitle(a), courseTitle(b)); | 69 | return collator.compare(courseTitle(a), courseTitle(b)); |
| 86 | }) | 70 | }) |
| 87 | .map((row) => ({ | 71 | .map((row) => ({ |
| 88 | - ...row, | 72 | + id: row.id, |
| 73 | + course: row.course, | ||
| 74 | + class: row.class, | ||
| 89 | label: `${courseTitle(row)} — ${classesById.get(row.class)?.name ?? "—"}`, | 75 | label: `${courseTitle(row)} — ${classesById.get(row.class)?.name ?? "—"}`, |
| 90 | })); | 76 | })); |
| 91 | } | 77 | } |
src/lib/scroll-restore.tsadded+59 -0
| @@ -0,0 +1,59 @@ | |||
| 1 | +import { createEffect, onCleanup, onMount } from "solid-js"; | ||
| 2 | + | ||
| 3 | +/** The router's id for the current history entry (TanStack keeps it in `history.state`). */ | ||
| 4 | +function historyEntry(): string { | ||
| 5 | + const state = history.state as Record<string, unknown> | null; | ||
| 6 | + return String(state?.__TSR_key ?? state?.key ?? ""); | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * Put the page back where the reader left it when they return to the same | ||
| 11 | + * history entry (Back from a detail page). The router's own restoration runs | ||
| 12 | + * before a list's rows arrive, so it clamps to a short page and a long list | ||
| 13 | + * came back near the top. This remembers the window offset per entry and | ||
| 14 | + * re-applies it once `ready()` says the rows are drawn — never on a fresh | ||
| 15 | + * visit, which gets a new entry id. | ||
| 16 | + */ | ||
| 17 | +export function createScrollRestore(key: string | null, ready: () => boolean) { | ||
| 18 | + if (!key || typeof window === "undefined") return; | ||
| 19 | + const name = `scroll:${key}`; | ||
| 20 | + | ||
| 21 | + let saveTimer: ReturnType<typeof setTimeout> | undefined; | ||
| 22 | + const save = () => { | ||
| 23 | + clearTimeout(saveTimer); | ||
| 24 | + saveTimer = setTimeout(() => { | ||
| 25 | + try { | ||
| 26 | + sessionStorage.setItem(name, JSON.stringify({ y: Math.round(window.scrollY), entry: historyEntry() })); | ||
| 27 | + } catch { | ||
| 28 | + // storage blocked: no restore, nothing else breaks | ||
| 29 | + } | ||
| 30 | + }, 150); | ||
| 31 | + }; | ||
| 32 | + onMount(() => { | ||
| 33 | + window.addEventListener("scroll", save, { passive: true }); | ||
| 34 | + onCleanup(() => { | ||
| 35 | + clearTimeout(saveTimer); | ||
| 36 | + window.removeEventListener("scroll", save); | ||
| 37 | + }); | ||
| 38 | + }); | ||
| 39 | + | ||
| 40 | + let restored = false; | ||
| 41 | + createEffect(() => { | ||
| 42 | + if (restored || !ready()) return; | ||
| 43 | + restored = true; | ||
| 44 | + try { | ||
| 45 | + const saved = JSON.parse(sessionStorage.getItem(name) ?? "null") as { y?: number; entry?: string } | null; | ||
| 46 | + const target = saved?.y; | ||
| 47 | + if (!target || saved.entry !== historyEntry()) return; | ||
| 48 | + // Correct once the rows are laid out, and once more after late content | ||
| 49 | + // (avatars, badges, images) settles. | ||
| 50 | + const settle = () => { | ||
| 51 | + if (Math.abs(window.scrollY - target) > 8) window.scrollTo(0, target); | ||
| 52 | + }; | ||
| 53 | + requestAnimationFrame(settle); | ||
| 54 | + setTimeout(settle, 300); | ||
| 55 | + } catch { | ||
| 56 | + // malformed entry: start at the top | ||
| 57 | + } | ||
| 58 | + }); | ||
| 59 | +} | ||
src/pages/admin-user-detail-page.tsxmodified+9 -7
| @@ -17,7 +17,9 @@ import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | |||
| 17 | import { DetailField } from "@/components/ui/detail-field"; | 17 | import { DetailField } from "@/components/ui/detail-field"; |
| 18 | import { IconEdit, IconExternalLink, IconUsers } from "@/components/ui/icons"; | 18 | import { IconEdit, IconExternalLink, IconUsers } from "@/components/ui/icons"; |
| 19 | import { PageSpinner } from "@/components/ui/page-spinner"; | 19 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 20 | +import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | ||
| 20 | import { Select } from "@/components/ui/select"; | 21 | import { Select } from "@/components/ui/select"; |
| 22 | +import { cn } from "@/lib/cn"; | ||
| 21 | import { ROLES, hasMinRole } from "@/lib/roles"; | 23 | import { ROLES, hasMinRole } from "@/lib/roles"; |
| 22 | import { genderLabel } from "@/lib/gender"; | 24 | import { genderLabel } from "@/lib/gender"; |
| 23 | import { useAuth } from "@/stores/auth-context"; | 25 | import { useAuth } from "@/stores/auth-context"; |
| @@ -90,19 +92,19 @@ function AdminUserDetailContent() { | |||
| 90 | class="[&>div]:min-h-0" | 92 | class="[&>div]:min-h-0" |
| 91 | actions={ | 93 | actions={ |
| 92 | <> | 94 | <> |
| 93 | - <Link to="/profile/$userId" params={{ userId: current().id }}> | 95 | + <Link to="/profile/$userId" params={{ userId: current().id }} class="contents"> |
| 94 | - <Button type="button" variant="outline" class="h-9 rounded-lg"> | 96 | + <Button type="button" variant="outline" size="sm"> |
| 95 | <IconExternalLink class="h-4 w-4" /> | 97 | <IconExternalLink class="h-4 w-4" /> |
| 96 | {t("profile.viewProfile")} | 98 | {t("profile.viewProfile")} |
| 97 | </Button> | 99 | </Button> |
| 98 | </Link> | 100 | </Link> |
| 99 | <Show when={current().role === "parent"}> | 101 | <Show when={current().role === "parent"}> |
| 100 | - <Button type="button" variant="outline" class="h-9 rounded-lg" onClick={() => setStudentsOpen(true)}> | 102 | + <Button type="button" variant="outline" size="sm" onClick={() => setStudentsOpen(true)}> |
| 101 | <IconUsers class="h-4 w-4" /> | 103 | <IconUsers class="h-4 w-4" /> |
| 102 | {t("parentLink.manage")} | 104 | {t("parentLink.manage")} |
| 103 | </Button> | 105 | </Button> |
| 104 | </Show> | 106 | </Show> |
| 105 | - <Button type="button" class="h-9 rounded-lg" onClick={() => setEditing(true)}> | 107 | + <Button type="button" size="sm" onClick={() => setEditing(true)}> |
| 106 | <IconEdit class="h-4 w-4" /> | 108 | <IconEdit class="h-4 w-4" /> |
| 107 | {t("common.edit")} | 109 | {t("common.edit")} |
| 108 | </Button> | 110 | </Button> |
| @@ -154,10 +156,10 @@ function AdminUserDetailContent() { | |||
| 154 | <DetailField label={t("admin.id")} value={current().id} mono wrap /> | 156 | <DetailField label={t("admin.id")} value={current().id} mono wrap /> |
| 155 | <div class="min-w-0 space-y-1.5"> | 157 | <div class="min-w-0 space-y-1.5"> |
| 156 | <p class="text-xs font-medium text-muted-foreground">{t("admin.role")}</p> | 158 | <p class="text-xs font-medium text-muted-foreground">{t("admin.role")}</p> |
| 157 | - <div class="flex gap-2"> | 159 | + {/* The role picker and its Update button are toolbar pills. */} |
| 160 | + <div class={cn("flex gap-2", TOOLBAR_SLOT)}> | ||
| 158 | <Select | 161 | <Select |
| 159 | aria-label={t("admin.role")} | 162 | aria-label={t("admin.role")} |
| 160 | - class="h-9" | ||
| 161 | value={pendingRole()} | 163 | value={pendingRole()} |
| 162 | disabled={current().id === auth.user()?.id} | 164 | disabled={current().id === auth.user()?.id} |
| 163 | onChange={(event) => setPendingRole(event.currentTarget.value as Role)} | 165 | onChange={(event) => setPendingRole(event.currentTarget.value as Role)} |
| @@ -165,7 +167,7 @@ function AdminUserDetailContent() { | |||
| 165 | {ROLES.map((role) => <option value={role}>{t(`role.${role}` as MessageKey)}</option>)} | 167 | {ROLES.map((role) => <option value={role}>{t(`role.${role}` as MessageKey)}</option>)} |
| 166 | </Select> | 168 | </Select> |
| 167 | <Button | 169 | <Button |
| 168 | - class="h-9 shrink-0 rounded-lg" | 170 | + size="sm" |
| 169 | disabled={current().id === auth.user()?.id || pendingRole() === current().role} | 171 | disabled={current().id === auth.user()?.id || pendingRole() === current().role} |
| 170 | onClick={() => setRoleConfirmOpen(true)} | 172 | onClick={() => setRoleConfirmOpen(true)} |
| 171 | > | 173 | > |
src/pages/appointments-page.tsxmodified+23 -9
| @@ -61,7 +61,7 @@ function AppointmentsContent() { | |||
| 61 | const { locale } = usePreferences(); | 61 | const { locale } = usePreferences(); |
| 62 | const now = createNow(); | 62 | const now = createNow(); |
| 63 | const [error, setError] = createSignal(""); | 63 | const [error, setError] = createSignal(""); |
| 64 | - const [, setFlash] = createFlash(); | 64 | + const [flash, setFlash] = createFlash(); |
| 65 | const [showPublish, setShowPublish] = createSignal(false); | 65 | const [showPublish, setShowPublish] = createSignal(false); |
| 66 | const [section, setSection] = createSignal<"appointments" | "availability">("appointments"); | 66 | const [section, setSection] = createSignal<"appointments" | "availability">("appointments"); |
| 67 | const [bookSlot, setBookSlot] = createSignal<AppointmentSlot | null>(null); | 67 | const [bookSlot, setBookSlot] = createSignal<AppointmentSlot | null>(null); |
| @@ -208,7 +208,19 @@ function AppointmentsContent() { | |||
| 208 | const mySlots = () => slots(); | 208 | const mySlots = () => slots(); |
| 209 | const slotBooking = (slotId: string) => appts().find((a) => a.slot === slotId && isLive(a.status)); | 209 | const slotBooking = (slotId: string) => appts().find((a) => a.slot === slotId && isLive(a.status)); |
| 210 | 210 | ||
| 211 | + // Managers see every teacher's slots and requests, so those tables name the | ||
| 212 | + // teacher; a teacher's own view does not need the column. | ||
| 213 | + const teacherColumn = <T extends { teacher: AppointmentSlot["teacher"] | Appointment["teacher"] }>(): ColumnDef<T>[] => | ||
| 214 | + isManager() | ||
| 215 | + ? [{ | ||
| 216 | + id: "teacher", | ||
| 217 | + header: t("appointments.teacher"), | ||
| 218 | + cell: (cell) => <span class="block truncate">{personLabel(cell.row.original.teacher)}</span>, | ||
| 219 | + }] | ||
| 220 | + : []; | ||
| 221 | + | ||
| 211 | const slotColumns = createMemo<ColumnDef<AppointmentSlot>[]>(() => [ | 222 | const slotColumns = createMemo<ColumnDef<AppointmentSlot>[]>(() => [ |
| 223 | + ...teacherColumn<AppointmentSlot>(), | ||
| 212 | ...windowColumns<AppointmentSlot>(), | 224 | ...windowColumns<AppointmentSlot>(), |
| 213 | { | 225 | { |
| 214 | id: "status", | 226 | id: "status", |
| @@ -261,6 +273,7 @@ function AppointmentsContent() { | |||
| 261 | header: t("appointments.student"), | 273 | header: t("appointments.student"), |
| 262 | cell: (cell) => <span class="block truncate font-medium">{personLabel(cell.row.original.requester)}</span>, | 274 | cell: (cell) => <span class="block truncate font-medium">{personLabel(cell.row.original.requester)}</span>, |
| 263 | }, | 275 | }, |
| 276 | + ...teacherColumn<Appointment>(), | ||
| 264 | ...windowColumns<Appointment>(), | 277 | ...windowColumns<Appointment>(), |
| 265 | proposalColumn(), | 278 | proposalColumn(), |
| 266 | { | 279 | { |
| @@ -428,11 +441,13 @@ function AppointmentsContent() { | |||
| 428 | </Show> | 441 | </Show> |
| 429 | </SidePanel> | 442 | </SidePanel> |
| 430 | 443 | ||
| 444 | + <Show when={flash()}> | ||
| 445 | + <Alert variant="success">{flash()}</Alert> | ||
| 446 | + </Show> | ||
| 431 | <Show when={error() && !showPublish() && bookSlot() == null && reschedAppt() == null}> | 447 | <Show when={error() && !showPublish() && bookSlot() == null && reschedAppt() == null}> |
| 432 | <Alert variant="destructive">{error()}</Alert> | 448 | <Alert variant="destructive">{error()}</Alert> |
| 433 | </Show> | 449 | </Show> |
| 434 | 450 | ||
| 435 | - | ||
| 436 | <Tabs | 451 | <Tabs |
| 437 | class="space-y-4" | 452 | class="space-y-4" |
| 438 | value={section()} | 453 | value={section()} |
| @@ -451,7 +466,7 @@ function AppointmentsContent() { | |||
| 451 | </TabsTrigger> | 466 | </TabsTrigger> |
| 452 | <TabsTrigger value="availability" class="min-w-0"> | 467 | <TabsTrigger value="availability" class="min-w-0"> |
| 453 | <IconClock class="h-4 w-4" /> | 468 | <IconClock class="h-4 w-4" /> |
| 454 | - {isStaff() ? t("appointments.mySlots") : t("appointments.availableSlots")} | 469 | + {isManager() ? t("appointments.allSlots") : isStaff() ? t("appointments.mySlots") : t("appointments.availableSlots")} |
| 455 | <Badge variant="secondary" class="h-5 min-w-5 justify-center rounded-full px-1.5 py-0 text-[11px] group-data-selected:bg-background group-data-selected:text-foreground"> | 470 | <Badge variant="secondary" class="h-5 min-w-5 justify-center rounded-full px-1.5 py-0 text-[11px] group-data-selected:bg-background group-data-selected:text-foreground"> |
| 456 | {isStaff() ? slotList.total() : availableSlots().length} | 471 | {isStaff() ? slotList.total() : availableSlots().length} |
| 457 | </Badge> | 472 | </Badge> |
| @@ -465,7 +480,7 @@ function AppointmentsContent() { | |||
| 465 | <Show when={apptList.error()}>{(err) => <Alert variant="destructive">{formatApiError(err())}</Alert>}</Show> | 480 | <Show when={apptList.error()}>{(err) => <Alert variant="destructive">{formatApiError(err())}</Alert>}</Show> |
| 466 | <Show when={nextBooking()}> | 481 | <Show when={nextBooking()}> |
| 467 | {(booking) => ( | 482 | {(booking) => ( |
| 468 | - <div class="mb-4 flex flex-wrap items-center gap-3 rounded-xl border border-border-line bg-surface-tint p-4"> | 483 | + <div class="flex flex-wrap items-center gap-3 rounded-xl border border-border-line bg-surface-tint p-4"> |
| 469 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-primary-text"> | 484 | <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-surface-base text-primary-text"> |
| 470 | <IconCalendarDays class="h-4 w-4" /> | 485 | <IconCalendarDays class="h-4 w-4" /> |
| 471 | </span> | 486 | </span> |
| @@ -496,7 +511,7 @@ function AppointmentsContent() { | |||
| 496 | <Show when={apptList.error()}>{(err) => <Alert variant="destructive">{formatApiError(err())}</Alert>}</Show> | 511 | <Show when={apptList.error()}>{(err) => <Alert variant="destructive">{formatApiError(err())}</Alert>}</Show> |
| 497 | <DataTable | 512 | <DataTable |
| 498 | title={t("appointments.requests")} | 513 | title={t("appointments.requests")} |
| 499 | - description={t("appointments.requestsHint")} | 514 | + description={isManager() ? t("appointments.allRequestsHint") : t("appointments.requestsHint")} |
| 500 | columns={requestColumns()} | 515 | columns={requestColumns()} |
| 501 | data={requests()} | 516 | data={requests()} |
| 502 | tableClass="table-fixed min-w-[46rem]" | 517 | tableClass="table-fixed min-w-[46rem]" |
| @@ -533,10 +548,10 @@ function AppointmentsContent() { | |||
| 533 | <Show when={loaded()} fallback={<DataTableSkeleton columns={5} rows={6} />}> | 548 | <Show when={loaded()} fallback={<DataTableSkeleton columns={5} rows={6} />}> |
| 534 | <Show when={slotList.error()}>{(err) => <Alert variant="destructive">{formatApiError(err())}</Alert>}</Show> | 549 | <Show when={slotList.error()}>{(err) => <Alert variant="destructive">{formatApiError(err())}</Alert>}</Show> |
| 535 | <DataTable | 550 | <DataTable |
| 536 | - title={t("appointments.mySlots")} | 551 | + title={isManager() ? t("appointments.allSlots") : t("appointments.mySlots")} |
| 537 | - description={t("appointments.mySlotsHint")} | 552 | + description={isManager() ? t("appointments.allSlotsHint") : t("appointments.mySlotsHint")} |
| 538 | actions={ | 553 | actions={ |
| 539 | - <Button type="button" size="sm" class="min-w-[7.5rem] rounded-lg" onClick={() => setShowPublish(true)}> | 554 | + <Button type="button" size="sm" class="min-w-[7.5rem]" onClick={() => setShowPublish(true)}> |
| 540 | <IconPlus class="h-4 w-4" /> | 555 | <IconPlus class="h-4 w-4" /> |
| 541 | {t("appointments.publish")} | 556 | {t("appointments.publish")} |
| 542 | </Button> | 557 | </Button> |
| @@ -570,7 +585,6 @@ function AppointmentsContent() { | |||
| 570 | <DetailField label={t("appointments.status")} value={t(appointmentStatusLabelKey(appointment.status))} /> | 585 | <DetailField label={t("appointments.status")} value={t(appointmentStatusLabelKey(appointment.status))} /> |
| 571 | <DetailField label={t("appointments.time")} value={timeWindow(appointment.starts_at, appointment.ends_at)} /> | 586 | <DetailField label={t("appointments.time")} value={timeWindow(appointment.starts_at, appointment.ends_at)} /> |
| 572 | <DetailField label={t("appointments.proposedTime")} value={appointment.proposed_starts_at == null ? "—" : timeWindow(appointment.proposed_starts_at, appointment.proposed_ends_at)} /> | 587 | <DetailField label={t("appointments.proposedTime")} value={appointment.proposed_starts_at == null ? "—" : timeWindow(appointment.proposed_starts_at, appointment.proposed_ends_at)} /> |
| 573 | - <DetailField label={t("appointments.series")} value={appointment.slot} mono /> | ||
| 574 | </div> | 588 | </div> |
| 575 | <div class="space-y-1"> | 589 | <div class="space-y-1"> |
| 576 | <p class="text-xs font-medium text-muted-foreground">{t("appointments.reason")}</p> | 590 | <p class="text-xs font-medium text-muted-foreground">{t("appointments.reason")}</p> |
src/pages/bank-question-detail-page.tsxmodified+16 -23
| @@ -28,12 +28,6 @@ import { useAuth } from "@/stores/auth-context"; | |||
| 28 | import { usePreferences, useT } from "@/stores/preferences-context"; | 28 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 29 | import { TableRowActions } from "@/components/ui/table-row-actions"; | 29 | import { TableRowActions } from "@/components/ui/table-row-actions"; |
| 30 | 30 | ||
| 31 | -// Edit and the actions menu share one row: the toolbar pill, touch-sized | ||
| 32 | -// (h-10) below `sm` and on touch screens, h-8 above. The menu trigger is a | ||
| 33 | -// <button> too, so one rule sizes both. | ||
| 34 | -const HEADER_CONTROLS = | ||
| 35 | - "flex flex-wrap items-center gap-2 [&_button]:h-10 [&_button]:rounded-full [&_button]:px-3.5 [&_button]:text-[13px] sm:[&_button]:h-8 touch:[&_button]:h-10"; | ||
| 36 | - | ||
| 37 | export default function BankQuestionDetailPage() { | 31 | export default function BankQuestionDetailPage() { |
| 38 | return ( | 32 | return ( |
| 39 | <RouteGuard minRole="teacher"> | 33 | <RouteGuard minRole="teacher"> |
| @@ -113,23 +107,22 @@ function BankQuestionDetailContent() { | |||
| 113 | title={current().text} | 107 | title={current().text} |
| 114 | description={current().subject_name || undefined} | 108 | description={current().subject_name || undefined} |
| 115 | actions={ | 109 | actions={ |
| 116 | - <div class={HEADER_CONTROLS}> | 110 | + // PageHeader sizes Edit and the actions menu as toolbar pills. |
| 117 | - <Show when={canEdit()}> | 111 | + <Show when={canEdit()}> |
| 118 | - <Button variant="outline" size="sm" onClick={() => setEditing(true)}> | 112 | + <Button variant="outline" size="sm" onClick={() => setEditing(true)}> |
| 119 | - <IconEdit class="h-4 w-4" /> | 113 | + <IconEdit class="h-4 w-4" /> |
| 120 | - {t("common.edit")} | 114 | + {t("common.edit")} |
| 121 | - </Button> | 115 | + </Button> |
| 122 | - <TableRowActions | 116 | + <TableRowActions |
| 123 | - label={t("common.actions")} | 117 | + label={t("common.actions")} |
| 124 | - actions={[{ | 118 | + actions={[{ |
| 125 | - label: t("common.delete"), | 119 | + label: t("common.delete"), |
| 126 | - icon: <IconTrash class="h-4 w-4" />, | 120 | + icon: <IconTrash class="h-4 w-4" />, |
| 127 | - destructive: true, | 121 | + destructive: true, |
| 128 | - onSelect: () => setDeleteOpen(true), | 122 | + onSelect: () => setDeleteOpen(true), |
| 129 | - }]} | 123 | + }]} |
| 130 | - /> | 124 | + /> |
| 131 | - </Show> | 125 | + </Show> |
| 132 | - </div> | ||
| 133 | } | 126 | } |
| 134 | /> | 127 | /> |
| 135 | </div> | 128 | </div> |
src/pages/builder-login-page.tsxmodified+6 -6
| @@ -79,7 +79,7 @@ function BuilderLoginForm() { | |||
| 79 | <Label for="builder-username">{t("auth.username")}</Label> | 79 | <Label for="builder-username">{t("auth.username")}</Label> |
| 80 | <Input | 80 | <Input |
| 81 | id="builder-username" | 81 | id="builder-username" |
| 82 | - class="h-9" | 82 | + class="h-10 sm:h-9 touch:h-10" |
| 83 | autocomplete="username" | 83 | autocomplete="username" |
| 84 | required | 84 | required |
| 85 | minlength={MIN_USERNAME_LEN} | 85 | minlength={MIN_USERNAME_LEN} |
| @@ -93,7 +93,7 @@ function BuilderLoginForm() { | |||
| 93 | <div class="relative"> | 93 | <div class="relative"> |
| 94 | <Input | 94 | <Input |
| 95 | id="builder-password" | 95 | id="builder-password" |
| 96 | - class="h-9 pr-10" | 96 | + class="h-10 pr-10 sm:h-9 touch:h-10" |
| 97 | type={showPassword() ? "text" : "password"} | 97 | type={showPassword() ? "text" : "password"} |
| 98 | autocomplete="current-password" | 98 | autocomplete="current-password" |
| 99 | required | 99 | required |
| @@ -105,7 +105,7 @@ function BuilderLoginForm() { | |||
| 105 | <button | 105 | <button |
| 106 | type="button" | 106 | type="button" |
| 107 | onClick={() => setShowPassword(!showPassword())} | 107 | onClick={() => setShowPassword(!showPassword())} |
| 108 | - class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground" | 108 | + class="absolute right-0.5 top-1/2 inline-flex h-9 w-9 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors outline-hidden hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring" |
| 109 | aria-label={showPassword() ? t("auth.hidePassword") : t("auth.showPassword")} | 109 | aria-label={showPassword() ? t("auth.hidePassword") : t("auth.showPassword")} |
| 110 | > | 110 | > |
| 111 | <Show when={showPassword()} fallback={<IconEye class="h-4 w-4" />}> | 111 | <Show when={showPassword()} fallback={<IconEye class="h-4 w-4" />}> |
| @@ -115,10 +115,10 @@ function BuilderLoginForm() { | |||
| 115 | </div> | 115 | </div> |
| 116 | </div> | 116 | </div> |
| 117 | <Show when={error()}> | 117 | <Show when={error()}> |
| 118 | - <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> | 118 | + <p role="alert" class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> |
| 119 | </Show> | 119 | </Show> |
| 120 | - <Button type="submit" class="h-9 w-full text-sm" disabled={pending()}> | 120 | + <Button type="submit" class="h-10 w-full text-sm sm:h-9 touch:h-10" disabled={pending()}> |
| 121 | - {t("auth.login")} | 121 | + {pending() ? t("common.loading") : t("auth.login")} |
| 122 | </Button> | 122 | </Button> |
| 123 | </form> | 123 | </form> |
| 124 | <p class="mt-8 border-t border-border-hairline pt-6 text-center text-sm text-text-subtle"> | 124 | <p class="mt-8 border-t border-border-hairline pt-6 text-center text-sm text-text-subtle"> |
src/pages/builder-school-detail-page.tsxmodified+4 -4
| @@ -104,9 +104,9 @@ function BuilderSchoolDetailContent() { | |||
| 104 | title={current().name} | 104 | title={current().name} |
| 105 | description={`${current().id} · ${t("builder.createdAt")}: ${formatDateTime(current().created_at, locale())}`} | 105 | description={`${current().id} · ${t("builder.createdAt")}: ${formatDateTime(current().created_at, locale())}`} |
| 106 | actions={ | 106 | actions={ |
| 107 | - // One pill height for every header control: the buttons and | 107 | + // PageHeader's actions slot sizes every button here, the |
| 108 | - // the row-actions trigger (h-8 on its own) sit in one row. | 108 | + // row-actions trigger included, as one toolbar pill row. |
| 109 | - <div class="flex flex-wrap items-center gap-2 [&_button]:h-10 [&_button]:rounded-full [&_button]:px-3.5 [&_button]:text-[13px] sm:[&_button]:h-8 touch:[&_button]:h-10"> | 109 | + <> |
| 110 | <SchoolStatusBadge status={current().status} /> | 110 | <SchoolStatusBadge status={current().status} /> |
| 111 | <Button type="button" variant="outline" size="sm" onClick={openEdit}> | 111 | <Button type="button" variant="outline" size="sm" onClick={openEdit}> |
| 112 | <IconEdit class="h-4 w-4" /> | 112 | <IconEdit class="h-4 w-4" /> |
| @@ -129,7 +129,7 @@ function BuilderSchoolDetailContent() { | |||
| 129 | onSelect: () => setDeleteOpen(true), | 129 | onSelect: () => setDeleteOpen(true), |
| 130 | }]} | 130 | }]} |
| 131 | /> | 131 | /> |
| 132 | - </div> | 132 | + </> |
| 133 | } | 133 | } |
| 134 | /> | 134 | /> |
| 135 | <Show when={flash()}> | 135 | <Show when={flash()}> |
src/pages/builder-schools-page.tsxmodified+6 -3
| @@ -99,7 +99,10 @@ function BuilderSchoolsContent() { | |||
| 99 | { | 99 | { |
| 100 | id: "actions", | 100 | id: "actions", |
| 101 | header: t("common.actions"), | 101 | header: t("common.actions"), |
| 102 | - meta: { headerClass: "w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap" }, | 102 | + meta: { |
| 103 | + headerClass: "w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap", | ||
| 104 | + cellClass: "w-[110px] min-w-[110px] max-w-[110px] h-[45px] text-center whitespace-nowrap", | ||
| 105 | + }, | ||
| 103 | cell: (cell) => ( | 106 | cell: (cell) => ( |
| 104 | <TableRowActions | 107 | <TableRowActions |
| 105 | label={t("common.actions")} | 108 | label={t("common.actions")} |
| @@ -134,7 +137,7 @@ function BuilderSchoolsContent() { | |||
| 134 | </Show> | 137 | </Show> |
| 135 | 138 | ||
| 136 | <section class="space-y-4 p-0"> | 139 | <section class="space-y-4 p-0"> |
| 137 | - <Suspense fallback={<DataTableSkeleton columns={5} rows={6} />}> | 140 | + <Suspense fallback={<DataTableSkeleton columns={6} rows={6} />}> |
| 138 | <Show when={list.error}> | 141 | <Show when={list.error}> |
| 139 | <ErrorAlert message={formatApiError(list.error)} onRetry={() => void refetch()} /> | 142 | <ErrorAlert message={formatApiError(list.error)} onRetry={() => void refetch()} /> |
| 140 | </Show> | 143 | </Show> |
| @@ -151,7 +154,7 @@ function BuilderSchoolsContent() { | |||
| 151 | } | 154 | } |
| 152 | columns={columns()} | 155 | columns={columns()} |
| 153 | data={list() ?? []} | 156 | data={list() ?? []} |
| 154 | - tableClass="min-w-[52rem]" | 157 | + tableClass="min-w-[52rem]" |
| 155 | empty={t("builder.noSchools")} | 158 | empty={t("builder.noSchools")} |
| 156 | filterColumn="name" | 159 | filterColumn="name" |
| 157 | enablePagination | 160 | enablePagination |
src/pages/calendar-page.tsxmodified+77 -37
| @@ -1,4 +1,5 @@ | |||
| 1 | import { For, Show, Suspense, createMemo } from "solid-js"; | 1 | import { For, Show, Suspense, createMemo } from "solid-js"; |
| 2 | +import { Link } from "@tanstack/solid-router"; | ||
| 2 | import { createBoardResources } from "@/lib/board-resources"; | 3 | import { createBoardResources } from "@/lib/board-resources"; |
| 3 | import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; | 4 | import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; |
| 4 | import { createInstanceLabels } from "@/lib/instance-labels"; | 5 | import { createInstanceLabels } from "@/lib/instance-labels"; |
| @@ -72,14 +73,16 @@ const KIND_STYLES: Record<CalendarKind, KindStyle> = { | |||
| 72 | heading: "text-sky-500", | 73 | heading: "text-sky-500", |
| 73 | titleHover: "group-hover:text-sky-500", | 74 | titleHover: "group-hover:text-sky-500", |
| 74 | }, | 75 | }, |
| 76 | + // Lime, not amber: amber sat next to homework's orange and the two read | ||
| 77 | + // as one colour in the legend and the chips. | ||
| 75 | study: { | 78 | study: { |
| 76 | labelKey: "calendar.studies", | 79 | labelKey: "calendar.studies", |
| 77 | - chip: "bg-amber-100 text-amber-700 dark:border dark:border-amber-800/50 dark:bg-amber-950/60 dark:text-amber-300", | 80 | + chip: "bg-lime-100 text-lime-700 dark:border dark:border-lime-800/50 dark:bg-lime-950/60 dark:text-lime-300", |
| 78 | - dot: "bg-amber-500", | 81 | + dot: "bg-lime-500", |
| 79 | - card: "border-amber-500/40 dark:border-amber-500/30", | 82 | + card: "border-lime-500/40 dark:border-lime-500/30", |
| 80 | - hover: "hover:border-amber-500/70 dark:hover:border-amber-500/70", | 83 | + hover: "hover:border-lime-500/70 dark:hover:border-lime-500/70", |
| 81 | - heading: "text-amber-500", | 84 | + heading: "text-lime-500", |
| 82 | - titleHover: "group-hover:text-amber-500", | 85 | + titleHover: "group-hover:text-lime-500", |
| 83 | }, | 86 | }, |
| 84 | exam: { | 87 | exam: { |
| 85 | labelKey: "calendar.exams", | 88 | labelKey: "calendar.exams", |
| @@ -228,17 +231,39 @@ function CalendarContent() { | |||
| 228 | // two-sided window cannot widen incrementally, so the source key is the | 231 | // two-sided window cannot widen incrementally, so the source key is the |
| 229 | // month and paging months refetches. Homework filters on its due date, | 232 | // month and paging months refetches. Homework filters on its due date, |
| 230 | // appointments on their start. | 233 | // appointments on their start. |
| 231 | - const monthWindow = () => ({ | 234 | + // A week that crosses into the next (or previous) month is widened to its |
| 232 | - start: new Date(viewYear(), viewMonth(), 1).getTime(), | 235 | + // own days — bound to the month alone, a week view of 28 Sep – 4 Oct showed |
| 233 | - end: new Date(viewYear(), viewMonth() + 1, 1).getTime(), | 236 | + // no homework or appointments from 1 Oct on. The key is a string so the |
| 237 | + // source only changes when the window really moves. | ||
| 238 | + const monthWindow = createMemo(() => { | ||
| 239 | + let start = new Date(viewYear(), viewMonth(), 1).getTime(); | ||
| 240 | + let end = new Date(viewYear(), viewMonth() + 1, 1).getTime(); | ||
| 241 | + if (view() !== "month") { | ||
| 242 | + const [y, m, d] = selected().split("-").map(Number); | ||
| 243 | + const day = new Date(y, m, d); | ||
| 244 | + const weekStart = new Date(y, m, d - ((day.getDay() + 6) % 7)); | ||
| 245 | + start = Math.min(start, weekStart.getTime()); | ||
| 246 | + end = Math.max(end, new Date(weekStart.getFullYear(), weekStart.getMonth(), weekStart.getDate() + 7).getTime()); | ||
| 247 | + } | ||
| 248 | + return `${start}|${end}`; | ||
| 234 | }); | 249 | }); |
| 250 | + const windowBounds = (key: string) => { | ||
| 251 | + const [start, end] = key.split("|").map(Number); | ||
| 252 | + return { start, end }; | ||
| 253 | + }; | ||
| 235 | const [appointments] = board.createResource( | 254 | const [appointments] = board.createResource( |
| 236 | monthWindow, | 255 | monthWindow, |
| 237 | - async (bounds) => fetchWindow((page) => getAppointments({ ...page, starts_after: bounds.start, starts_before: bounds.end })), | 256 | + async (key) => { |
| 257 | + const bounds = windowBounds(key); | ||
| 258 | + return fetchWindow((page) => getAppointments({ ...page, starts_after: bounds.start, starts_before: bounds.end })); | ||
| 259 | + }, | ||
| 238 | ); | 260 | ); |
| 239 | const [homework] = board.createResource( | 261 | const [homework] = board.createResource( |
| 240 | monthWindow, | 262 | monthWindow, |
| 241 | - async (bounds) => fetchWindow((page) => getHomework({ ...page, due_after: bounds.start, due_before: bounds.end })), | 263 | + async (key) => { |
| 264 | + const bounds = windowBounds(key); | ||
| 265 | + return fetchWindow((page) => getHomework({ ...page, due_after: bounds.start, due_before: bounds.end })); | ||
| 266 | + }, | ||
| 242 | ); | 267 | ); |
| 243 | 268 | ||
| 244 | // Lessons and study/club meetings both come from course sessions; the course's | 269 | // Lessons and study/club meetings both come from course sessions; the course's |
| @@ -337,6 +362,9 @@ function CalendarContent() { | |||
| 337 | const klass = sectionOf(item)?.className; | 362 | const klass = sectionOf(item)?.className; |
| 338 | return klass ? `${klass} · ${item.title}` : item.title; | 363 | return klass ? `${klass} · ${item.title}` : item.title; |
| 339 | }; | 364 | }; |
| 365 | + // A chip truncates its title, so its tooltip carries the whole title and | ||
| 366 | + // the "<ders> — <şube>" line (the tooltip used to hold the section alone). | ||
| 367 | + const chipTooltip = (item: CalendarItem) => [item.title, sectionOf(item)?.label].filter(Boolean).join(" — "); | ||
| 340 | 368 | ||
| 341 | const itemsByDay = createMemo(() => { | 369 | const itemsByDay = createMemo(() => { |
| 342 | const map = new Map<string, CalendarItem[]>(); | 370 | const map = new Map<string, CalendarItem[]>(); |
| @@ -366,9 +394,15 @@ function CalendarContent() { | |||
| 366 | const cells: { day: number; other: boolean }[] = []; | 394 | const cells: { day: number; other: boolean }[] = []; |
| 367 | for (let i = 0; i < firstDay(); i++) cells.push({ day: 0, other: true }); | 395 | for (let i = 0; i < firstDay(); i++) cells.push({ day: 0, other: true }); |
| 368 | for (let d = 1; d <= daysInMonth(); d++) cells.push({ day: d, other: false }); | 396 | for (let d = 1; d <= daysInMonth(); d++) cells.push({ day: d, other: false }); |
| 397 | + // Close the last week with blank cells, like the leading ones, so the | ||
| 398 | + // grid ends on a full row instead of a ragged edge with no cell lines. | ||
| 399 | + while (cells.length % 7 !== 0) cells.push({ day: 0, other: true }); | ||
| 369 | return cells; | 400 | return cells; |
| 370 | }); | 401 | }); |
| 371 | 402 | ||
| 403 | + /** The grid's last week sits on the card's own bottom border. */ | ||
| 404 | + const lastRow = (index: number) => index >= grid().length - 7; | ||
| 405 | + | ||
| 372 | const selectedDay = () => { | 406 | const selectedDay = () => { |
| 373 | const [y, m, d] = selected().split("-").map(Number); | 407 | const [y, m, d] = selected().split("-").map(Number); |
| 374 | return new Date(y, m, d); | 408 | return new Date(y, m, d); |
| @@ -437,11 +471,11 @@ function CalendarContent() { | |||
| 437 | <div class="min-w-0"> | 471 | <div class="min-w-0"> |
| 438 | <h1 class="truncate text-lg font-semibold tracking-tight text-foreground sm:text-xl">{t("calendar.title")}</h1> | 472 | <h1 class="truncate text-lg font-semibold tracking-tight text-foreground sm:text-xl">{t("calendar.title")}</h1> |
| 439 | <div class="mt-1.5 flex items-center gap-1 sm:gap-2"> | 473 | <div class="mt-1.5 flex items-center gap-1 sm:gap-2"> |
| 440 | - <Button type="button" variant="ghost" size="sm" class="h-8 w-8 rounded-full p-0" onClick={goPrev} aria-label={t("common.prev")}> | 474 | + <Button type="button" variant="ghost" size="sm" class="h-10 w-10 rounded-full p-0 sm:h-8 sm:w-8 touch:h-10 touch:w-10" onClick={goPrev} aria-label={t("common.prev")}> |
| 441 | <IconChevronLeft class="h-4 w-4" /> | 475 | <IconChevronLeft class="h-4 w-4" /> |
| 442 | </Button> | 476 | </Button> |
| 443 | <span class="truncate text-sm font-semibold tracking-tight sm:text-base">{rangeLabel()}</span> | 477 | <span class="truncate text-sm font-semibold tracking-tight sm:text-base">{rangeLabel()}</span> |
| 444 | - <Button type="button" variant="ghost" size="sm" class="h-8 w-8 rounded-full p-0" onClick={goNext} aria-label={t("common.next")}> | 478 | + <Button type="button" variant="ghost" size="sm" class="h-10 w-10 rounded-full p-0 sm:h-8 sm:w-8 touch:h-10 touch:w-10" onClick={goNext} aria-label={t("common.next")}> |
| 445 | <IconChevronRight class="h-4 w-4" /> | 479 | <IconChevronRight class="h-4 w-4" /> |
| 446 | </Button> | 480 | </Button> |
| 447 | </div> | 481 | </div> |
| @@ -457,7 +491,7 @@ function CalendarContent() { | |||
| 457 | aria-pressed={view() === entry.id} | 491 | aria-pressed={view() === entry.id} |
| 458 | onClick={() => setView(entry.id)} | 492 | onClick={() => setView(entry.id)} |
| 459 | class={cn( | 493 | class={cn( |
| 460 | - "h-full rounded-full px-3 text-[13px] font-semibold transition-colors", | 494 | + "h-full rounded-full px-3 text-[13px] font-semibold outline-hidden transition-colors focus-visible:ring-2 focus-visible:ring-ring", |
| 461 | view() === entry.id ? "bg-background text-foreground shadow-xs" : "text-muted-foreground", | 495 | view() === entry.id ? "bg-background text-foreground shadow-xs" : "text-muted-foreground", |
| 462 | )} | 496 | )} |
| 463 | > | 497 | > |
| @@ -466,7 +500,7 @@ function CalendarContent() { | |||
| 466 | )} | 500 | )} |
| 467 | </For> | 501 | </For> |
| 468 | </div> | 502 | </div> |
| 469 | - <Button type="button" variant="outline" size="sm" class="h-10 shrink-0 gap-1 rounded-full px-3.5 text-[13px] font-semibold sm:h-8 touch:h-10" onClick={goToday}> | 503 | + <Button type="button" variant="outline" size="sm" class="h-10 shrink-0 gap-1 rounded-full px-3.5 text-[13px] font-semibold sm:h-8 touch:h-10" onClick={goToday} aria-label={t("calendar.today")}> |
| 470 | <IconCalendarDays class="h-3.5 w-3.5" /> | 504 | <IconCalendarDays class="h-3.5 w-3.5" /> |
| 471 | <span class="hidden sm:inline">{t("calendar.today")}</span> | 505 | <span class="hidden sm:inline">{t("calendar.today")}</span> |
| 472 | </Button> | 506 | </Button> |
| @@ -483,6 +517,11 @@ function CalendarContent() { | |||
| 483 | </span> | 517 | </span> |
| 484 | )} | 518 | )} |
| 485 | </For> | 519 | </For> |
| 520 | + {/* In the legend row, not a line of its own: a line that comes and | ||
| 521 | + goes pushed the whole grid down and back on every month page. */} | ||
| 522 | + <Show when={loadingFeeds()}> | ||
| 523 | + <span role="status" class="ml-auto text-[11px] text-muted-foreground">{t("common.loading")}</span> | ||
| 524 | + </Show> | ||
| 486 | </div> | 525 | </div> |
| 487 | 526 | ||
| 488 | <Show when={failedFeeds().length > 0}> | 527 | <Show when={failedFeeds().length > 0}> |
| @@ -493,9 +532,6 @@ function CalendarContent() { | |||
| 493 | </Button> | 532 | </Button> |
| 494 | </div> | 533 | </div> |
| 495 | </Show> | 534 | </Show> |
| 496 | - <Show when={loadingFeeds()}> | ||
| 497 | - <p role="status" class="text-xs text-muted-foreground">{t("common.loading")}</p> | ||
| 498 | - </Show> | ||
| 499 | <Suspense fallback={<PageSpinner />}> | 535 | <Suspense fallback={<PageSpinner />}> |
| 500 | <div class={cn("grid min-h-0 flex-1 gap-4", view() === "month" && "xl:grid-cols-[minmax(0,1fr)_20rem]")}> | 536 | <div class={cn("grid min-h-0 flex-1 gap-4", view() === "month" && "xl:grid-cols-[minmax(0,1fr)_20rem]")}> |
| 501 | <Show when={view() === "week"}> | 537 | <Show when={view() === "week"}> |
| @@ -518,7 +554,7 @@ function CalendarContent() { | |||
| 518 | key === selected() ? "bg-sky-50 ring-1 ring-inset ring-sky-400/50 dark:bg-sky-950/40 dark:ring-sky-500/40" : "", | 554 | key === selected() ? "bg-sky-50 ring-1 ring-inset ring-sky-400/50 dark:bg-sky-950/40 dark:ring-sky-500/40" : "", |
| 519 | )} | 555 | )} |
| 520 | > | 556 | > |
| 521 | - <button type="button" class="flex shrink-0 flex-col items-center gap-1 rounded-md py-1 hover:bg-muted/40" onClick={() => setSelected(key)}> | 557 | + <button type="button" class="flex shrink-0 flex-col items-center gap-1 rounded-md py-1 outline-hidden hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring" aria-pressed={key === selected()} onClick={() => setSelected(key)}> |
| 522 | <span class="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground"> | 558 | <span class="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground"> |
| 523 | {dayNames()[(day.getDay() + 6) % 7]} | 559 | {dayNames()[(day.getDay() + 6) % 7]} |
| 524 | </span> | 560 | </span> |
| @@ -534,13 +570,13 @@ function CalendarContent() { | |||
| 534 | <div class="flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto"> | 570 | <div class="flex min-h-0 flex-1 flex-col gap-1 overflow-y-auto"> |
| 535 | <For each={dayItems()}> | 571 | <For each={dayItems()}> |
| 536 | {(item) => ( | 572 | {(item) => ( |
| 537 | - <a | 573 | + <Link |
| 538 | - href={item.href} | 574 | + to={item.href} |
| 539 | - class={cn("block min-w-0 rounded px-1.5 py-1 text-[11px] leading-tight font-medium", KIND_STYLES[item.kind].chip)} | 575 | + class={cn("block min-w-0 rounded px-1.5 py-1 text-[11px] leading-tight font-medium outline-hidden focus-visible:ring-2 focus-visible:ring-ring", KIND_STYLES[item.kind].chip)} |
| 540 | > | 576 | > |
| 541 | <span class="block truncate">{clock(item.at)}</span> | 577 | <span class="block truncate">{clock(item.at)}</span> |
| 542 | - <span class="block truncate" title={sectionOf(item)?.label}>{chipTitle(item)}</span> | 578 | + <span class="block truncate" title={chipTooltip(item)}>{chipTitle(item)}</span> |
| 543 | - </a> | 579 | + </Link> |
| 544 | )} | 580 | )} |
| 545 | </For> | 581 | </For> |
| 546 | </div> | 582 | </div> |
| @@ -565,7 +601,7 @@ function CalendarContent() { | |||
| 565 | </div> | 601 | </div> |
| 566 | <div class="grid min-h-0 flex-1 auto-rows-fr grid-cols-7"> | 602 | <div class="grid min-h-0 flex-1 auto-rows-fr grid-cols-7"> |
| 567 | <For each={grid()}> | 603 | <For each={grid()}> |
| 568 | - {(cell) => { | 604 | + {(cell, index) => { |
| 569 | const key = cell.other ? "" : dateKey(new Date(viewYear(), viewMonth(), cell.day)); | 605 | const key = cell.other ? "" : dateKey(new Date(viewYear(), viewMonth(), cell.day)); |
| 570 | const dayItems = () => (cell.other ? [] : itemsByDay().get(key) ?? []); | 606 | const dayItems = () => (cell.other ? [] : itemsByDay().get(key) ?? []); |
| 571 | const cellToday = !cell.other && isToday(cell.day); | 607 | const cellToday = !cell.other && isToday(cell.day); |
| @@ -574,7 +610,8 @@ function CalendarContent() { | |||
| 574 | <button | 610 | <button |
| 575 | type="button" | 611 | type="button" |
| 576 | class={cn( | 612 | class={cn( |
| 577 | - "relative flex min-h-12 min-w-0 flex-col overflow-hidden border-b border-r border-border/40 p-1 text-left transition-colors last:border-r-0 hover:bg-muted/40 sm:min-h-17 sm:p-1.5 lg:min-h-0", | 613 | + "relative flex min-h-12 min-w-0 flex-col overflow-hidden border-b border-r border-border/40 p-1 text-left outline-hidden transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring sm:min-h-17 sm:p-1.5 lg:min-h-0 [&:nth-child(7n)]:border-r-0", |
| 614 | + lastRow(index()) && "border-b-0", | ||
| 578 | cell.other && "pointer-events-none bg-muted/20", | 615 | cell.other && "pointer-events-none bg-muted/20", |
| 579 | cellSelected() ? "bg-sky-50/60 ring-1 ring-inset ring-sky-400/50 dark:bg-sky-950/40 dark:ring-sky-500/40" : "", | 616 | cellSelected() ? "bg-sky-50/60 ring-1 ring-inset ring-sky-400/50 dark:bg-sky-950/40 dark:ring-sky-500/40" : "", |
| 580 | cellToday ? "font-bold text-sky-600 dark:text-sky-400" : "" | 617 | cellToday ? "font-bold text-sky-600 dark:text-sky-400" : "" |
| @@ -604,7 +641,7 @@ function CalendarContent() { | |||
| 604 | {(item) => ( | 641 | {(item) => ( |
| 605 | <span class={cn("inline-flex min-w-0 items-center gap-1 rounded px-1 py-0.5 text-[11px] font-medium leading-none", KIND_STYLES[item.kind].chip)}> | 642 | <span class={cn("inline-flex min-w-0 items-center gap-1 rounded px-1 py-0.5 text-[11px] font-medium leading-none", KIND_STYLES[item.kind].chip)}> |
| 606 | <span class={cn("h-1.5 w-1.5 shrink-0 rounded-full", KIND_STYLES[item.kind].dot)} /> | 643 | <span class={cn("h-1.5 w-1.5 shrink-0 rounded-full", KIND_STYLES[item.kind].dot)} /> |
| 607 | - <span class="truncate" title={sectionOf(item)?.label}>{chipTitle(item)}</span> | 644 | + <span class="truncate" title={chipTooltip(item)}>{chipTitle(item)}</span> |
| 608 | </span> | 645 | </span> |
| 609 | )} | 646 | )} |
| 610 | </For> | 647 | </For> |
| @@ -625,11 +662,14 @@ function CalendarContent() { | |||
| 625 | 662 | ||
| 626 | <div class="min-h-0 space-y-3 overflow-y-auto"> | 663 | <div class="min-h-0 space-y-3 overflow-y-auto"> |
| 627 | <div class="rounded-xl border border-border/80 bg-card p-3 shadow-xs"> | 664 | <div class="rounded-xl border border-border/80 bg-card p-3 shadow-xs"> |
| 628 | - <h3 class="text-sm font-semibold"> | 665 | + {/* The day view already names this date in its header. */} |
| 629 | - {selectedDay().toLocaleDateString(locale() === "tr" ? "tr-TR" : "en-US", { day: "numeric", month: "long", year: "numeric" })} | 666 | + <Show when={view() !== "day"}> |
| 630 | - </h3> | 667 | + <h3 class="mb-2 text-sm font-semibold"> |
| 631 | - | 668 | + {selectedDay().toLocaleDateString(locale() === "tr" ? "tr-TR" : "en-US", { day: "numeric", month: "long", year: "numeric" })} |
| 632 | - <div class="mt-2 space-y-2.5"> | 669 | + </h3> |
| 670 | + </Show> | ||
| 671 | + | ||
| 672 | + <div class="space-y-2.5"> | ||
| 633 | <Show when={selectedGroups().length === 0}> | 673 | <Show when={selectedGroups().length === 0}> |
| 634 | <p class="text-xs text-muted-foreground">{t("calendar.noEvents")}</p> | 674 | <p class="text-xs text-muted-foreground">{t("calendar.noEvents")}</p> |
| 635 | </Show> | 675 | </Show> |
| @@ -642,16 +682,16 @@ function CalendarContent() { | |||
| 642 | </p> | 682 | </p> |
| 643 | <For each={group.rows}> | 683 | <For each={group.rows}> |
| 644 | {(item) => ( | 684 | {(item) => ( |
| 645 | - <a | 685 | + <Link |
| 646 | - href={item.href} | 686 | + to={item.href} |
| 647 | class={cn( | 687 | class={cn( |
| 648 | - "group flex items-start justify-between gap-2 rounded-lg border bg-card p-2.5 shadow-xs transition-all hover:shadow-md", | 688 | + "group flex items-start justify-between gap-2 rounded-lg border bg-card p-2.5 shadow-xs outline-hidden transition-all hover:shadow-md focus-visible:ring-2 focus-visible:ring-ring", |
| 649 | KIND_STYLES[item.kind].card, | 689 | KIND_STYLES[item.kind].card, |
| 650 | KIND_STYLES[item.kind].hover, | 690 | KIND_STYLES[item.kind].hover, |
| 651 | )} | 691 | )} |
| 652 | > | 692 | > |
| 653 | <div class="min-w-0"> | 693 | <div class="min-w-0"> |
| 654 | - <p class={cn("truncate text-xs font-semibold", KIND_STYLES[item.kind].titleHover)}>{item.title}</p> | 694 | + <p class={cn("truncate text-xs font-semibold", KIND_STYLES[item.kind].titleHover)} title={item.title}>{item.title}</p> |
| 655 | <Show when={sectionOf(item)}> | 695 | <Show when={sectionOf(item)}> |
| 656 | {(section) => <p class="mt-0.5 truncate text-[11px] text-text-default">{section().label}</p>} | 696 | {(section) => <p class="mt-0.5 truncate text-[11px] text-text-default">{section().label}</p>} |
| 657 | </Show> | 697 | </Show> |
| @@ -668,7 +708,7 @@ function CalendarContent() { | |||
| 668 | </Badge> | 708 | </Badge> |
| 669 | )} | 709 | )} |
| 670 | </Show> | 710 | </Show> |
| 671 | - </a> | 711 | + </Link> |
| 672 | )} | 712 | )} |
| 673 | </For> | 713 | </For> |
| 674 | </div> | 714 | </div> |
src/pages/class-detail-page.tsxmodified+8 -6
| @@ -26,6 +26,7 @@ import { Alert } from "@/components/ui/alert"; | |||
| 26 | import { Button } from "@/components/ui/button"; | 26 | import { Button } from "@/components/ui/button"; |
| 27 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 27 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 28 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 28 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 29 | +import { TOOLBAR_CONTROL } from "@/components/ui/data-toolbar"; | ||
| 29 | import { IconBook, IconEdit, IconExternalLink, IconListChecks, IconPlus, IconTrash, IconUsers } from "@/components/ui/icons"; | 30 | import { IconBook, IconEdit, IconExternalLink, IconListChecks, IconPlus, IconTrash, IconUsers } from "@/components/ui/icons"; |
| 30 | import { Label } from "@/components/ui/label"; | 31 | import { Label } from "@/components/ui/label"; |
| 31 | import { PageSpinner } from "@/components/ui/page-spinner"; | 32 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| @@ -58,13 +59,14 @@ const personName = (person: PersonRef | null | undefined) => person?.display_nam | |||
| 58 | // One info tile of the header card, the same surface homework and event | 59 | // One info tile of the header card, the same surface homework and event |
| 59 | // detail pages use for their facts. | 60 | // detail pages use for their facts. |
| 60 | const TILE = "min-w-0 rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"; | 61 | const TILE = "min-w-0 rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"; |
| 61 | -const TILE_LABEL = "text-xs font-medium uppercase tracking-[0.08em] text-text-subtle"; | 62 | +const TILE_LABEL = "text-xs font-medium text-text-subtle"; |
| 62 | const TILE_VALUE = "mt-1 break-words font-medium text-text-default"; | 63 | const TILE_VALUE = "mt-1 break-words font-medium text-text-default"; |
| 63 | 64 | ||
| 64 | -// Header buttons share the row-actions trigger's box (h-8, rounded-lg) so a | 65 | +// Header buttons are sized as toolbar pills by PageHeader's `actions` slot, |
| 65 | -// button and the ⋮ menu beside it line up. Tab toolbar actions go through | 66 | +// the same box as the row-actions trigger beside them; this only sets a |
| 66 | -// DataTable's `actions` slot, which sizes them as pills like "Sütunlar". | 67 | +// common minimum width. Tab toolbar actions go through DataTable's `actions` |
| 67 | -const ACTION_BUTTON = "h-8 min-w-[7.5rem] rounded-lg! px-3 text-[13px]"; | 68 | +// slot, which sizes them as pills like "Sütunlar". |
| 69 | +const ACTION_BUTTON = "min-w-[7.5rem]"; | ||
| 68 | 70 | ||
| 69 | function ClassDetailContent() { | 71 | function ClassDetailContent() { |
| 70 | const auth = useAuth(); | 72 | const auth = useAuth(); |
| @@ -360,7 +362,7 @@ function ClassDetailContent() { | |||
| 360 | <Show when={skipped().length > 0}> | 362 | <Show when={skipped().length > 0}> |
| 361 | <Alert class="flex flex-wrap items-center justify-between gap-3 border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200"> | 363 | <Alert class="flex flex-wrap items-center justify-between gap-3 border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200"> |
| 362 | <span class="min-w-0 flex-1">{t("classBlueprints.skippedSummary", { count: skipped().length })}</span> | 364 | <span class="min-w-0 flex-1">{t("classBlueprints.skippedSummary", { count: skipped().length })}</span> |
| 363 | - <Button type="button" size="sm" variant="outline" class="shrink-0 rounded-lg" onClick={() => setReportOpen(true)}> | 365 | + <Button type="button" size="sm" variant="outline" class={cn(TOOLBAR_CONTROL, "shrink-0 px-3.5")} onClick={() => setReportOpen(true)}> |
| 364 | {t("classBlueprints.skippedDetails")} | 366 | {t("classBlueprints.skippedDetails")} |
| 365 | </Button> | 367 | </Button> |
| 366 | </Alert> | 368 | </Alert> |
src/pages/classes-page.tsxmodified+23 -11
| @@ -13,8 +13,11 @@ import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | |||
| 13 | import { RouteGuard } from "@/components/layout/route-guard"; | 13 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 14 | import { DropdownSelect, Select } from "@/components/ui/select"; | 14 | import { DropdownSelect, Select } from "@/components/ui/select"; |
| 15 | import { Alert } from "@/components/ui/alert"; | 15 | import { Alert } from "@/components/ui/alert"; |
| 16 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 16 | import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; | 17 | import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; |
| 17 | import { Button } from "@/components/ui/button"; | 18 | import { Button } from "@/components/ui/button"; |
| 19 | +import { TOOLBAR_CONTROL } from "@/components/ui/data-toolbar"; | ||
| 20 | +import { cn } from "@/lib/cn"; | ||
| 18 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 21 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 19 | import { IconEdit, IconEye, IconListChecks, IconPlus, IconTrash } from "@/components/ui/icons"; | 22 | import { IconEdit, IconEye, IconListChecks, IconPlus, IconTrash } from "@/components/ui/icons"; |
| 20 | import { Input } from "@/components/ui/input"; | 23 | import { Input } from "@/components/ui/input"; |
| @@ -89,9 +92,13 @@ function ClassesContent() { | |||
| 89 | async () => (await getClasses({ limit: 200 })).items, | 92 | async () => (await getClasses({ limit: 200 })).items, |
| 90 | ); | 93 | ); |
| 91 | const courseTitle = (id: string) => skippedCourseTitles()[id] ?? "—"; | 94 | const courseTitle = (id: string) => skippedCourseTitles()[id] ?? "—"; |
| 92 | - const listData = () => list.latest ?? list() ?? []; | 95 | + // A failed read must not throw out of the page: `.latest` rethrows the |
| 93 | - const gradeData = () => gradeList.latest ?? gradeList() ?? []; | 96 | + // error, so each accessor checks it first and the table shows ErrorAlert. |
| 94 | - const yearName = (id: string | null) => (id ? years.latest?.find((year) => year.id === id)?.name ?? "—" : t("academicYears.unassigned")); | 97 | + const listData = () => (list.error ? [] : list.latest ?? list() ?? []); |
| 98 | + const gradeData = () => (gradeList.error ? [] : gradeList.latest ?? gradeList() ?? []); | ||
| 99 | + const limitData = () => (limits.error ? undefined : limits.latest); | ||
| 100 | + const yearList = () => (years.error ? [] : years.latest ?? []); | ||
| 101 | + const yearName = (id: string | null) => (id ? yearList().find((year) => year.id === id)?.name ?? "—" : t("academicYears.unassigned")); | ||
| 95 | 102 | ||
| 96 | // The grade filter offers only the rungs this school's classes sit on. | 103 | // The grade filter offers only the rungs this school's classes sit on. |
| 97 | const grades = createMemo(() => [...new Set(gradeData().map((cls) => cls.grade_level))].sort((a, b) => a - b)); | 104 | const grades = createMemo(() => [...new Set(gradeData().map((cls) => cls.grade_level))].sort((a, b) => a - b)); |
| @@ -319,13 +326,13 @@ function ClassesContent() { | |||
| 319 | <SidePanel open={canManage() && showForm()} onOpenChange={setShowForm} guardUnsaved title={t("classGroups.newClass")} description={t("classGroups.subtitle")}> | 326 | <SidePanel open={canManage() && showForm()} onOpenChange={setShowForm} guardUnsaved title={t("classGroups.newClass")} description={t("classGroups.subtitle")}> |
| 320 | <form class="space-y-4" noValidate onSubmit={createClass}> | 327 | <form class="space-y-4" noValidate onSubmit={createClass}> |
| 321 | <div class="space-y-3"> | 328 | <div class="space-y-3"> |
| 322 | - <div class="space-y-1.5"><Label for="class-name">{t("classGroups.className")}<span class="ml-0.5 text-destructive-text">*</span></Label><Input id="class-name" required aria-required="true" maxlength={limits.latest?.course.max_class_name_len} value={name()} error={nameError()} onInput={(e) => { setName(e.currentTarget.value); setNameError(""); }} /></div> | 329 | + <div class="space-y-1.5"><Label for="class-name">{t("classGroups.className")}<span class="ml-0.5 text-destructive-text">*</span></Label><Input id="class-name" required aria-required="true" maxlength={limitData()?.course.max_class_name_len} value={name()} error={nameError()} onInput={(e) => { setName(e.currentTarget.value); setNameError(""); }} /></div> |
| 323 | <div class="space-y-1.5"> | 330 | <div class="space-y-1.5"> |
| 324 | <Label for="class-grade">{t("classGroups.grade")}<span class="ml-0.5 text-destructive-text">*</span></Label> | 331 | <Label for="class-grade">{t("classGroups.grade")}<span class="ml-0.5 text-destructive-text">*</span></Label> |
| 325 | - <GradeLevelSelect id="class-grade" value={gradeLevel()} error={!!gradeError()} min={limits.latest?.course.min_grade_level} max={limits.latest?.course.max_grade_level} onChange={(level) => { setGradeLevel(level); setGradeError(""); }} /> | 332 | + <GradeLevelSelect id="class-grade" value={gradeLevel()} error={!!gradeError()} min={limitData()?.course.min_grade_level} max={limitData()?.course.max_grade_level} onChange={(level) => { setGradeLevel(level); setGradeError(""); }} /> |
| 326 | <Show when={gradeError()}><p class="text-xs font-medium text-destructive-text">{gradeError()}</p></Show> | 333 | <Show when={gradeError()}><p class="text-xs font-medium text-destructive-text">{gradeError()}</p></Show> |
| 327 | </div> | 334 | </div> |
| 328 | - <div class="space-y-1.5"><Label for="class-year">{t("academicYears.year")}</Label><Select id="class-year" value={yearId()} onChange={(e) => setYearId(e.currentTarget.value)}><option value="">{t("academicYears.unassigned")}</option><For each={years.latest ?? []}>{(year) => <option value={year.id}>{year.name}</option>}</For></Select></div> | 335 | + <div class="space-y-1.5"><Label for="class-year">{t("academicYears.year")}</Label><Select id="class-year" value={yearId()} onChange={(e) => setYearId(e.currentTarget.value)}><option value="">{t("academicYears.unassigned")}</option><For each={yearList()}>{(year) => <option value={year.id}>{year.name}</option>}</For></Select></div> |
| 329 | <UserSearchSelect id="class-teacher" label={t("classGroups.homeroomTeacher")} value={teacherId()} onChange={setTeacherId} placeholder={t("classGroups.selectTeacher")} role="teacher" /> | 336 | <UserSearchSelect id="class-teacher" label={t("classGroups.homeroomTeacher")} value={teacherId()} onChange={setTeacherId} placeholder={t("classGroups.selectTeacher")} role="teacher" /> |
| 330 | </div> | 337 | </div> |
| 331 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> | 338 | <Show when={error()}><Alert variant="destructive">{error()}</Alert></Show> |
| @@ -337,10 +344,10 @@ function ClassesContent() { | |||
| 337 | cls={editTarget()} | 344 | cls={editTarget()} |
| 338 | open={editTarget() !== null} | 345 | open={editTarget() !== null} |
| 339 | onOpenChange={(open) => { if (!open) setEditTarget(null); }} | 346 | onOpenChange={(open) => { if (!open) setEditTarget(null); }} |
| 340 | - years={years.latest ?? []} | 347 | + years={yearList()} |
| 341 | - maxNameLen={limits.latest?.course.max_class_name_len} | 348 | + maxNameLen={limitData()?.course.max_class_name_len} |
| 342 | - minGradeLevel={limits.latest?.course.min_grade_level} | 349 | + minGradeLevel={limitData()?.course.min_grade_level} |
| 343 | - maxGradeLevel={limits.latest?.course.max_grade_level} | 350 | + maxGradeLevel={limitData()?.course.max_grade_level} |
| 344 | onSaved={async () => { setFlash(t("common.saved")); await refreshList(); }} | 351 | onSaved={async () => { setFlash(t("common.saved")); await refreshList(); }} |
| 345 | /> | 352 | /> |
| 346 | 353 | ||
| @@ -373,7 +380,7 @@ function ClassesContent() { | |||
| 373 | <Show when={skipped().length > 0}> | 380 | <Show when={skipped().length > 0}> |
| 374 | <Alert class="flex flex-wrap items-center justify-between gap-3 border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200"> | 381 | <Alert class="flex flex-wrap items-center justify-between gap-3 border-amber-500/40 bg-amber-500/10 text-amber-900 dark:text-amber-200"> |
| 375 | <span class="min-w-0 flex-1">{t("classBlueprints.skippedSummary", { count: skipped().length })}</span> | 382 | <span class="min-w-0 flex-1">{t("classBlueprints.skippedSummary", { count: skipped().length })}</span> |
| 376 | - <Button type="button" size="sm" variant="outline" class="shrink-0 rounded-lg" onClick={() => setReportOpen(true)}> | 383 | + <Button type="button" size="sm" variant="outline" class={cn(TOOLBAR_CONTROL, "shrink-0 px-3.5")} onClick={() => setReportOpen(true)}> |
| 377 | {t("classBlueprints.skippedDetails")} | 384 | {t("classBlueprints.skippedDetails")} |
| 378 | </Button> | 385 | </Button> |
| 379 | </Alert> | 386 | </Alert> |
| @@ -399,6 +406,10 @@ function ClassesContent() { | |||
| 399 | <TabsContent value="classes"> | 406 | <TabsContent value="classes"> |
| 400 | <div class="space-y-4"> | 407 | <div class="space-y-4"> |
| 401 | <Suspense fallback={<DataTableSkeleton columns={6} rows={8} />}> | 408 | <Suspense fallback={<DataTableSkeleton columns={6} rows={8} />}> |
| 409 | + <Show when={list.error}> | ||
| 410 | + <ErrorAlert message={formatApiError(list.error)} onRetry={() => void refreshList()} /> | ||
| 411 | + </Show> | ||
| 412 | + <Show when={!list.error}> | ||
| 402 | <DataTable | 413 | <DataTable |
| 403 | urlState | 414 | urlState |
| 404 | columns={columns()} | 415 | columns={columns()} |
| @@ -434,6 +445,7 @@ function ClassesContent() { | |||
| 434 | </Show> | 445 | </Show> |
| 435 | } | 446 | } |
| 436 | /> | 447 | /> |
| 448 | + </Show> | ||
| 437 | </Suspense> | 449 | </Suspense> |
| 438 | </div> | 450 | </div> |
| 439 | </TabsContent> | 451 | </TabsContent> |
src/pages/courses-page.test.tsxmodified+2 -2
| @@ -80,7 +80,7 @@ test("student course list filters on the server via kind, q and taught", async ( | |||
| 80 | expect(first.offset).toBe(0); | 80 | expect(first.offset).toBe(0); |
| 81 | 81 | ||
| 82 | // The kind tab refetches with `kind` and resets the offset. | 82 | // The kind tab refetches with `kind` and resets the offset. |
| 83 | - fireEvent.click(screen.getByRole("tab", { name: "Study" })); | 83 | + fireEvent.click(screen.getByRole("tab", { name: "Study sessions" })); |
| 84 | await waitFor(() => expect(getCourses.mock.calls.at(-1)[0].kind).toBe("study")); | 84 | await waitFor(() => expect(getCourses.mock.calls.at(-1)[0].kind).toBe("study")); |
| 85 | expect(getCourses.mock.calls.at(-1)[0]).not.toHaveProperty("q"); | 85 | expect(getCourses.mock.calls.at(-1)[0]).not.toHaveProperty("q"); |
| 86 | expect(getCourses.mock.calls.at(-1)[0].offset).toBe(0); | 86 | expect(getCourses.mock.calls.at(-1)[0].offset).toBe(0); |
| @@ -91,7 +91,7 @@ test("student course list filters on the server via kind, q and taught", async ( | |||
| 91 | // The kind tab keeps the search text and the sections choice, and restarts paging. | 91 | // The kind tab keeps the search text and the sections choice, and restarts paging. |
| 92 | expect(tabNavigation.search({ q: "alg", taught: "taught", page: 3, action: "new" })).toEqual({ q: "alg", taught: "taught", sort: undefined, action: undefined, kind: "study", page: undefined }); | 92 | expect(tabNavigation.search({ q: "alg", taught: "taught", page: 3, action: "new" })).toEqual({ q: "alg", taught: "taught", sort: undefined, action: undefined, kind: "study", page: undefined }); |
| 93 | 93 | ||
| 94 | - fireEvent.click(screen.getByRole("tab", { name: "Club" })); | 94 | + fireEvent.click(screen.getByRole("tab", { name: "Clubs" })); |
| 95 | await waitFor(() => expect(getCourses.mock.calls.at(-1)[0].kind).toBe("club")); | 95 | await waitFor(() => expect(getCourses.mock.calls.at(-1)[0].kind).toBe("club")); |
| 96 | expect(await screen.findByRole("button", { name: /^Robotics/ })).toBeTruthy(); | 96 | expect(await screen.findByRole("button", { name: /^Robotics/ })).toBeTruthy(); |
| 97 | 97 | ||
src/pages/dashboard-page.test.tsxmodified+2 -0
| @@ -45,6 +45,8 @@ const instance = { | |||
| 45 | id: "instance-1", | 45 | id: "instance-1", |
| 46 | class: "class-1", | 46 | class: "class-1", |
| 47 | course: "course-1", | 47 | course: "course-1", |
| 48 | + // The API resolves the section's display title (override → offering → catalog). | ||
| 49 | + title: "Algebra", | ||
| 48 | ders_saati: 4, | 50 | ders_saati: 4, |
| 49 | counts_toward_karne: true, | 51 | counts_toward_karne: true, |
| 50 | enrollment_count: 0, | 52 | enrollment_count: 0, |
src/pages/dashboard-page.tsxmodified+19 -2
| @@ -132,7 +132,11 @@ const kindKeys: Record<DeadlineKind, MessageKey> = { | |||
| 132 | function scheduleStatus(startsAt: number | null, endsAt: number | null, now: number): Status | null { | 132 | function scheduleStatus(startsAt: number | null, endsAt: number | null, now: number): Status | null { |
| 133 | if (startsAt == null || (endsAt ?? startsAt) < now) return null; | 133 | if (startsAt == null || (endsAt ?? startsAt) < now) return null; |
| 134 | if (startsAt <= now) return "active"; | 134 | if (startsAt <= now) return "active"; |
| 135 | - if (startsAt - now <= DAY_MS) return "today"; | 135 | + // "Bugün" means the viewer's calendar day, not the next 24 hours — a |
| 136 | + // deadline tomorrow morning read "Bugün" next to tomorrow's date. | ||
| 137 | + const endOfToday = new Date(now); | ||
| 138 | + endOfToday.setHours(24, 0, 0, 0); | ||
| 139 | + if (startsAt < endOfToday.getTime()) return "today"; | ||
| 136 | if (startsAt - now <= WEEK_MS) return "soon"; | 140 | if (startsAt - now <= WEEK_MS) return "soon"; |
| 137 | return null; | 141 | return null; |
| 138 | } | 142 | } |
| @@ -813,6 +817,18 @@ function DashboardContent() { | |||
| 813 | </div> | 817 | </div> |
| 814 | <h1 class="text-[28px] font-semibold leading-9 tracking-[-0.02em] text-text-strong">{t("dashboard.hero.heading")}</h1> | 818 | <h1 class="text-[28px] font-semibold leading-9 tracking-[-0.02em] text-text-strong">{t("dashboard.hero.heading")}</h1> |
| 815 | <CommandSearchField /> | 819 | <CommandSearchField /> |
| 820 | + {/* The quick links fan out over rosters; their own boundary keeps | ||
| 821 | + that wait from blanking the whole board behind the route | ||
| 822 | + spinner. */} | ||
| 823 | + <Suspense | ||
| 824 | + fallback={ | ||
| 825 | + <div class={cn("grid w-full grid-cols-1 gap-3", on("classes") ? "sm:grid-cols-3" : "sm:grid-cols-2")} aria-hidden="true"> | ||
| 826 | + <For each={on("classes") ? [0, 1, 2] : [0, 1]}> | ||
| 827 | + {() => <div class="h-[218px] animate-pulse rounded-xl border border-border-line bg-surface-base" />} | ||
| 828 | + </For> | ||
| 829 | + </div> | ||
| 830 | + } | ||
| 831 | + > | ||
| 816 | <div class={cn("grid w-full grid-cols-1 gap-3", on("classes") ? "sm:grid-cols-3" : "sm:grid-cols-2")}> | 832 | <div class={cn("grid w-full grid-cols-1 gap-3", on("classes") ? "sm:grid-cols-3" : "sm:grid-cols-2")}> |
| 817 | <QuickLinkColumn | 833 | <QuickLinkColumn |
| 818 | title={t("dashboard.quicklinks.students")} | 834 | title={t("dashboard.quicklinks.students")} |
| @@ -838,6 +854,7 @@ function DashboardContent() { | |||
| 838 | onOpen={() => navigate({ to: "/management/modules" })} | 854 | onOpen={() => navigate({ to: "/management/modules" })} |
| 839 | /> | 855 | /> |
| 840 | </div> | 856 | </div> |
| 857 | + </Suspense> | ||
| 841 | </header> | 858 | </header> |
| 842 | </Show> | 859 | </Show> |
| 843 | 860 | ||
| @@ -993,7 +1010,7 @@ function DashboardContent() { | |||
| 993 | <button | 1010 | <button |
| 994 | type="button" | 1011 | type="button" |
| 995 | onClick={() => navigate({ to: "/appointments" })} | 1012 | onClick={() => navigate({ to: "/appointments" })} |
| 996 | - class="flex w-full flex-col gap-0.5 border-t border-border-hairline py-2.5 text-left first:border-t-0" | 1013 | + class="-mx-2 flex w-[calc(100%+1rem)] flex-col gap-0.5 border-t border-border-hairline px-2 py-2.5 text-left outline-hidden transition-colors first:border-t-0 hover:bg-surface-tint focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring" |
| 997 | > | 1014 | > |
| 998 | <span class="truncate text-sm font-medium text-text-default">{personLabel(appointment.requester)}</span> | 1015 | <span class="truncate text-sm font-medium text-text-default">{personLabel(appointment.requester)}</span> |
| 999 | <span class="truncate text-xs text-text-subtle">{appointment.reason || "—"}</span> | 1016 | <span class="truncate text-xs text-text-subtle">{appointment.reason || "—"}</span> |
src/pages/event-detail-page.tsxmodified+3 -3
| @@ -207,15 +207,15 @@ function EventDetailContent() { | |||
| 207 | /> | 207 | /> |
| 208 | <div class="grid gap-3 border-t border-border-hairline pt-3 text-sm sm:grid-cols-3"> | 208 | <div class="grid gap-3 border-t border-border-hairline pt-3 text-sm sm:grid-cols-3"> |
| 209 | <div class="detail-metric-card"> | 209 | <div class="detail-metric-card"> |
| 210 | - <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.audience")}</p> | 210 | + <p class="text-xs font-medium text-muted-foreground">{t("events.audience")}</p> |
| 211 | <p class="mt-1 font-medium">{audienceLabel(ev().audience, t)}</p> | 211 | <p class="mt-1 font-medium">{audienceLabel(ev().audience, t)}</p> |
| 212 | </div> | 212 | </div> |
| 213 | <div class="detail-metric-card"> | 213 | <div class="detail-metric-card"> |
| 214 | - <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.starts")}</p> | 214 | + <p class="text-xs font-medium text-muted-foreground">{t("events.starts")}</p> |
| 215 | <p class="mt-1 font-medium">{formatDateTime(ev().starts_at, locale())}</p> | 215 | <p class="mt-1 font-medium">{formatDateTime(ev().starts_at, locale())}</p> |
| 216 | </div> | 216 | </div> |
| 217 | <div class="detail-metric-card"> | 217 | <div class="detail-metric-card"> |
| 218 | - <p class="text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground">{t("events.ends")}</p> | 218 | + <p class="text-xs font-medium text-muted-foreground">{t("events.ends")}</p> |
| 219 | <p class="mt-1 font-medium">{formatDateTime(ev().ends_at, locale())}</p> | 219 | <p class="mt-1 font-medium">{formatDateTime(ev().ends_at, locale())}</p> |
| 220 | </div> | 220 | </div> |
| 221 | </div> | 221 | </div> |
src/pages/events-page.tsxmodified+2 -5
| @@ -30,8 +30,6 @@ import { scheduleStatusClass, scheduleStatusDotClass } from "@/lib/schedule-stat | |||
| 30 | import { useAuth } from "@/stores/auth-context"; | 30 | import { useAuth } from "@/stores/auth-context"; |
| 31 | import { usePreferences, useT } from "@/stores/preferences-context"; | 31 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 32 | 32 | ||
| 33 | -const EVENT_PAGE_SIZE = 10; | ||
| 34 | - | ||
| 35 | export default function EventsPage() { | 33 | export default function EventsPage() { |
| 36 | return ( | 34 | return ( |
| 37 | <RouteGuard> | 35 | <RouteGuard> |
| @@ -131,7 +129,7 @@ function EventsContent() { | |||
| 131 | const columns = createMemo<ColumnDef<Event>[]>(() => [ | 129 | const columns = createMemo<ColumnDef<Event>[]>(() => [ |
| 132 | { | 130 | { |
| 133 | accessorKey: "title", | 131 | accessorKey: "title", |
| 134 | - header: t("events.title"), | 132 | + header: t("form.title"), |
| 135 | size: 220, | 133 | size: 220, |
| 136 | minSize: 180, | 134 | minSize: 180, |
| 137 | meta: { cellClass: "max-w-0" }, | 135 | meta: { cellClass: "max-w-0" }, |
| @@ -211,7 +209,7 @@ function EventsContent() { | |||
| 211 | 209 | ||
| 212 | return ( | 210 | return ( |
| 213 | <div class="space-y-6"> | 211 | <div class="space-y-6"> |
| 214 | - <SidePanel guardUnsaved open={canCreate() && showForm()} onOpenChange={setShowForm} title={t("events.create")} description={t("events.subtitle")}> | 212 | + <SidePanel guardUnsaved open={canCreate() && showForm()} onOpenChange={setShowForm} title={t("events.create")} description={t("events.createHint")}> |
| 215 | <EventForm | 213 | <EventForm |
| 216 | submitLabel={t("common.create")} | 214 | submitLabel={t("common.create")} |
| 217 | onCancel={() => setShowForm(false)} | 215 | onCancel={() => setShowForm(false)} |
| @@ -300,7 +298,6 @@ function EventsContent() { | |||
| 300 | searchPredicate={searchEvent} | 298 | searchPredicate={searchEvent} |
| 301 | filterHint={t("search.hint.events")} | 299 | filterHint={t("search.hint.events")} |
| 302 | enablePagination | 300 | enablePagination |
| 303 | - pageSize={EVENT_PAGE_SIZE} | ||
| 304 | empty={t("events.empty")} | 301 | empty={t("events.empty")} |
| 305 | pageResetKey={timeFilter()} | 302 | pageResetKey={timeFilter()} |
| 306 | filtersActive={timeFilter() !== "all"} | 303 | filtersActive={timeFilter() !== "all"} |
src/pages/exam-detail-page.tsxmodified+9 -21
| @@ -1,6 +1,5 @@ | |||
| 1 | import { Link, useLocation, useNavigate } from "@tanstack/solid-router"; | 1 | import { Link, useLocation, useNavigate } from "@tanstack/solid-router"; |
| 2 | import { For, Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js"; | 2 | import { For, Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js"; |
| 3 | -import { createResponsivePageSize } from "@/lib/create-page-size"; | ||
| 4 | import { createResource } from "@/lib/create-resource"; | 3 | import { createResource } from "@/lib/create-resource"; |
| 5 | import type { ColumnDef } from "@tanstack/solid-table"; | 4 | import type { ColumnDef } from "@tanstack/solid-table"; |
| 6 | import { deleteExamById } from "@/api/exams"; | 5 | import { deleteExamById } from "@/api/exams"; |
| @@ -10,6 +9,7 @@ import { getExamAttempt } from "@/api/exams"; | |||
| 10 | import { getExamLive } from "@/api/exams"; | 9 | import { getExamLive } from "@/api/exams"; |
| 11 | import { getExamResult } from "@/api/exams"; | 10 | import { getExamResult } from "@/api/exams"; |
| 12 | import { getExamResults } from "@/api/exams"; | 11 | import { getExamResults } from "@/api/exams"; |
| 12 | +import { loadAllPages } from "@/lib/capped-list"; | ||
| 13 | import { getStudentMarksHistory } from "@/api/exams"; | 13 | import { getStudentMarksHistory } from "@/api/exams"; |
| 14 | import { getExamStatistics } from "@/api/exams"; | 14 | import { getExamStatistics } from "@/api/exams"; |
| 15 | import { getInstanceById, getInstanceEnrollments, getMyInstances } from "@/api/instances"; | 15 | import { getInstanceById, getInstanceEnrollments, getMyInstances } from "@/api/instances"; |
| @@ -51,7 +51,6 @@ import { scheduleStatusClass } from "@/lib/schedule-status"; | |||
| 51 | import { useAuth } from "@/stores/auth-context"; | 51 | import { useAuth } from "@/stores/auth-context"; |
| 52 | import { usePreferences, useT } from "@/stores/preferences-context"; | 52 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 53 | 53 | ||
| 54 | -const RESULT_PAGE_SIZE = 10; | ||
| 55 | 54 | ||
| 56 | export default function ExamDetailPage() { | 55 | export default function ExamDetailPage() { |
| 57 | return ( | 56 | return ( |
| @@ -116,9 +115,6 @@ function ExamDetailContent() { | |||
| 116 | const [deleteOpen, setDeleteOpen] = createSignal(false); | 115 | const [deleteOpen, setDeleteOpen] = createSignal(false); |
| 117 | const [removeUserId, setRemoveUserId] = createSignal<string | null>(null); | 116 | const [removeUserId, setRemoveUserId] = createSignal<string | null>(null); |
| 118 | const [gradeOpen, setGradeOpen] = createSignal(false); | 117 | const [gradeOpen, setGradeOpen] = createSignal(false); |
| 119 | - const [resultPage, setResultPage] = createSignal(0); | ||
| 120 | - const resultPageSize = createResponsivePageSize(RESULT_PAGE_SIZE); | ||
| 121 | - createEffect(on(resultPageSize, () => setResultPage(0), { defer: true })); | ||
| 122 | const [answerSheetUserId, setAnswerSheetUserId] = createSignal<string | null>(null); | 118 | const [answerSheetUserId, setAnswerSheetUserId] = createSignal<string | null>(null); |
| 123 | const [answerSheetUserLabel, setAnswerSheetUserLabel] = createSignal(""); | 119 | const [answerSheetUserLabel, setAnswerSheetUserLabel] = createSignal(""); |
| 124 | const openAnswerSheet = (userId: string, label: string) => { | 120 | const openAnswerSheet = (userId: string, label: string) => { |
| @@ -163,11 +159,13 @@ function ExamDetailContent() { | |||
| 163 | ); | 159 | ); |
| 164 | 160 | ||
| 165 | const [results, { refetch: refetchResults }] = createResource( | 161 | const [results, { refetch: refetchResults }] = createResource( |
| 166 | - () => (hasCourseManagementRights() ? [id(), resultPage(), resultPageSize()] as const : null), | 162 | + // One exam's results are bounded by its enrolled students, and the table |
| 167 | - async (source) => { | 163 | + // searches and sorts them in the browser: read them all so the search |
| 168 | - if (!source) return { items: [], total: 0, limit: RESULT_PAGE_SIZE, offset: 0 }; | 164 | + // sees every row, not just the page on screen. |
| 169 | - const [examId, page, size] = source; | 165 | + () => (hasCourseManagementRights() ? id() : null), |
| 170 | - return getExamResults(examId, { limit: size, offset: page * size }); | 166 | + async (examId) => { |
| 167 | + const items = await loadAllPages((paging) => getExamResults(examId, paging)); | ||
| 168 | + return { items, total: items.length, limit: items.length, offset: 0 }; | ||
| 171 | }, | 169 | }, |
| 172 | ); | 170 | ); |
| 173 | const [gradeResults, { refetch: refetchGradeResults }] = createResource( | 171 | const [gradeResults, { refetch: refetchGradeResults }] = createResource( |
| @@ -267,8 +265,6 @@ function ExamDetailContent() { | |||
| 267 | () => (hasCourseManagementRights() && gradeOpen() && !isFinished() ? id() : null), | 265 | () => (hasCourseManagementRights() && gradeOpen() && !isFinished() ? id() : null), |
| 268 | async (examId) => examId ? getExamLive(examId) : null, | 266 | async (examId) => examId ? getExamLive(examId) : null, |
| 269 | ); | 267 | ); |
| 270 | - const resultTotal = () => results()?.total ?? 0; | ||
| 271 | - const resultTotalPages = () => Math.max(1, Math.ceil(resultTotal() / resultPageSize())); | ||
| 272 | const setClampedAnswerMark = (value: string) => { | 268 | const setClampedAnswerMark = (value: string) => { |
| 273 | if (value === "") { | 269 | if (value === "") { |
| 274 | setAnswerMark(value); | 270 | setAnswerMark(value); |
| @@ -299,9 +295,6 @@ function ExamDetailContent() { | |||
| 299 | setAnswerPending(false); | 295 | setAnswerPending(false); |
| 300 | } | 296 | } |
| 301 | }; | 297 | }; |
| 302 | - createEffect(() => { | ||
| 303 | - if (resultPage() >= resultTotalPages()) setResultPage(resultTotalPages() - 1); | ||
| 304 | - }); | ||
| 305 | const gradeStudents = () => { | 298 | const gradeStudents = () => { |
| 306 | if (gradeResults.loading) return []; | 299 | if (gradeResults.loading) return []; |
| 307 | const graded = new Set((gradeResults()?.items ?? []).map((row) => personId(row.user))); | 300 | const graded = new Set((gradeResults()?.items ?? []).map((row) => personId(row.user))); |
| @@ -730,12 +723,7 @@ function ExamDetailContent() { | |||
| 730 | filterColumn="user" | 723 | filterColumn="user" |
| 731 | empty={t("exams.noResults")} | 724 | empty={t("exams.noResults")} |
| 732 | emptyIllustration="exams" | 725 | emptyIllustration="exams" |
| 733 | - manualPagination={{ | 726 | + filterHint={t("search.hint.examResults")} |
| 734 | - pageIndex: Math.min(resultPage(), resultTotalPages() - 1), | ||
| 735 | - pageSize: resultPageSize(), | ||
| 736 | - total: resultTotal(), | ||
| 737 | - onPageChange: setResultPage, | ||
| 738 | - }} | ||
| 739 | actions={ | 727 | actions={ |
| 740 | <> | 728 | <> |
| 741 | <Show when={isFinished()}> | 729 | <Show when={isFinished()}> |
src/pages/exam-room-page.tsxmodified+7 -3
| @@ -9,6 +9,8 @@ import { RouteGuard } from "@/components/layout/route-guard"; | |||
| 9 | import { PageHeader } from "@/components/layout/page-header"; | 9 | import { PageHeader } from "@/components/layout/page-header"; |
| 10 | import { Alert } from "@/components/ui/alert"; | 10 | import { Alert } from "@/components/ui/alert"; |
| 11 | import { Button } from "@/components/ui/button"; | 11 | import { Button } from "@/components/ui/button"; |
| 12 | +import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | ||
| 13 | +import { cn } from "@/lib/cn"; | ||
| 12 | import { IconChevronLeft } from "@/components/ui/icons"; | 14 | import { IconChevronLeft } from "@/components/ui/icons"; |
| 13 | import { PageSpinner } from "@/components/ui/page-spinner"; | 15 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 14 | import { useAuth } from "@/stores/auth-context"; | 16 | import { useAuth } from "@/stores/auth-context"; |
| @@ -67,9 +69,11 @@ function ExamRoomContent() { | |||
| 67 | title={ex().title} | 69 | title={ex().title} |
| 68 | description={ex().description || undefined} | 70 | description={ex().description || undefined} |
| 69 | actions={ | 71 | actions={ |
| 70 | - <div class="flex w-full flex-wrap items-center gap-1 rounded-lg border bg-background/80 p-1 shadow-xs sm:w-auto"> | 72 | + // The toolbar pill, like the live monitor's Back; the Link is |
| 71 | - <Link to="/exams/$id" params={{ id: id() }}> | 73 | + // `contents` so the slot sizes the Button, not the anchor. |
| 72 | - <Button variant="ghost" size="sm" class="w-full rounded-md sm:w-auto"> | 74 | + <div class={cn("flex w-full flex-wrap items-center gap-2 sm:w-auto", TOOLBAR_SLOT)}> |
| 75 | + <Link to="/exams/$id" params={{ id: id() }} class="contents"> | ||
| 76 | + <Button variant="outline" size="sm" class="w-full sm:w-auto"> | ||
| 73 | <IconChevronLeft class="h-4 w-4" /> | 77 | <IconChevronLeft class="h-4 w-4" /> |
| 74 | {t("common.back")} | 78 | {t("common.back")} |
| 75 | </Button> | 79 | </Button> |
src/pages/exams-page.tsxmodified+9 -7
| @@ -40,7 +40,6 @@ import { createUrlEnum, createUrlString } from "@/lib/url-state"; | |||
| 40 | import { useAuth } from "@/stores/auth-context"; | 40 | import { useAuth } from "@/stores/auth-context"; |
| 41 | import { usePreferences, useT } from "@/stores/preferences-context"; | 41 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 42 | 42 | ||
| 43 | -const EXAM_PAGE_SIZE = 10; | ||
| 44 | // The course combobox is a bordered div, not a <button>, so the DataTable | 43 | // The course combobox is a bordered div, not a <button>, so the DataTable |
| 45 | // filters slot cannot size it: it takes the toolbar pill by hand. | 44 | // filters slot cannot size it: it takes the toolbar pill by hand. |
| 46 | const COURSE_FILTER_CLASS = cn(TOOLBAR_CONTROL, "min-w-[12rem] max-w-[18rem] [&_input]:text-[13px]"); | 45 | const COURSE_FILTER_CLASS = cn(TOOLBAR_CONTROL, "min-w-[12rem] max-w-[18rem] [&_input]:text-[13px]"); |
| @@ -413,7 +412,6 @@ function ExamsContent() { | |||
| 413 | filterHint={t("search.hint.exams")} | 412 | filterHint={t("search.hint.exams")} |
| 414 | searchPredicate={searchExam} | 413 | searchPredicate={searchExam} |
| 415 | enablePagination | 414 | enablePagination |
| 416 | - pageSize={EXAM_PAGE_SIZE} | ||
| 417 | empty={emptyMessage()} | 415 | empty={emptyMessage()} |
| 418 | urlState | 416 | urlState |
| 419 | pageResetKey={`${tab()}|${courseFilter()}|${kindFilter()}`} | 417 | pageResetKey={`${tab()}|${courseFilter()}|${kindFilter()}`} |
| @@ -423,9 +421,9 @@ function ExamsContent() { | |||
| 423 | onRowClick={(exam) => void navigate({ to: "/exams/$id", params: { id: exam.id } })} | 421 | onRowClick={(exam) => void navigate({ to: "/exams/$id", params: { id: exam.id } })} |
| 424 | filters={ | 422 | filters={ |
| 425 | <div class="flex flex-wrap items-center gap-2.5"> | 423 | <div class="flex flex-wrap items-center gap-2.5"> |
| 426 | - <label for="exams-course-filter" class="text-xs font-semibold text-muted-foreground">{t("nav.courses")}:</label> | ||
| 427 | <SearchableSelect | 424 | <SearchableSelect |
| 428 | id="exams-course-filter" | 425 | id="exams-course-filter" |
| 426 | + labelPrefix={t("nav.courses")} | ||
| 429 | class={cn(COURSE_FILTER_CLASS, courseFilter() !== "all" && "border-primary text-primary-text")} | 427 | class={cn(COURSE_FILTER_CLASS, courseFilter() !== "all" && "border-primary text-primary-text")} |
| 430 | value={courseFilter()} | 428 | value={courseFilter()} |
| 431 | onChange={(val) => setCourseFilter(val)} | 429 | onChange={(val) => setCourseFilter(val)} |
| @@ -485,12 +483,13 @@ function ExamsContent() { | |||
| 485 | <button | 483 | <button |
| 486 | type="button" | 484 | type="button" |
| 487 | class={cn( | 485 | class={cn( |
| 488 | - "rounded-md px-3 py-1.5 text-xs font-medium transition-colors", | 486 | + "inline-flex h-8 items-center rounded-md px-3 text-xs font-medium transition-colors touch:h-10", |
| 489 | createStep() === "details" | 487 | createStep() === "details" |
| 490 | ? "bg-surface-base text-foreground shadow-xs" | 488 | ? "bg-surface-base text-foreground shadow-xs" |
| 491 | : "text-muted-foreground hover:bg-muted/50", | 489 | : "text-muted-foreground hover:bg-muted/50", |
| 492 | )} | 490 | )} |
| 493 | onClick={() => setCreateStep("details")} | 491 | onClick={() => setCreateStep("details")} |
| 492 | + aria-pressed={createStep() === "details"} | ||
| 494 | > | 493 | > |
| 495 | {t("exams.step1Details")} | 494 | {t("exams.step1Details")} |
| 496 | </button> | 495 | </button> |
| @@ -498,7 +497,7 @@ function ExamsContent() { | |||
| 498 | type="button" | 497 | type="button" |
| 499 | disabled={!createdExam()} | 498 | disabled={!createdExam()} |
| 500 | class={cn( | 499 | class={cn( |
| 501 | - "rounded-md px-3 py-1.5 text-xs font-medium transition-colors", | 500 | + "inline-flex h-8 items-center rounded-md px-3 text-xs font-medium transition-colors touch:h-10", |
| 502 | createStep() === "questions" | 501 | createStep() === "questions" |
| 503 | ? "bg-surface-base text-foreground shadow-xs" | 502 | ? "bg-surface-base text-foreground shadow-xs" |
| 504 | : createdExam() | 503 | : createdExam() |
| @@ -506,6 +505,7 @@ function ExamsContent() { | |||
| 506 | : "opacity-40 cursor-not-allowed text-muted-foreground", | 505 | : "opacity-40 cursor-not-allowed text-muted-foreground", |
| 507 | )} | 506 | )} |
| 508 | onClick={() => createdExam() && setCreateStep("questions")} | 507 | onClick={() => createdExam() && setCreateStep("questions")} |
| 508 | + aria-pressed={createStep() === "questions"} | ||
| 509 | > | 509 | > |
| 510 | {t("exams.step2Questions")} | 510 | {t("exams.step2Questions")} |
| 511 | </button> | 511 | </button> |
| @@ -581,24 +581,26 @@ function ExamsContent() { | |||
| 581 | <button | 581 | <button |
| 582 | type="button" | 582 | type="button" |
| 583 | class={cn( | 583 | class={cn( |
| 584 | - "rounded-md px-3 py-1.5 text-xs font-medium transition-colors", | 584 | + "inline-flex h-8 items-center rounded-md px-3 text-xs font-medium transition-colors touch:h-10", |
| 585 | editTab() === "details" | 585 | editTab() === "details" |
| 586 | ? "bg-surface-base text-foreground shadow-xs" | 586 | ? "bg-surface-base text-foreground shadow-xs" |
| 587 | : "text-muted-foreground hover:bg-muted/50", | 587 | : "text-muted-foreground hover:bg-muted/50", |
| 588 | )} | 588 | )} |
| 589 | onClick={() => setEditTab("details")} | 589 | onClick={() => setEditTab("details")} |
| 590 | + aria-pressed={editTab() === "details"} | ||
| 590 | > | 591 | > |
| 591 | {t("exams.step1Details")} | 592 | {t("exams.step1Details")} |
| 592 | </button> | 593 | </button> |
| 593 | <button | 594 | <button |
| 594 | type="button" | 595 | type="button" |
| 595 | class={cn( | 596 | class={cn( |
| 596 | - "rounded-md px-3 py-1.5 text-xs font-medium transition-colors", | 597 | + "inline-flex h-8 items-center rounded-md px-3 text-xs font-medium transition-colors touch:h-10", |
| 597 | editTab() === "questions" | 598 | editTab() === "questions" |
| 598 | ? "bg-surface-base text-foreground shadow-xs" | 599 | ? "bg-surface-base text-foreground shadow-xs" |
| 599 | : "text-muted-foreground hover:bg-muted/50", | 600 | : "text-muted-foreground hover:bg-muted/50", |
| 600 | )} | 601 | )} |
| 601 | onClick={() => setEditTab("questions")} | 602 | onClick={() => setEditTab("questions")} |
| 603 | + aria-pressed={editTab() === "questions"} | ||
| 602 | > | 604 | > |
| 603 | {t("exams.step2Questions")} | 605 | {t("exams.step2Questions")} |
| 604 | </button> | 606 | </button> |
src/pages/guide-page.tsxmodified+17 -16
| @@ -37,16 +37,17 @@ type GuideStep = { | |||
| 37 | studentOnly?: boolean; | 37 | studentOnly?: boolean; |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | -const CARD_TONE = "border-sky-500/40 dark:border-sky-500/30 hover:border-sky-500/70 ring-1 ring-sky-500/20"; | 40 | +// Brand tones, so a custom accent palette recolours the guide like the rest of the app. |
| 41 | -const BADGE_TONE = "border-sky-500/40 text-foreground bg-card"; | 41 | +const CARD_TONE = "border-primary/40 dark:border-primary/30 hover:border-primary/70 ring-1 ring-primary/20"; |
| 42 | +const BADGE_TONE = "border-primary/40 text-foreground bg-card"; | ||
| 42 | 43 | ||
| 43 | const STEPS: GuideStep[] = [ | 44 | const STEPS: GuideStep[] = [ |
| 44 | - { id: "ai", stepNumber: "01", borderTone: CARD_TONE, icon: IconSparkles, iconColor: "text-sky-400", to: "/ai/study" }, | 45 | + { id: "ai", stepNumber: "01", borderTone: CARD_TONE, icon: IconSparkles, iconColor: "text-primary-text", to: "/ai/study" }, |
| 45 | - { id: "notes", stepNumber: "02", borderTone: CARD_TONE, icon: IconNote, iconColor: "text-sky-400", to: "/notes" }, | 46 | + { id: "notes", stepNumber: "02", borderTone: CARD_TONE, icon: IconNote, iconColor: "text-primary-text", to: "/notes" }, |
| 46 | - { id: "questions", stepNumber: "03", borderTone: CARD_TONE, icon: IconBook, iconColor: "text-sky-400", to: "/questions" }, | 47 | + { id: "questions", stepNumber: "03", borderTone: CARD_TONE, icon: IconBook, iconColor: "text-primary-text", to: "/questions" }, |
| 47 | - { id: "courses", stepNumber: "04", borderTone: CARD_TONE, icon: IconCalendarDays, iconColor: "text-sky-400", to: "/courses" }, | 48 | + { id: "courses", stepNumber: "04", borderTone: CARD_TONE, icon: IconCalendarDays, iconColor: "text-primary-text", to: "/courses" }, |
| 48 | - { id: "exams", stepNumber: "05", borderTone: CARD_TONE, icon: IconExam, iconColor: "text-sky-400", to: "/exams" }, | 49 | + { id: "exams", stepNumber: "05", borderTone: CARD_TONE, icon: IconExam, iconColor: "text-primary-text", to: "/exams" }, |
| 49 | - { id: "marks", stepNumber: "06", borderTone: CARD_TONE, icon: IconReportAnalytics, iconColor: "text-sky-400", to: "/marks", studentOnly: true }, | 50 | + { id: "marks", stepNumber: "06", borderTone: CARD_TONE, icon: IconReportAnalytics, iconColor: "text-primary-text", to: "/marks", studentOnly: true }, |
| 50 | ]; | 51 | ]; |
| 51 | 52 | ||
| 52 | type RoleTab = { | 53 | type RoleTab = { |
| @@ -57,17 +58,17 @@ type RoleTab = { | |||
| 57 | }; | 58 | }; |
| 58 | 59 | ||
| 59 | const ROLE_TABS: RoleTab[] = [ | 60 | const ROLE_TABS: RoleTab[] = [ |
| 60 | - { id: "student", tabKey: "role.student", icon: IconSchool, checkColor: "text-emerald-400" }, | 61 | + { id: "student", tabKey: "role.student", icon: IconSchool, checkColor: "text-emerald-600 dark:text-emerald-400" }, |
| 61 | - { id: "teacher", tabKey: "role.teacher", icon: IconClipboardCheck, checkColor: "text-sky-400" }, | 62 | + { id: "teacher", tabKey: "role.teacher", icon: IconClipboardCheck, checkColor: "text-sky-600 dark:text-sky-400" }, |
| 62 | - { id: "parent", tabKey: "role.parent", icon: IconUsers, checkColor: "text-violet-400" }, | 63 | + { id: "parent", tabKey: "role.parent", icon: IconUsers, checkColor: "text-violet-600 dark:text-violet-400" }, |
| 63 | - { id: "admin", tabKey: "guide.roles.adminTab", icon: IconUserCog, checkColor: "text-amber-400" }, | 64 | + { id: "admin", tabKey: "guide.roles.adminTab", icon: IconUserCog, checkColor: "text-amber-600 dark:text-amber-400" }, |
| 64 | ]; | 65 | ]; |
| 65 | 66 | ||
| 66 | const TIPS = [ | 67 | const TIPS = [ |
| 67 | - { id: "locale", icon: IconGlobe, tone: "text-violet-400" }, | 68 | + { id: "locale", icon: IconGlobe, tone: "text-violet-600 dark:text-violet-400" }, |
| 68 | - { id: "sync", icon: IconClock, tone: "text-sky-400" }, | 69 | + { id: "sync", icon: IconClock, tone: "text-sky-600 dark:text-sky-400" }, |
| 69 | - { id: "import", icon: IconFileText, tone: "text-amber-400" }, | 70 | + { id: "import", icon: IconFileText, tone: "text-amber-600 dark:text-amber-400" }, |
| 70 | - { id: "weights", icon: IconChart, tone: "text-emerald-400" }, | 71 | + { id: "weights", icon: IconChart, tone: "text-emerald-600 dark:text-emerald-400" }, |
| 71 | ] satisfies { id: string; icon: Component<{ class?: string }>; tone: string }[]; | 72 | ] satisfies { id: string; icon: Component<{ class?: string }>; tone: string }[]; |
| 72 | 73 | ||
| 73 | const ITEM_INDEXES = [1, 2, 3, 4] as const; | 74 | const ITEM_INDEXES = [1, 2, 3, 4] as const; |
src/pages/homework-detail-page.tsxmodified+11 -7
| @@ -32,15 +32,19 @@ export default function HomeworkDetailPage() { | |||
| 32 | const [homework] = createResource(id, (homeworkId) => getHomeworkById(homeworkId)); | 32 | const [homework] = createResource(id, (homeworkId) => getHomeworkById(homeworkId)); |
| 33 | // Homework hangs off the instance; the catalog course behind it is one hop | 33 | // Homework hangs off the instance; the catalog course behind it is one hop |
| 34 | // further, and it is what names the work on screen. | 34 | // further, and it is what names the work on screen. |
| 35 | - const [instance] = createResource(() => homework()?.class_course ?? null, (instanceId) => getInstanceById(instanceId)); | 35 | + // Section, course and subject only add context: a student may be refused |
| 36 | - const [course] = createResource(() => instance()?.course ?? null, (courseId) => getCourseById(courseId)); | 36 | + // one of them, and a refusal read from a resource would throw to the root |
| 37 | + // error screen. They fall back to null and the page shows what it has. | ||
| 38 | + const orNull = <T,>(load: Promise<T>) => load.catch(() => null); | ||
| 39 | + const [instance] = createResource(() => homework()?.class_course ?? null, (instanceId) => orNull(getInstanceById(instanceId))); | ||
| 40 | + const [course] = createResource(() => instance()?.course ?? null, (courseId) => orNull(getCourseById(courseId))); | ||
| 37 | // "<ders> — <şube>": the same ders runs in several şubeler, and their | 41 | // "<ders> — <şube>": the same ders runs in several şubeler, and their |
| 38 | // homework shares titles, so the header names the şube too. | 42 | // homework shares titles, so the header names the şube too. |
| 39 | const [sectionLabel] = createResource( | 43 | const [sectionLabel] = createResource( |
| 40 | () => homework()?.class_course ?? null, | 44 | () => homework()?.class_course ?? null, |
| 41 | async (instanceId) => (await loadInstanceLabel(instanceId, auth.user()?.role))?.label ?? null, | 45 | async (instanceId) => (await loadInstanceLabel(instanceId, auth.user()?.role))?.label ?? null, |
| 42 | ); | 46 | ); |
| 43 | - const [subject] = createResource(() => homework()?.subject ?? null, async (subjectId) => subjectId ? getSubjectById(subjectId) : null); | 47 | + const [subject] = createResource(() => homework()?.subject ?? null, async (subjectId) => subjectId ? orNull(getSubjectById(subjectId)) : null); |
| 44 | // A subject named exactly like its course ("Matematik / Matematik") adds | 48 | // A subject named exactly like its course ("Matematik / Matematik") adds |
| 45 | // nothing next to the course tile, so that tile is left out. | 49 | // nothing next to the course tile, so that tile is left out. |
| 46 | const showSubject = () => { | 50 | const showSubject = () => { |
| @@ -70,21 +74,21 @@ export default function HomeworkDetailPage() { | |||
| 70 | </section> | 74 | </section> |
| 71 | <section class={`data-shell grid gap-3 p-4 text-sm sm:grid-cols-2 sm:p-5 ${showSubject() ? "lg:grid-cols-4" : "lg:grid-cols-3"}`}> | 75 | <section class={`data-shell grid gap-3 p-4 text-sm sm:grid-cols-2 sm:p-5 ${showSubject() ? "lg:grid-cols-4" : "lg:grid-cols-3"}`}> |
| 72 | <div class="rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"> | 76 | <div class="rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"> |
| 73 | - <p class="text-xs font-medium uppercase tracking-[0.08em] text-text-subtle">{t("nav.courses")}</p> | 77 | + <p class="text-xs font-medium text-text-subtle">{t("nav.courses")}</p> |
| 74 | <p class="mt-1 font-medium text-text-default">{sectionLabel.latest ?? course()?.title ?? "—"}</p> | 78 | <p class="mt-1 font-medium text-text-default">{sectionLabel.latest ?? course()?.title ?? "—"}</p> |
| 75 | </div> | 79 | </div> |
| 76 | <Show when={showSubject()}> | 80 | <Show when={showSubject()}> |
| 77 | <div class="rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"> | 81 | <div class="rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"> |
| 78 | - <p class="text-xs font-medium uppercase tracking-[0.08em] text-text-subtle">{t("subjects.subject")}</p> | 82 | + <p class="text-xs font-medium text-text-subtle">{t("subjects.subject")}</p> |
| 79 | <p class="mt-1 font-medium text-text-default">{subject()?.name}</p> | 83 | <p class="mt-1 font-medium text-text-default">{subject()?.name}</p> |
| 80 | </div> | 84 | </div> |
| 81 | </Show> | 85 | </Show> |
| 82 | <div class="rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"> | 86 | <div class="rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"> |
| 83 | - <p class="text-xs font-medium uppercase tracking-[0.08em] text-text-subtle">{t("homework.dueAt")}</p> | 87 | + <p class="text-xs font-medium text-text-subtle">{t("homework.dueAt")}</p> |
| 84 | <p class="mt-1 font-medium text-text-default">{formatDateTime(item().due_at, locale())}</p> | 88 | <p class="mt-1 font-medium text-text-default">{formatDateTime(item().due_at, locale())}</p> |
| 85 | </div> | 89 | </div> |
| 86 | <div class="rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"> | 90 | <div class="rounded-xl border border-border-hairline bg-surface-tint px-4 py-4"> |
| 87 | - <p class="text-xs font-medium uppercase tracking-[0.08em] text-text-subtle">{t("homework.assigned")}</p> | 91 | + <p class="text-xs font-medium text-text-subtle">{t("homework.assigned")}</p> |
| 88 | <Badge variant="outline" class="mt-2 rounded-full"> | 92 | <Badge variant="outline" class="mt-2 rounded-full"> |
| 89 | {item().assigned?.length ? t("common.countItem", { count: item().assigned!.length, item: t("courses.rosterItem") }) : t("homework.wholeCourse")} | 93 | {item().assigned?.length ? t("common.countItem", { count: item().assigned!.length, item: t("courses.rosterItem") }) : t("homework.wholeCourse")} |
| 90 | </Badge> | 94 | </Badge> |
src/pages/homework-page.tsxmodified+14 -7
| @@ -88,7 +88,9 @@ function HomeworkContent() { | |||
| 88 | // class: the şube filter lists them all, the create form only for teachers. | 88 | // class: the şube filter lists them all, the create form only for teachers. |
| 89 | const [instances] = createResource( | 89 | const [instances] = createResource( |
| 90 | () => auth.user()?.role ?? null, | 90 | () => auth.user()?.role ?? null, |
| 91 | - (role) => loadInstanceOptions(role ?? undefined), | 91 | + // A failed section list only empties the picker; the homework list |
| 92 | + // still loads and shows its own error. | ||
| 93 | + (role) => loadInstanceOptions(role ?? undefined).catch(() => []), | ||
| 92 | ); | 94 | ); |
| 93 | const manageableCourses = createMemo(() => (hasMinRole(auth.user()?.role, "teacher") ? instances() ?? [] : [])); | 95 | const manageableCourses = createMemo(() => (hasMinRole(auth.user()?.role, "teacher") ? instances() ?? [] : [])); |
| 94 | // The şube filter, as on /exams; it lives in the URL beside the table's own | 96 | // The şube filter, as on /exams; it lives in the URL beside the table's own |
| @@ -97,7 +99,7 @@ function HomeworkContent() { | |||
| 97 | // A homework subject must sit in the chosen section's resolved subject set. | 99 | // A homework subject must sit in the chosen section's resolved subject set. |
| 98 | const [subjects] = createResource( | 100 | const [subjects] = createResource( |
| 99 | () => selectedCourseId() || null, | 101 | () => selectedCourseId() || null, |
| 100 | - async (instanceId) => (instanceId ? (await getInstanceSubjects(instanceId)).subjects : []), | 102 | + async (instanceId) => (instanceId ? (await getInstanceSubjects(instanceId).catch(() => ({ subjects: [] }))).subjects : []), |
| 101 | ); | 103 | ); |
| 102 | const [serverTime] = createResource(() => getTime().catch(() => ({ now: Date.now() }))); | 104 | const [serverTime] = createResource(() => getTime().catch(() => ({ now: Date.now() }))); |
| 103 | const courseName = (id: string) => courseNames()[id] ?? "—"; | 105 | const courseName = (id: string) => courseNames()[id] ?? "—"; |
| @@ -129,12 +131,14 @@ function HomeworkContent() { | |||
| 129 | return { items, total: items.length }; | 131 | return { items, total: items.length }; |
| 130 | }, | 132 | }, |
| 131 | ); | 133 | ); |
| 134 | + // An errored resource throws when read: every read of the list goes through here. | ||
| 135 | + const listItems = () => (list.error ? [] : list()?.items ?? []); | ||
| 132 | const courseFilterOptions = createMemo(() => { | 136 | const courseFilterOptions = createMemo(() => { |
| 133 | const known = instances() ?? []; | 137 | const known = instances() ?? []; |
| 134 | const knownIds = new Set(known.map((row) => row.id)); | 138 | const knownIds = new Set(known.map((row) => row.id)); |
| 135 | // Homework in a şube the picker does not list (e.g. one the caller only | 139 | // Homework in a şube the picker does not list (e.g. one the caller only |
| 136 | // sees through an assignment) still gets its own entry, after the rest. | 140 | // sees through an assignment) still gets its own entry, after the rest. |
| 137 | - const extra = [...new Set((list()?.items ?? []).map((item) => item.class_course))] | 141 | + const extra = [...new Set(listItems().map((item) => item.class_course))] |
| 138 | .filter((id) => !knownIds.has(id) && courseNames()[id]) | 142 | .filter((id) => !knownIds.has(id) && courseNames()[id]) |
| 139 | .map((id) => ({ value: id, label: courseNames()[id] })); | 143 | .map((id) => ({ value: id, label: courseNames()[id] })); |
| 140 | return [{ value: "all", label: t("common.all") }, ...known.map((row) => ({ value: row.id, label: row.label })), ...extra]; | 144 | return [{ value: "all", label: t("common.all") }, ...known.map((row) => ({ value: row.id, label: row.label })), ...extra]; |
| @@ -169,7 +173,7 @@ function HomeworkContent() { | |||
| 169 | if (!selectedCourseId()) return setError(t("exams.missingCourse")); | 173 | if (!selectedCourseId()) return setError(t("exams.missingCourse")); |
| 170 | if (!subjectId()) return setError(t("subjects.select")); | 174 | if (!subjectId()) return setError(t("subjects.select")); |
| 171 | if (due_at == null) return setError(t("homework.dueRequired")); | 175 | if (due_at == null) return setError(t("homework.dueRequired")); |
| 172 | - if (due_at < (serverTime()?.now ?? Date.now())) return setError(t("form.timePast")); | 176 | + if (due_at < (serverTime()?.now ?? Date.now())) return setError(t("homework.duePast")); |
| 173 | setPending(true); | 177 | setPending(true); |
| 174 | try { | 178 | try { |
| 175 | await postInstanceHomework(selectedCourseId(), { | 179 | await postInstanceHomework(selectedCourseId(), { |
| @@ -255,6 +259,9 @@ function HomeworkContent() { | |||
| 255 | <div class="space-y-1.5"> | 259 | <div class="space-y-1.5"> |
| 256 | <Label for="homework-subject-global">{t("subjects.subject")}</Label> | 260 | <Label for="homework-subject-global">{t("subjects.subject")}</Label> |
| 257 | <SearchableSelect id="homework-subject-global" required value={subjectId()} onChange={setSubjectId} placeholder={t("subjects.select")} options={(subjects() ?? []).map((subject) => ({ value: subject.id, label: subject.name }))} /> | 261 | <SearchableSelect id="homework-subject-global" required value={subjectId()} onChange={setSubjectId} placeholder={t("subjects.select")} options={(subjects() ?? []).map((subject) => ({ value: subject.id, label: subject.name }))} /> |
| 262 | + <Show when={selectedCourseId() && subjects.state === "ready" && (subjects() ?? []).length === 0}> | ||
| 263 | + <p class="text-xs text-text-subtle">{t("subjects.empty")}</p> | ||
| 264 | + </Show> | ||
| 258 | </div> | 265 | </div> |
| 259 | <div class="space-y-1.5"> | 266 | <div class="space-y-1.5"> |
| 260 | <Label for="homework-title-global">{t("form.title")}</Label> | 267 | <Label for="homework-title-global">{t("form.title")}</Label> |
| @@ -268,7 +275,7 @@ function HomeworkContent() { | |||
| 268 | <Label for="homework-due-global">{t("homework.dueAt")}</Label> | 275 | <Label for="homework-due-global">{t("homework.dueAt")}</Label> |
| 269 | <div class="grid grid-cols-2 gap-2"> | 276 | <div class="grid grid-cols-2 gap-2"> |
| 270 | <DatePicker id="homework-due-global" class="h-9" placeholder={t("form.datePlaceholder")} value={dueDate()} required onChange={setDueDate} /> | 277 | <DatePicker id="homework-due-global" class="h-9" placeholder={t("form.datePlaceholder")} value={dueDate()} required onChange={setDueDate} /> |
| 271 | - <Input class="h-9 rounded-md font-mono placeholder:text-text-placeholder" placeholder="17:00" value={dueTime()} required onInput={(event) => setDueTime(event.currentTarget.value)} /> | 278 | + <Input id="homework-due-time-global" class="h-9 rounded-md font-mono placeholder:text-muted-foreground/45" inputMode="numeric" maxlength={5} placeholder="17:00" aria-label={t("homework.dueTime")} value={dueTime()} required onInput={(event) => setDueTime(event.currentTarget.value)} /> |
| 272 | </div> | 279 | </div> |
| 273 | </div> | 280 | </div> |
| 274 | <p class="rounded-xl border border-border-line bg-surface-tint px-3 py-2 text-xs text-text-subtle">{t("homework.wholeCourseHelp")}</p> | 281 | <p class="rounded-xl border border-border-line bg-surface-tint px-3 py-2 text-xs text-text-subtle">{t("homework.wholeCourseHelp")}</p> |
| @@ -294,7 +301,7 @@ function HomeworkContent() { | |||
| 294 | <DataTable | 301 | <DataTable |
| 295 | urlState | 302 | urlState |
| 296 | columns={columns()} | 303 | columns={columns()} |
| 297 | - data={list()?.items ?? []} | 304 | + data={listItems()} |
| 298 | tableClass="table-fixed min-w-[44rem]" | 305 | tableClass="table-fixed min-w-[44rem]" |
| 299 | filterColumn="title" | 306 | filterColumn="title" |
| 300 | filterHint={t("search.hint.homework")} | 307 | filterHint={t("search.hint.homework")} |
| @@ -307,9 +314,9 @@ function HomeworkContent() { | |||
| 307 | onClearFilters={() => setCourseFilter("all")} | 314 | onClearFilters={() => setCourseFilter("all")} |
| 308 | filters={ | 315 | filters={ |
| 309 | <div class="flex flex-wrap items-center gap-2.5"> | 316 | <div class="flex flex-wrap items-center gap-2.5"> |
| 310 | - <label for="homework-course-filter" class="text-xs font-semibold text-muted-foreground">{t("nav.courses")}:</label> | ||
| 311 | <SearchableSelect | 317 | <SearchableSelect |
| 312 | id="homework-course-filter" | 318 | id="homework-course-filter" |
| 319 | + labelPrefix={t("nav.courses")} | ||
| 313 | class={cn(COURSE_FILTER_CLASS, courseFilter() !== "all" && "border-primary text-primary-text")} | 320 | class={cn(COURSE_FILTER_CLASS, courseFilter() !== "all" && "border-primary text-primary-text")} |
| 314 | value={courseFilter()} | 321 | value={courseFilter()} |
| 315 | onChange={(val) => setCourseFilter(val)} | 322 | onChange={(val) => setCourseFilter(val)} |
src/pages/license-modules-page.tsxmodified+7 -3
| @@ -77,7 +77,8 @@ function LicenseModulesContent() { | |||
| 77 | meta: { cellClass: "max-w-0 text-text-subtle" }, | 77 | meta: { cellClass: "max-w-0 text-text-subtle" }, |
| 78 | cell: (cell) => { | 78 | cell: (cell) => { |
| 79 | const text = cell.row.original.requires.map((name) => moduleLabel(name, t)).join(", "); | 79 | const text = cell.row.original.requires.map((name) => moduleLabel(name, t)).join(", "); |
| 80 | - return text ? <span class="block truncate" title={text}>{text}</span> : "—"; | 80 | + // Phone cards have room to wrap; the table row stays one line. |
| 81 | + return text ? <span class="block truncate max-sm:whitespace-normal" title={text}>{text}</span> : "—"; | ||
| 81 | }, | 82 | }, |
| 82 | }, | 83 | }, |
| 83 | { | 84 | { |
| @@ -96,7 +97,7 @@ function LicenseModulesContent() { | |||
| 96 | 97 | ||
| 97 | return ( | 98 | return ( |
| 98 | <div class="space-y-5"> | 99 | <div class="space-y-5"> |
| 99 | - <Suspense fallback={<DataTableSkeleton columns={2} rows={8} />}> | 100 | + <Suspense fallback={<DataTableSkeleton columns={4} rows={8} />}> |
| 100 | <Show when={data.error}> | 101 | <Show when={data.error}> |
| 101 | <ErrorAlert message={formatApiError(data.error)} onRetry={() => void refetch()} /> | 102 | <ErrorAlert message={formatApiError(data.error)} onRetry={() => void refetch()} /> |
| 102 | </Show> | 103 | </Show> |
| @@ -115,7 +116,7 @@ function LicenseModulesContent() { | |||
| 115 | <p class="text-sm text-text-subtle">{enabledPackages().join(" + ") || "—"}</p> | 116 | <p class="text-sm text-text-subtle">{enabledPackages().join(" + ") || "—"}</p> |
| 116 | </div> | 117 | </div> |
| 117 | </div> | 118 | </div> |
| 118 | - <div class="h-2 overflow-hidden rounded-full bg-surface-tint" role="progressbar" aria-valuemin={0} aria-valuemax={totalCount()} aria-valuenow={enabledCount()}> | 119 | + <div class="h-2 overflow-hidden rounded-full bg-surface-tint" role="progressbar" aria-label={t("nav.licenseModules")} aria-valuemin={0} aria-valuemax={totalCount()} aria-valuenow={enabledCount()}> |
| 119 | <div class="h-full rounded-full bg-primary" style={{ width: `${totalCount() ? (enabledCount() / totalCount()) * 100 : 0}%` }} /> | 120 | <div class="h-full rounded-full bg-primary" style={{ width: `${totalCount() ? (enabledCount() / totalCount()) * 100 : 0}%` }} /> |
| 120 | </div> | 121 | </div> |
| 121 | <div class="flex flex-wrap items-center justify-between gap-2 text-sm"> | 122 | <div class="flex flex-wrap items-center justify-between gap-2 text-sm"> |
| @@ -132,6 +133,9 @@ function LicenseModulesContent() { | |||
| 132 | data={value().rows} | 133 | data={value().rows} |
| 133 | tableClass="min-w-md" | 134 | tableClass="min-w-md" |
| 134 | enablePagination={false} | 135 | enablePagination={false} |
| 136 | + // No search or filters on 21 fixed rows: without this the | ||
| 137 | + // toolbar was a card holding only "Sütunlar". | ||
| 138 | + enableColumnVisibility={false} | ||
| 135 | storageKey="license-modules" | 139 | storageKey="license-modules" |
| 136 | /> | 140 | /> |
| 137 | </section> | 141 | </section> |
src/pages/live-monitor-page.tsxmodified+29 -31
| @@ -15,6 +15,7 @@ import { Button } from "@/components/ui/button"; | |||
| 15 | import { DataTable } from "@/components/ui/data-table"; | 15 | import { DataTable } from "@/components/ui/data-table"; |
| 16 | import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | 16 | import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; |
| 17 | import { DetailField } from "@/components/ui/detail-field"; | 17 | import { DetailField } from "@/components/ui/detail-field"; |
| 18 | +import { EmptyInline } from "@/components/ui/empty-inline"; | ||
| 18 | import { IconAlert, IconCheck, IconChevronLeft, IconClock, IconExam, IconEye, IconUsers } from "@/components/ui/icons"; | 19 | import { IconAlert, IconCheck, IconChevronLeft, IconClock, IconExam, IconEye, IconUsers } from "@/components/ui/icons"; |
| 19 | import { PageSpinner } from "@/components/ui/page-spinner"; | 20 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 20 | import { SidePanel } from "@/components/ui/side-panel"; | 21 | import { SidePanel } from "@/components/ui/side-panel"; |
| @@ -27,7 +28,6 @@ import { examStatusTone, liveDisplayStatus, type LiveDisplayStatus } from "@/lib | |||
| 27 | import { formatDateTime } from "@/lib/format"; | 28 | import { formatDateTime } from "@/lib/format"; |
| 28 | import { scheduleStatusClass, scheduleStatusDotClass } from "@/lib/schedule-status"; | 29 | import { scheduleStatusClass, scheduleStatusDotClass } from "@/lib/schedule-status"; |
| 29 | 30 | ||
| 30 | -const PAGE_SIZE = 10; | ||
| 31 | 31 | ||
| 32 | export default function LiveMonitorPage() { | 32 | export default function LiveMonitorPage() { |
| 33 | return ( | 33 | return ( |
| @@ -92,16 +92,11 @@ function liveRosterName(entry: LiveRosterEntry, fallback: string): string { | |||
| 92 | ); | 92 | ); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | -function minutesLabel(ms: number): string { | 95 | +function remainingMinutesLabel(entry: LiveRosterRow, t: ReturnType<typeof useT>): string { |
| 96 | - if (ms <= 0) return "0dk"; | ||
| 97 | - return `${Math.ceil(ms / 60000)}dk`; | ||
| 98 | -} | ||
| 99 | - | ||
| 100 | -function remainingMinutesLabel(entry: LiveRosterRow): string { | ||
| 101 | const remaining = entry.remaining_ms; | 96 | const remaining = entry.remaining_ms; |
| 102 | if (entry.displayStatus !== "not_started" && entry.displayStatus !== "in_progress") return "—"; | 97 | if (entry.displayStatus !== "not_started" && entry.displayStatus !== "in_progress") return "—"; |
| 103 | if (remaining == null) return "—"; | 98 | if (remaining == null) return "—"; |
| 104 | - return minutesLabel(remaining); | 99 | + return t("exams.minutesLeft", { minutes: remaining <= 0 ? 0 : Math.ceil(remaining / 60000) }); |
| 105 | } | 100 | } |
| 106 | 101 | ||
| 107 | function isLowRemaining(entry: LiveRosterRow): boolean { | 102 | function isLowRemaining(entry: LiveRosterRow): boolean { |
| @@ -212,7 +207,8 @@ function LiveMonitorContent() { | |||
| 212 | header: t("attempt.progress"), | 207 | header: t("attempt.progress"), |
| 213 | meta: { headerClass: "text-center", cellClass: "min-w-32 tabular-nums" }, | 208 | meta: { headerClass: "text-center", cellClass: "min-w-32 tabular-nums" }, |
| 214 | cell: (cell) => ( | 209 | cell: (cell) => ( |
| 215 | - <div class="flex items-center gap-2"> | 210 | + // Centred under its centred header, like the status and time columns. |
| 211 | + <div class="flex items-center gap-2 sm:justify-center"> | ||
| 216 | <span>{cell.row.original.answered}/{questionCount}</span> | 212 | <span>{cell.row.original.answered}/{questionCount}</span> |
| 217 | <div class="h-1.5 w-16 overflow-hidden rounded-full bg-muted"> | 213 | <div class="h-1.5 w-16 overflow-hidden rounded-full bg-muted"> |
| 218 | <div class="h-full rounded-full bg-primary" style={{ width: `${progressPercent(cell.row.original, questionCount)}%` }} /> | 214 | <div class="h-full rounded-full bg-primary" style={{ width: `${progressPercent(cell.row.original, questionCount)}%` }} /> |
| @@ -226,8 +222,8 @@ function LiveMonitorContent() { | |||
| 226 | header: t("attempt.remaining"), | 222 | header: t("attempt.remaining"), |
| 227 | meta: { headerClass: "text-center", cellClass: "tabular-nums text-center" }, | 223 | meta: { headerClass: "text-center", cellClass: "tabular-nums text-center" }, |
| 228 | cell: (cell) => ( | 224 | cell: (cell) => ( |
| 229 | - <span class={isLowRemaining(cell.row.original) ? "rounded-full bg-amber-500/10 px-2 py-1 text-amber-700 dark:text-amber-300" : ""}> | 225 | + <span class={isLowRemaining(cell.row.original) ? "rounded-full bg-warning/10 px-2 py-1 text-warning-text" : ""}> |
| 230 | - {remainingMinutesLabel(cell.row.original)} | 226 | + {remainingMinutesLabel(cell.row.original, t)} |
| 231 | </span> | 227 | </span> |
| 232 | ), | 228 | ), |
| 233 | }, | 229 | }, |
| @@ -252,9 +248,6 @@ function LiveMonitorContent() { | |||
| 252 | return ( | 248 | return ( |
| 253 | <Suspense fallback={<PageSpinner />}> | 249 | <Suspense fallback={<PageSpinner />}> |
| 254 | <div class="space-y-6"> | 250 | <div class="space-y-6"> |
| 255 | - <Show when={!snapshot() && !error()}> | ||
| 256 | - <PageSpinner /> | ||
| 257 | - </Show> | ||
| 258 | <Show when={exam()}> | 251 | <Show when={exam()}> |
| 259 | {(ex) => ( | 252 | {(ex) => ( |
| 260 | <div class="space-y-2"> | 253 | <div class="space-y-2"> |
| @@ -283,51 +276,56 @@ function LiveMonitorContent() { | |||
| 283 | 276 | ||
| 284 | {error() && <Alert variant="destructive">{error()}</Alert>} | 277 | {error() && <Alert variant="destructive">{error()}</Alert>} |
| 285 | 278 | ||
| 279 | + {/* Under the header, not above it: the header lands first and the | ||
| 280 | + spinner held the top of the page, so the title jumped down. */} | ||
| 281 | + <Show when={!snapshot() && !error()}> | ||
| 282 | + <PageSpinner /> | ||
| 283 | + </Show> | ||
| 284 | + | ||
| 286 | <Show when={snapshot()}> | 285 | <Show when={snapshot()}> |
| 287 | <> | 286 | <> |
| 288 | - <section class="grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6"> | 287 | + <section class="grid grid-cols-2 gap-3 lg:grid-cols-3 xl:grid-cols-6"> |
| 289 | - <div class="data-shell bg-card/80 p-3"> | 288 | + <div class="data-shell bg-card p-3"> |
| 290 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconClock class="h-3.5 w-3.5" />{t("exams.notStarted")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().not_started}</p> | 289 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconClock class="h-3.5 w-3.5" />{t("exams.notStarted")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().not_started}</p> |
| 291 | </div> | 290 | </div> |
| 292 | - <div class="data-shell bg-card/80 p-3"> | 291 | + <div class="data-shell bg-card p-3"> |
| 293 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconExam class="h-3.5 w-3.5 text-info-text" />{t("attempt.inProgress")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().in_progress}</p> | 292 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconExam class="h-3.5 w-3.5 text-info-text" />{t("attempt.inProgress")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().in_progress}</p> |
| 294 | </div> | 293 | </div> |
| 295 | - <div class="data-shell bg-card/80 p-3"> | 294 | + <div class="data-shell bg-card p-3"> |
| 296 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconCheck class="h-3.5 w-3.5 text-success-text" />{t("attempt.submitted")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().submitted}</p> | 295 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconCheck class="h-3.5 w-3.5 text-success-text" />{t("attempt.submitted")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().submitted}</p> |
| 297 | </div> | 296 | </div> |
| 298 | - <div class="data-shell bg-card/80 p-3"> | 297 | + <div class="data-shell bg-card p-3"> |
| 299 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconClock class="h-3.5 w-3.5 text-destructive-text" />{t("attempt.expired")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().expired}</p> | 298 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconClock class="h-3.5 w-3.5 text-destructive-text" />{t("attempt.expired")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().expired}</p> |
| 300 | </div> | 299 | </div> |
| 301 | - <div class="data-shell bg-card/80 p-3"> | 300 | + <div class="data-shell bg-card p-3"> |
| 302 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconAlert class="h-3.5 w-3.5 text-destructive-text" />{t("attempt.noAttemptsLeft")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().no_attempts_left}</p> | 301 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconAlert class="h-3.5 w-3.5 text-destructive-text" />{t("attempt.noAttemptsLeft")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().no_attempts_left}</p> |
| 303 | </div> | 302 | </div> |
| 304 | - <div class="data-shell bg-card/80 p-3"> | 303 | + <div class="data-shell bg-card p-3"> |
| 305 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconUsers class="h-3.5 w-3.5" />{t("attempt.absent")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().absent}</p> | 304 | <p class="flex items-center gap-1.5 text-xs text-muted-foreground"><IconUsers class="h-3.5 w-3.5" />{t("attempt.absent")}</p><p class="mt-1 text-2xl font-semibold tabular-nums">{counts().absent}</p> |
| 306 | </div> | 305 | </div> |
| 307 | </section> | 306 | </section> |
| 308 | 307 | ||
| 309 | <section class="space-y-4 p-0"> | 308 | <section class="space-y-4 p-0"> |
| 310 | - <div class="flex flex-wrap items-center justify-between gap-3"> | 309 | + <h2 class="text-lg font-semibold">{t("exams.liveRoster")}</h2> |
| 311 | - <div> | ||
| 312 | - <h2 class="text-lg font-semibold">{t("exams.liveRoster")}</h2> | ||
| 313 | - <p class="mt-1 text-sm text-muted-foreground">{t("attempt.progress")}</p> | ||
| 314 | - </div> | ||
| 315 | - </div> | ||
| 316 | <Show | 310 | <Show |
| 317 | when={liveRows().length > 0} | 311 | when={liveRows().length > 0} |
| 318 | fallback={ | 312 | fallback={ |
| 319 | - <p class="rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-8 text-center text-sm text-muted-foreground"> | 313 | + <EmptyInline |
| 320 | - {t("exams.emptyRoster")} | 314 | + size="md" |
| 321 | - </p> | 315 | + class="data-shell" |
| 316 | + illustration="empty" | ||
| 317 | + title={t("exams.emptyRoster")} | ||
| 318 | + /> | ||
| 322 | } | 319 | } |
| 323 | > | 320 | > |
| 324 | <DataTable | 321 | <DataTable |
| 325 | columns={columns()} | 322 | columns={columns()} |
| 326 | data={liveRows()} | 323 | data={liveRows()} |
| 327 | filterColumn="student" | 324 | filterColumn="student" |
| 325 | + filterPlaceholder={t("exams.liveSearch")} | ||
| 326 | + filterHint={t("search.hint.liveRoster")} | ||
| 328 | storageKey="live-exam-roster" | 327 | storageKey="live-exam-roster" |
| 329 | enablePagination | 328 | enablePagination |
| 330 | - pageSize={PAGE_SIZE} | ||
| 331 | onRowClick={(row) => setSelectedUserId(row.user.id)} | 329 | onRowClick={(row) => setSelectedUserId(row.user.id)} |
| 332 | /> | 330 | /> |
| 333 | </Show> | 331 | </Show> |
src/pages/login-page.tsxmodified+7 -7
| @@ -119,7 +119,7 @@ function LoginForm() { | |||
| 119 | <Label for="login-username">{t("auth.username")}</Label> | 119 | <Label for="login-username">{t("auth.username")}</Label> |
| 120 | <Input | 120 | <Input |
| 121 | id="login-username" | 121 | id="login-username" |
| 122 | - class="h-9" | 122 | + class="h-10 sm:h-9 touch:h-10" |
| 123 | autocomplete="username" | 123 | autocomplete="username" |
| 124 | minlength={limits()?.user.min_username_len} | 124 | minlength={limits()?.user.min_username_len} |
| 125 | maxlength={limits()?.user.max_username_len} | 125 | maxlength={limits()?.user.max_username_len} |
| @@ -134,7 +134,7 @@ function LoginForm() { | |||
| 134 | <div class="relative"> | 134 | <div class="relative"> |
| 135 | <Input | 135 | <Input |
| 136 | id="login-password" | 136 | id="login-password" |
| 137 | - class="h-9 pr-10" | 137 | + class="h-10 pr-10 sm:h-9 touch:h-10" |
| 138 | type={showPassword() ? "text" : "password"} | 138 | type={showPassword() ? "text" : "password"} |
| 139 | autocomplete="current-password" | 139 | autocomplete="current-password" |
| 140 | minlength={limits()?.user.min_password_len} | 140 | minlength={limits()?.user.min_password_len} |
| @@ -146,7 +146,7 @@ function LoginForm() { | |||
| 146 | <button | 146 | <button |
| 147 | type="button" | 147 | type="button" |
| 148 | onClick={() => setShowPassword(!showPassword())} | 148 | onClick={() => setShowPassword(!showPassword())} |
| 149 | - class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground" | 149 | + class="absolute right-0.5 top-1/2 inline-flex h-9 w-9 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors outline-hidden hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring" |
| 150 | aria-label={showPassword() ? t("auth.hidePassword") : t("auth.showPassword")} | 150 | aria-label={showPassword() ? t("auth.hidePassword") : t("auth.showPassword")} |
| 151 | > | 151 | > |
| 152 | <Show when={showPassword()} fallback={<IconEye class="h-4 w-4" />}> | 152 | <Show when={showPassword()} fallback={<IconEye class="h-4 w-4" />}> |
| @@ -157,10 +157,10 @@ function LoginForm() { | |||
| 157 | </div> | 157 | </div> |
| 158 | 158 | ||
| 159 | {error() && ( | 159 | {error() && ( |
| 160 | - <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> | 160 | + <p role="alert" class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> |
| 161 | )} | 161 | )} |
| 162 | 162 | ||
| 163 | - <Button type="submit" class="h-9 w-full text-sm" disabled={pending()}> | 163 | + <Button type="submit" class="h-10 w-full text-sm sm:h-9 touch:h-10" disabled={pending()}> |
| 164 | {pending() ? t("common.loading") : t("auth.login")} | 164 | {pending() ? t("common.loading") : t("auth.login")} |
| 165 | </Button> | 165 | </Button> |
| 166 | <Show when={demo}> | 166 | <Show when={demo}> |
| @@ -168,7 +168,7 @@ function LoginForm() { | |||
| 168 | <Button | 168 | <Button |
| 169 | type="submit" | 169 | type="submit" |
| 170 | variant="outline" | 170 | variant="outline" |
| 171 | - class="h-9 w-full text-sm" | 171 | + class="h-10 w-full text-sm sm:h-9 touch:h-10" |
| 172 | disabled={pending()} | 172 | disabled={pending()} |
| 173 | onClick={() => { | 173 | onClick={() => { |
| 174 | setUsername(account().username); | 174 | setUsername(account().username); |
| @@ -220,7 +220,7 @@ function LoginForm() { | |||
| 220 | </For> | 220 | </For> |
| 221 | 221 | ||
| 222 | {error() && ( | 222 | {error() && ( |
| 223 | - <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> | 223 | + <p role="alert" class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> |
| 224 | )} | 224 | )} |
| 225 | 225 | ||
| 226 | <Button | 226 | <Button |
src/pages/marks-page.tsxmodified+4 -2
| @@ -52,7 +52,7 @@ function MarksContent() { | |||
| 52 | <div class="space-y-5"> | 52 | <div class="space-y-5"> |
| 53 | <PageHeader | 53 | <PageHeader |
| 54 | title={t("marks.title")} | 54 | title={t("marks.title")} |
| 55 | - description={tab() === "marks" ? t("marks.subtitle") : t("attendance.subtitle")} | 55 | + description={tab() === "marks" ? t("marks.subtitle") : tab() === "karne" ? t("karne.subtitle") : t("attendance.subtitle")} |
| 56 | /> | 56 | /> |
| 57 | 57 | ||
| 58 | <Tabs | 58 | <Tabs |
| @@ -106,7 +106,9 @@ function MarksContent() { | |||
| 106 | <TabsContent value="attendance" class="mt-0 border-0 bg-transparent p-0 shadow-none"> | 106 | <TabsContent value="attendance" class="mt-0 border-0 bg-transparent p-0 shadow-none"> |
| 107 | <Suspense fallback={<PageSpinner />}> | 107 | <Suspense fallback={<PageSpinner />}> |
| 108 | <Show when={!attendance.error} fallback={<Alert variant="destructive">{formatApiError(attendance.error)}</Alert>}> | 108 | <Show when={!attendance.error} fallback={<Alert variant="destructive">{formatApiError(attendance.error)}</Alert>}> |
| 109 | - <Show when={attendance()}>{(report) => <AttendanceReportView report={report()} />}</Show> | 109 | + <Show when={attendance()} fallback={<EmptyState kind="exams" title={t("attendance.emptyCourses")} />}> |
| 110 | + {(report) => <AttendanceReportView report={report()} />} | ||
| 111 | + </Show> | ||
| 110 | </Show> | 112 | </Show> |
| 111 | </Suspense> | 113 | </Suspense> |
| 112 | </TabsContent> | 114 | </TabsContent> |
src/pages/messages-page.tsxmodified+49 -15
| @@ -3,13 +3,13 @@ import { | |||
| 3 | Show, | 3 | Show, |
| 4 | createMemo, | 4 | createMemo, |
| 5 | createSignal, | 5 | createSignal, |
| 6 | - Suspense, | ||
| 7 | useTransition, | 6 | useTransition, |
| 8 | } from "solid-js"; | 7 | } from "solid-js"; |
| 9 | import { createResource } from "@/lib/create-resource"; | 8 | import { createResource } from "@/lib/create-resource"; |
| 10 | import { RouteGuard } from "@/components/layout/route-guard"; | 9 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 11 | import { InfiniteSentinel } from "@/components/ui/infinite-sentinel"; | 10 | import { InfiniteSentinel } from "@/components/ui/infinite-sentinel"; |
| 12 | import { createInfiniteList } from "@/lib/infinite-list"; | 11 | import { createInfiniteList } from "@/lib/infinite-list"; |
| 12 | +import { createScrollRestore } from "@/lib/scroll-restore"; | ||
| 13 | import { Button } from "@/components/ui/button"; | 13 | import { Button } from "@/components/ui/button"; |
| 14 | import { | 14 | import { |
| 15 | IconArchive, | 15 | IconArchive, |
| @@ -38,6 +38,9 @@ import { useT } from "@/stores/preferences-context"; | |||
| 38 | import { createDebouncedSignal } from "@/lib/create-debounced-signal"; | 38 | import { createDebouncedSignal } from "@/lib/create-debounced-signal"; |
| 39 | import { createFlash } from "@/lib/flash"; | 39 | import { createFlash } from "@/lib/flash"; |
| 40 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 40 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 41 | +import { EmptyState } from "@/components/ui/empty-state"; | ||
| 42 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 43 | +import { PageSpinner } from "@/components/ui/page-spinner"; | ||
| 41 | 44 | ||
| 42 | const folders: { id: MessageFolder; labelKey: MessageKey; icon: typeof IconMessage }[] = [ | 45 | const folders: { id: MessageFolder; labelKey: MessageKey; icon: typeof IconMessage }[] = [ |
| 43 | { id: "inbox", labelKey: "messages.inbox", icon: IconMessage }, | 46 | { id: "inbox", labelKey: "messages.inbox", icon: IconMessage }, |
| @@ -80,6 +83,8 @@ export default function MessagesPage() { | |||
| 80 | ); | 83 | ); |
| 81 | 84 | ||
| 82 | const selected = createMemo(() => messages().find((m) => m.id === selectedId()) ?? null); | 85 | const selected = createMemo(() => messages().find((m) => m.id === selectedId()) ?? null); |
| 86 | + // Back to this page lands on the same message row once the list is drawn. | ||
| 87 | + createScrollRestore("messages", () => messages().length > 0); | ||
| 83 | const isOwnSentMessage = (msg: Message) => msg.sender.id === auth.user()?.id; | 88 | const isOwnSentMessage = (msg: Message) => msg.sender.id === auth.user()?.id; |
| 84 | 89 | ||
| 85 | const restoreFolder = (msg: Message): MessageFolder => { | 90 | const restoreFolder = (msg: Message): MessageFolder => { |
| @@ -109,10 +114,17 @@ export default function MessagesPage() { | |||
| 109 | } | 114 | } |
| 110 | }; | 115 | }; |
| 111 | 116 | ||
| 117 | + // Deleting forever cannot be undone, so it waits for a confirmation. | ||
| 118 | + const [pendingDelete, setPendingDelete] = createSignal<Message | null>(null); | ||
| 119 | + | ||
| 112 | const handleAction = async ( | 120 | const handleAction = async ( |
| 113 | msg: Message, | 121 | msg: Message, |
| 114 | - action: { folder?: MessageFolder; delete?: boolean; read?: boolean } | 122 | + action: { folder?: MessageFolder; delete?: boolean; read?: boolean; confirmed?: boolean } |
| 115 | ) => { | 123 | ) => { |
| 124 | + if (action.delete && !action.confirmed && msg.folder === "trash") { | ||
| 125 | + setPendingDelete(msg); | ||
| 126 | + return; | ||
| 127 | + } | ||
| 116 | try { | 128 | try { |
| 117 | if (action.delete) { | 129 | if (action.delete) { |
| 118 | if (msg.folder !== "trash") { | 130 | if (msg.folder !== "trash") { |
| @@ -257,7 +269,7 @@ export default function MessagesPage() { | |||
| 257 | > | 269 | > |
| 258 | <IconRefresh | 270 | <IconRefresh |
| 259 | class={cn( | 271 | class={cn( |
| 260 | - "h-3.5 w-3.5 mr-1.5 transition-transform duration-500", | 272 | + "h-3.5 w-3.5 transition-transform duration-500", |
| 261 | isRefreshing() && "animate-spin text-primary-text" | 273 | isRefreshing() && "animate-spin text-primary-text" |
| 262 | )} | 274 | )} |
| 263 | /> | 275 | /> |
| @@ -280,7 +292,7 @@ export default function MessagesPage() { | |||
| 280 | class={cn(TOOLBAR_CONTROL, "px-3.5 text-destructive-text hover:bg-destructive/10")} | 292 | class={cn(TOOLBAR_CONTROL, "px-3.5 text-destructive-text hover:bg-destructive/10")} |
| 281 | onClick={() => setConfirmEmptyTrash(true)} | 293 | onClick={() => setConfirmEmptyTrash(true)} |
| 282 | > | 294 | > |
| 283 | - <IconTrash class="mr-1.5 h-3.5 w-3.5" /> | 295 | + <IconTrash class="h-3.5 w-3.5" /> |
| 284 | {t("messages.emptyTrash")} | 296 | {t("messages.emptyTrash")} |
| 285 | </Button> | 297 | </Button> |
| 286 | </Show> | 298 | </Show> |
| @@ -302,19 +314,26 @@ export default function MessagesPage() { | |||
| 302 | isPending() && "opacity-50 pointer-events-none" | 314 | isPending() && "opacity-50 pointer-events-none" |
| 303 | )} | 315 | )} |
| 304 | > | 316 | > |
| 305 | - <Suspense | 317 | + <Show when={messageList.error()}> |
| 306 | - fallback={ | 318 | + {(err) => ( |
| 307 | - <div class="p-6 text-center text-xs text-muted-foreground"> | 319 | + <div class="p-4"> |
| 308 | - {t("common.loading")} | 320 | + <ErrorAlert message={formatApiError(err())} onRetry={() => messageList.reload()} /> |
| 309 | </div> | 321 | </div> |
| 310 | - } | 322 | + )} |
| 311 | - > | 323 | + </Show> |
| 324 | + {/* The list does not suspend: it says it is loading until the | ||
| 325 | + first page lands instead of flashing "no messages". */} | ||
| 326 | + <Show when={!messageList.initialLoading()} fallback={<PageSpinner />}> | ||
| 312 | <Show | 327 | <Show |
| 313 | when={messages().length > 0} | 328 | when={messages().length > 0} |
| 314 | fallback={ | 329 | fallback={ |
| 315 | - <div class="p-12 text-center text-xs text-muted-foreground"> | 330 | + <Show when={!messageList.error()}> |
| 316 | - {query().trim() ? t("common.noResults") : t("messages.noMessages")} | 331 | + <EmptyState |
| 317 | - </div> | 332 | + kind={query().trim() ? "search" : "messages"} |
| 333 | + title={query().trim() ? t("common.noResults") : t("messages.noMessages")} | ||
| 334 | + class="rounded-none border-0 bg-transparent" | ||
| 335 | + /> | ||
| 336 | + </Show> | ||
| 318 | } | 337 | } |
| 319 | > | 338 | > |
| 320 | <For each={messages()}> | 339 | <For each={messages()}> |
| @@ -349,9 +368,9 @@ export default function MessagesPage() { | |||
| 349 | )} | 368 | )} |
| 350 | </For> | 369 | </For> |
| 351 | </Show> | 370 | </Show> |
| 352 | - </Suspense> | 371 | + </Show> |
| 353 | 372 | ||
| 354 | - <div class="border-t border-border-hairline px-4 py-3"> | 373 | + <div class={cn("border-t border-border-hairline px-4 py-3", messageList.total() === 0 && "hidden")}> |
| 355 | <InfiniteSentinel | 374 | <InfiniteSentinel |
| 356 | hasMore={messageList.hasMore()} | 375 | hasMore={messageList.hasMore()} |
| 357 | loading={messageList.loading()} | 376 | loading={messageList.loading()} |
| @@ -397,6 +416,21 @@ export default function MessagesPage() { | |||
| 397 | }} | 416 | }} |
| 398 | /> | 417 | /> |
| 399 | </div> | 418 | </div> |
| 419 | + <ConfirmDialog | ||
| 420 | + open={pendingDelete() !== null} | ||
| 421 | + onOpenChange={(open) => { | ||
| 422 | + if (!open) setPendingDelete(null); | ||
| 423 | + }} | ||
| 424 | + title={t("messages.deleteForever")} | ||
| 425 | + variant="destructive" | ||
| 426 | + summary={pendingDelete()?.subject ?? ""} | ||
| 427 | + description={t("confirm.irreversible")} | ||
| 428 | + confirmLabel={t("messages.deleteForever")} | ||
| 429 | + onConfirm={async () => { | ||
| 430 | + const msg = pendingDelete(); | ||
| 431 | + if (msg) await handleAction(msg, { delete: true, confirmed: true }); | ||
| 432 | + }} | ||
| 433 | + /> | ||
| 400 | <ConfirmDialog | 434 | <ConfirmDialog |
| 401 | open={confirmEmptyTrash()} | 435 | open={confirmEmptyTrash()} |
| 402 | onOpenChange={setConfirmEmptyTrash} | 436 | onOpenChange={setConfirmEmptyTrash} |
src/pages/my-students-page.tsxmodified+26 -13
| @@ -77,7 +77,10 @@ function MyStudentsContent() { | |||
| 77 | <div class="space-y-6"> | 77 | <div class="space-y-6"> |
| 78 | <DataSection title={t("nav.children")} description={t("parents.subtitle")}> | 78 | <DataSection title={t("nav.children")} description={t("parents.subtitle")}> |
| 79 | <Suspense fallback={<PageSpinner />}> | 79 | <Suspense fallback={<PageSpinner />}> |
| 80 | - <Show when={list()}> | 80 | + <Show when={list.error}> |
| 81 | + <ErrorAlert message={formatApiError(list.error)} /> | ||
| 82 | + </Show> | ||
| 83 | + <Show when={!list.error && list()}> | ||
| 81 | <Show when={list()!.length > 0} fallback={<EmptyState kind="people" title={t("common.noResults")} />}> | 84 | <Show when={list()!.length > 0} fallback={<EmptyState kind="people" title={t("common.noResults")} />}> |
| 82 | <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"> | 85 | <div class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3"> |
| 83 | <For each={list()}> | 86 | <For each={list()}> |
| @@ -124,7 +127,8 @@ function StudentDetailPanel(props: { student: PersonRef | null; initialTab: Stud | |||
| 124 | 127 | ||
| 125 | const [classesRes] = createResource( | 128 | const [classesRes] = createResource( |
| 126 | () => props.student?.id, | 129 | () => props.student?.id, |
| 127 | - async (id) => (await getClassesByUserId(id, { limit: 1 })).items, | 130 | + // A refusal only drops the class line; it is not an error to show. |
| 131 | + async (id) => (await getClassesByUserId(id, { limit: 1 }).catch(() => ({ items: [] }))).items, | ||
| 128 | ); | 132 | ); |
| 129 | const studentClass = () => classesRes()?.[0] ?? null; | 133 | const studentClass = () => classesRes()?.[0] ?? null; |
| 130 | 134 | ||
| @@ -148,7 +152,8 @@ function StudentDetailPanel(props: { student: PersonRef | null; initialTab: Stud | |||
| 148 | if (props.student?.id) setActiveTab(props.initialTab); | 152 | if (props.student?.id) setActiveTab(props.initialTab); |
| 149 | }); | 153 | }); |
| 150 | 154 | ||
| 151 | - const report = () => marksRes() ?? null; | 155 | + // An errored resource throws when read, so every read checks `.error` first. |
| 156 | + const report = () => (marksRes.error ? null : marksRes() ?? null); | ||
| 152 | const courseRows = createMemo<CourseRow[]>(() => report()?.courses ?? []); | 157 | const courseRows = createMemo<CourseRow[]>(() => report()?.courses ?? []); |
| 153 | const examRows = createMemo<ExamRow[]>(() => | 158 | const examRows = createMemo<ExamRow[]>(() => |
| 154 | courseRows().flatMap((course) => | 159 | courseRows().flatMap((course) => |
| @@ -201,9 +206,11 @@ function StudentDetailPanel(props: { student: PersonRef | null; initialTab: Stud | |||
| 201 | ]); | 206 | ]); |
| 202 | 207 | ||
| 203 | return ( | 208 | return ( |
| 204 | - <SidePanel open={!!props.student} onOpenChange={(open) => !open && props.onClose()} title={props.student ? personLabel(props.student) : ""} description={`@${props.student?.username}`}> | 209 | + <SidePanel open={!!props.student} onOpenChange={(open) => !open && props.onClose()} title={props.student ? personLabel(props.student) : ""} description={props.student ? `@${props.student.username}` : undefined} bodyClass="overflow-hidden p-0"> |
| 210 | + {/* The panel body drops its own padding and scroll: the action and tab | ||
| 211 | + rows stay pinned and only the tab content below them scrolls. */} | ||
| 205 | <div class="flex h-full flex-col"> | 212 | <div class="flex h-full flex-col"> |
| 206 | - <div class="border-b border-border-hairline p-4"> | 213 | + <div class="shrink-0 border-b border-border-hairline px-5 py-4"> |
| 207 | <div class={cn("mb-3 flex flex-wrap items-center justify-between gap-2", PANEL_CONTROLS)}> | 214 | <div class={cn("mb-3 flex flex-wrap items-center justify-between gap-2", PANEL_CONTROLS)}> |
| 208 | {/* A parent may read their linked students' profiles, so this is safe | 215 | {/* A parent may read their linked students' profiles, so this is safe |
| 209 | — it 403s only for someone else's child. Close the panel before | 216 | — it 403s only for someone else's child. Close the panel before |
| @@ -246,7 +253,7 @@ function StudentDetailPanel(props: { student: PersonRef | null; initialTab: Stud | |||
| 246 | {(tab) => { | 253 | {(tab) => { |
| 247 | const Icon = tab.icon; | 254 | const Icon = tab.icon; |
| 248 | return ( | 255 | return ( |
| 249 | - <Button variant={activeTab() === tab.key ? "default" : "outline"} size="sm" onClick={() => setActiveTab(tab.key)}> | 256 | + <Button variant={activeTab() === tab.key ? "default" : "outline"} size="sm" aria-pressed={activeTab() === tab.key} onClick={() => setActiveTab(tab.key)}> |
| 250 | <Icon class="mr-2 h-4 w-4" /> | 257 | <Icon class="mr-2 h-4 w-4" /> |
| 251 | {tab.label} | 258 | {tab.label} |
| 252 | </Button> | 259 | </Button> |
| @@ -256,12 +263,14 @@ function StudentDetailPanel(props: { student: PersonRef | null; initialTab: Stud | |||
| 256 | </div> | 263 | </div> |
| 257 | </div> | 264 | </div> |
| 258 | 265 | ||
| 259 | - <div class="flex-1 overflow-auto p-4"> | 266 | + <div class="min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 py-4"> |
| 260 | <Suspense fallback={<PageSpinner />}> | 267 | <Suspense fallback={<PageSpinner />}> |
| 261 | <Switch> | 268 | <Switch> |
| 262 | <Match when={activeTab() === "exams"}> | 269 | <Match when={activeTab() === "exams"}> |
| 263 | - <Show when={examRows().length > 0} fallback={<DataTableEmpty>{t("exams.noResults")}</DataTableEmpty>}> | 270 | + <Show when={!marksRes.error} fallback={<ErrorAlert message={formatApiError(marksRes.error)} />}> |
| 264 | - <DataTable class="min-w-0" columns={examColumns()} data={examRows()} tableClass="w-full min-w-176 text-sm" enableSorting={false} /> | 271 | + <Show when={examRows().length > 0} fallback={<DataTableEmpty>{t("exams.noResults")}</DataTableEmpty>}> |
| 272 | + <DataTable class="min-w-0" columns={examColumns()} data={examRows()} tableClass="w-full min-w-176 text-sm" enableSorting={false} /> | ||
| 273 | + </Show> | ||
| 265 | </Show> | 274 | </Show> |
| 266 | </Match> | 275 | </Match> |
| 267 | 276 | ||
| @@ -272,8 +281,10 @@ function StudentDetailPanel(props: { student: PersonRef | null; initialTab: Stud | |||
| 272 | </Match> | 281 | </Match> |
| 273 | 282 | ||
| 274 | <Match when={activeTab() === "marks"}> | 283 | <Match when={activeTab() === "marks"}> |
| 275 | - <Show when={marksRes()} fallback={<PageSpinner />}> | 284 | + <Show when={!marksRes.error} fallback={<ErrorAlert message={formatApiError(marksRes.error)} />}> |
| 276 | - <MarksReportView report={marksRes()!} /> | 285 | + <Show when={marksRes()} fallback={<PageSpinner />}> |
| 286 | + {(marks) => <MarksReportView report={marks()} />} | ||
| 287 | + </Show> | ||
| 277 | </Show> | 288 | </Show> |
| 278 | </Match> | 289 | </Match> |
| 279 | 290 | ||
| @@ -287,8 +298,10 @@ function StudentDetailPanel(props: { student: PersonRef | null; initialTab: Stud | |||
| 287 | </Match> | 298 | </Match> |
| 288 | 299 | ||
| 289 | <Match when={activeTab() === "attendance"}> | 300 | <Match when={activeTab() === "attendance"}> |
| 290 | - <Show when={attendanceRes()} fallback={<PageSpinner />}> | 301 | + <Show when={!attendanceRes.error} fallback={<ErrorAlert message={formatApiError(attendanceRes.error)} />}> |
| 291 | - <AttendanceReportView report={attendanceRes()!} /> | 302 | + <Show when={attendanceRes()} fallback={<PageSpinner />}> |
| 303 | + {(attendance) => <AttendanceReportView report={attendance()} />} | ||
| 304 | + </Show> | ||
| 292 | </Show> | 305 | </Show> |
| 293 | </Match> | 306 | </Match> |
| 294 | </Switch> | 307 | </Switch> |
src/pages/notes-page.tsxmodified+26 -36
| @@ -1,6 +1,6 @@ | |||
| 1 | -import { Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js"; | 1 | +import { Show, createEffect, createSignal } from "solid-js"; |
| 2 | -import { createResponsivePageSize } from "@/lib/create-page-size"; | 2 | +import { createInfiniteList } from "@/lib/infinite-list"; |
| 3 | -import { createResource } from "@/lib/create-resource"; | 3 | +import { createScrollRestore } from "@/lib/scroll-restore"; |
| 4 | import { useLocation, useNavigate } from "@tanstack/solid-router"; | 4 | import { useLocation, useNavigate } from "@tanstack/solid-router"; |
| 5 | import { deleteNoteById } from "@/api/notes"; | 5 | import { deleteNoteById } from "@/api/notes"; |
| 6 | import { getNotes } from "@/api/notes"; | 6 | import { getNotes } from "@/api/notes"; |
| @@ -8,6 +8,8 @@ import { patchNoteById } from "@/api/notes"; | |||
| 8 | import { postNote } from "@/api/notes"; | 8 | import { postNote } from "@/api/notes"; |
| 9 | import { formatApiError } from "@/api/client"; | 9 | import { formatApiError } from "@/api/client"; |
| 10 | import { Alert } from "@/components/ui/alert"; | 10 | import { Alert } from "@/components/ui/alert"; |
| 11 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 12 | +import { InfiniteSentinel } from "@/components/ui/infinite-sentinel"; | ||
| 11 | import { RouteGuard } from "@/components/layout/route-guard"; | 13 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 12 | import { NoteImportPanel } from "@/components/notes/note-import-panel"; | 14 | import { NoteImportPanel } from "@/components/notes/note-import-panel"; |
| 13 | import { NoteList } from "@/components/notes/note-list"; | 15 | import { NoteList } from "@/components/notes/note-list"; |
| @@ -15,16 +17,12 @@ import { Button } from "@/components/ui/button"; | |||
| 15 | import { TOOLBAR_CARD, TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | 17 | import { TOOLBAR_CARD, TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; |
| 16 | import { IconPlus, IconUploadCloud } from "@/components/ui/icons"; | 18 | import { IconPlus, IconUploadCloud } from "@/components/ui/icons"; |
| 17 | import { PageSpinner } from "@/components/ui/page-spinner"; | 19 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 18 | -import { TablePagination } from "@/components/ui/table-pagination"; | ||
| 19 | import { SidePanel } from "@/components/ui/side-panel"; | 20 | import { SidePanel } from "@/components/ui/side-panel"; |
| 20 | import { cn } from "@/lib/cn"; | 21 | import { cn } from "@/lib/cn"; |
| 21 | import { createFlash } from "@/lib/flash"; | 22 | import { createFlash } from "@/lib/flash"; |
| 22 | -import { loadListPage, totalPages as pagesOf } from "@/lib/list-page"; | ||
| 23 | import { personalNoteFiles } from "@/lib/note-source"; | 23 | import { personalNoteFiles } from "@/lib/note-source"; |
| 24 | import { useT } from "@/stores/preferences-context"; | 24 | import { useT } from "@/stores/preferences-context"; |
| 25 | 25 | ||
| 26 | -const NOTE_PAGE_SIZE = 10; | ||
| 27 | - | ||
| 28 | export default function NotesPage() { | 26 | export default function NotesPage() { |
| 29 | return ( | 27 | return ( |
| 30 | <RouteGuard> | 28 | <RouteGuard> |
| @@ -45,25 +43,13 @@ function NotesContent() { | |||
| 45 | if (location().searchStr.includes("action=new")) void navigate({ to: "/notes/new", replace: true }); | 43 | if (location().searchStr.includes("action=new")) void navigate({ to: "/notes/new", replace: true }); |
| 46 | if (location().searchStr.includes("action=import")) setImportOpen(true); | 44 | if (location().searchStr.includes("action=import")) setImportOpen(true); |
| 47 | }); | 45 | }); |
| 48 | - const [page, setPage] = createSignal(0); | 46 | + // Notes load a page at a time as the reader scrolls, like every other |
| 49 | - const pageSize = createResponsivePageSize(NOTE_PAGE_SIZE); | 47 | + // server list; edits and deletes re-read the loaded rows in place. |
| 50 | - createEffect(on(pageSize, () => setPage(0), { defer: true })); | 48 | + const list = createInfiniteList(() => "notes", (_key, paging) => getNotes(paging), { restoreKey: "notes" }); |
| 51 | - | 49 | + const refetch = () => list.refresh(); |
| 52 | - const [list, { refetch }] = createResource( | 50 | + const pageItems = () => list.items(); |
| 53 | - () => ({ page: page(), size: pageSize() }), | 51 | + // Back from a note lands on the same card once the grid is drawn. |
| 54 | - async (source) => | 52 | + createScrollRestore("notes", () => pageItems().length > 0); |
| 55 | - loadListPage({ | ||
| 56 | - page: source.page, | ||
| 57 | - pageSize: source.size, | ||
| 58 | - clientMode: false, | ||
| 59 | - fetch: getNotes, | ||
| 60 | - }), | ||
| 61 | - ); | ||
| 62 | - | ||
| 63 | - const total = () => list()?.total ?? 0; | ||
| 64 | - const pageItems = () => list()?.items ?? []; | ||
| 65 | - const totalPages = createMemo(() => pagesOf(total(), pageSize())); | ||
| 66 | - const safePage = createMemo(() => Math.min(page(), totalPages() - 1)); | ||
| 67 | 53 | ||
| 68 | const wrap = async (fn: () => Promise<void>, okMessage: string) => { | 54 | const wrap = async (fn: () => Promise<void>, okMessage: string) => { |
| 69 | setError(""); | 55 | setError(""); |
| @@ -87,7 +73,7 @@ function NotesContent() { | |||
| 87 | title: importedTitle, | 73 | title: importedTitle, |
| 88 | content: importedMarkdown || undefined, | 74 | content: importedMarkdown || undefined, |
| 89 | }); | 75 | }); |
| 90 | - await refetch(); | 76 | + list.reload(); |
| 91 | setImportOpen(false); | 77 | setImportOpen(false); |
| 92 | setFlash(t("common.created")); | 78 | setFlash(t("common.created")); |
| 93 | }} | 79 | }} |
| @@ -112,11 +98,11 @@ function NotesContent() { | |||
| 112 | <Show when={error() && !importOpen()}> | 98 | <Show when={error() && !importOpen()}> |
| 113 | <Alert variant="destructive">{error()}</Alert> | 99 | <Alert variant="destructive">{error()}</Alert> |
| 114 | </Show> | 100 | </Show> |
| 115 | - <Suspense fallback={<PageSpinner />}> | 101 | + <Show when={list.error()}> |
| 116 | - <Show when={list.error}> | 102 | + {(err) => <ErrorAlert message={formatApiError(err())} onRetry={() => list.reload()} />} |
| 117 | - <Alert variant="destructive">{formatApiError(list.error)}</Alert> | 103 | + </Show> |
| 118 | - </Show> | 104 | + <Show when={!list.initialLoading()} fallback={<PageSpinner />}> |
| 119 | - <Show when={list()}> | 105 | + <Show when={!list.error() || pageItems().length > 0}> |
| 120 | <NoteList | 106 | <NoteList |
| 121 | notes={pageItems()} | 107 | notes={pageItems()} |
| 122 | source={personalNoteFiles} | 108 | source={personalNoteFiles} |
| @@ -134,11 +120,15 @@ function NotesContent() { | |||
| 134 | }, t("common.deleted")) | 120 | }, t("common.deleted")) |
| 135 | } | 121 | } |
| 136 | /> | 122 | /> |
| 137 | - <Show when={total() > pageSize()}> | 123 | + <InfiniteSentinel |
| 138 | - <TablePagination pageIndex={safePage()} pageCount={totalPages()} onPageChange={setPage} /> | 124 | + hasMore={list.hasMore()} |
| 139 | - </Show> | 125 | + loading={list.loading()} |
| 126 | + onLoadMore={list.loadMore} | ||
| 127 | + shown={pageItems().length} | ||
| 128 | + total={list.total()} | ||
| 129 | + /> | ||
| 140 | </Show> | 130 | </Show> |
| 141 | - </Suspense> | 131 | + </Show> |
| 142 | </div> | 132 | </div> |
| 143 | </div> | 133 | </div> |
| 144 | </div> | 134 | </div> |
src/pages/payment-statement-page.tsxmodified+5 -1
| @@ -124,6 +124,9 @@ function StatementContent() { | |||
| 124 | </div> | 124 | </div> |
| 125 | </Show> | 125 | </Show> |
| 126 | 126 | ||
| 127 | + {/* Only once the statement is in: zeros while it loads (or after it | ||
| 128 | + failed) would read as a real balance. */} | ||
| 129 | + <Show when={statement() && !statement.error}> | ||
| 127 | <section class="data-shell p-4"> | 130 | <section class="data-shell p-4"> |
| 128 | <div class="flex flex-wrap items-baseline justify-between gap-2"> | 131 | <div class="flex flex-wrap items-baseline justify-between gap-2"> |
| 129 | <p class="text-sm font-medium text-text-subtle">{t("payments.collected")}</p> | 132 | <p class="text-sm font-medium text-text-subtle">{t("payments.collected")}</p> |
| @@ -132,7 +135,7 @@ function StatementContent() { | |||
| 132 | <span class="font-normal text-text-subtle"> / {formatTry(summary().billed, moneyLocale())}</span> | 135 | <span class="font-normal text-text-subtle"> / {formatTry(summary().billed, moneyLocale())}</span> |
| 133 | </p> | 136 | </p> |
| 134 | </div> | 137 | </div> |
| 135 | - <div class="mt-3 h-2 overflow-hidden rounded-full bg-surface-tint"> | 138 | + <div class="mt-3 h-2 overflow-hidden rounded-full bg-surface-tint" role="progressbar" aria-label={t("payments.collected")} aria-valuemin={0} aria-valuemax={summary().billed} aria-valuenow={summary().collected}> |
| 136 | <div | 139 | <div |
| 137 | class="h-full rounded-full bg-primary" | 140 | class="h-full rounded-full bg-primary" |
| 138 | style={{ width: `${summary().billed > 0 ? Math.max(0, Math.min(100, Math.round((summary().collected / summary().billed) * 100))) : 0}%` }} | 141 | style={{ width: `${summary().billed > 0 ? Math.max(0, Math.min(100, Math.round((summary().collected / summary().billed) * 100))) : 0}%` }} |
| @@ -149,6 +152,7 @@ function StatementContent() { | |||
| 149 | </div> | 152 | </div> |
| 150 | </div> | 153 | </div> |
| 151 | </section> | 154 | </section> |
| 155 | + </Show> | ||
| 152 | 156 | ||
| 153 | <section class="space-y-4 p-0"> | 157 | <section class="space-y-4 p-0"> |
| 154 | <Suspense fallback={<DataTableSkeleton columns={5} rows={6} />}> | 158 | <Suspense fallback={<DataTableSkeleton columns={5} rows={6} />}> |
src/pages/payments-page.tsxmodified+5 -3
| @@ -29,6 +29,8 @@ import { Badge } from "@/components/ui/badge"; | |||
| 29 | import { Button } from "@/components/ui/button"; | 29 | import { Button } from "@/components/ui/button"; |
| 30 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 30 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 31 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 31 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 32 | +import { TOOLBAR_CONTROL } from "@/components/ui/data-toolbar"; | ||
| 33 | +import { cn } from "@/lib/cn"; | ||
| 32 | import { DatePicker } from "@/components/ui/date-picker"; | 34 | import { DatePicker } from "@/components/ui/date-picker"; |
| 33 | import { DetailField } from "@/components/ui/detail-field"; | 35 | import { DetailField } from "@/components/ui/detail-field"; |
| 34 | import { EmptyState } from "@/components/ui/empty-state"; | 36 | import { EmptyState } from "@/components/ui/empty-state"; |
| @@ -659,7 +661,7 @@ function PaymentsContent() { | |||
| 659 | <h2 class="text-lg font-semibold">{personLabel(current())}</h2> | 661 | <h2 class="text-lg font-semibold">{personLabel(current())}</h2> |
| 660 | <p class="text-sm text-muted-foreground">@{current().username}</p> | 662 | <p class="text-sm text-muted-foreground">@{current().username}</p> |
| 661 | </div> | 663 | </div> |
| 662 | - <Button variant="outline" size="sm" class="h-10 rounded-full px-3.5 text-[13px] sm:h-8 touch:h-10" onClick={() => navigate({ to: "/management/payments" })}> | 664 | + <Button variant="outline" size="sm" class={cn(TOOLBAR_CONTROL, "px-3.5")} onClick={() => navigate({ to: "/management/payments" })}> |
| 663 | <IconChevronLeft class="h-4 w-4" />{t("payments.allStudents")} | 665 | <IconChevronLeft class="h-4 w-4" />{t("payments.allStudents")} |
| 664 | </Button> | 666 | </Button> |
| 665 | </div> | 667 | </div> |
| @@ -681,7 +683,7 @@ function PaymentsContent() { | |||
| 681 | <div class="space-y-3"> | 683 | <div class="space-y-3"> |
| 682 | <EmptyState kind="payments" title={t("payments.noDebt")} description={t("payments.noDebtHint")} /> | 684 | <EmptyState kind="payments" title={t("payments.noDebt")} description={t("payments.noDebtHint")} /> |
| 683 | <div class="flex justify-center"> | 685 | <div class="flex justify-center"> |
| 684 | - <Button variant="outline" size="sm" class="rounded-lg" onClick={() => setTab("plans")}>{t("payments.tabPlans")}</Button> | 686 | + <Button variant="outline" size="sm" class={cn(TOOLBAR_CONTROL, "px-3.5")} onClick={() => setTab("plans")}>{t("payments.tabPlans")}</Button> |
| 685 | </div> | 687 | </div> |
| 686 | </div> | 688 | </div> |
| 687 | } | 689 | } |
| @@ -719,7 +721,7 @@ function PaymentsContent() { | |||
| 719 | 721 | ||
| 720 | {/* advanced corrections, folded away */} | 722 | {/* advanced corrections, folded away */} |
| 721 | <div> | 723 | <div> |
| 722 | - <Button variant="ghost" size="sm" onClick={() => setShowLedger(!showLedger())}>{showLedger() ? t("payments.hideLedger") : t("payments.showLedger")}</Button> | 724 | + <Button variant="ghost" size="sm" class={cn(TOOLBAR_CONTROL, "px-3.5")} aria-expanded={showLedger()} onClick={() => setShowLedger(!showLedger())}>{showLedger() ? t("payments.hideLedger") : t("payments.showLedger")}</Button> |
| 723 | <Show when={showLedger()}> | 725 | <Show when={showLedger()}> |
| 724 | <section class="data-shell mt-3 space-y-1 p-4"> | 726 | <section class="data-shell mt-3 space-y-1 p-4"> |
| 725 | <div class="mb-2"> | 727 | <div class="mb-2"> |
src/pages/pomodoro-page.tsxmodified+25 -7
| @@ -1,5 +1,6 @@ | |||
| 1 | -import { For, Show, Suspense, createEffect, createMemo, createSignal } from "solid-js"; | 1 | +import { For, Show, createEffect, createMemo, createSignal } from "solid-js"; |
| 2 | import { createResource } from "@/lib/create-resource"; | 2 | import { createResource } from "@/lib/create-resource"; |
| 3 | +import { createInfiniteList } from "@/lib/infinite-list"; | ||
| 3 | import type { ColumnDef } from "@tanstack/solid-table"; | 4 | import type { ColumnDef } from "@tanstack/solid-table"; |
| 4 | import { getPomodoroMe } from "@/api/pomodoro"; | 5 | import { getPomodoroMe } from "@/api/pomodoro"; |
| 5 | import { getLimits } from "@/api/limits"; | 6 | import { getLimits } from "@/api/limits"; |
| @@ -12,6 +13,7 @@ import { Alert } from "@/components/ui/alert"; | |||
| 12 | import { Badge } from "@/components/ui/badge"; | 13 | import { Badge } from "@/components/ui/badge"; |
| 13 | import { Button } from "@/components/ui/button"; | 14 | import { Button } from "@/components/ui/button"; |
| 14 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 15 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 16 | +import { ErrorAlert } from "@/components/ui/error-alert"; | ||
| 15 | import { IconCheck, IconClock } from "@/components/ui/icons"; | 17 | import { IconCheck, IconClock } from "@/components/ui/icons"; |
| 16 | import { Input } from "@/components/ui/input"; | 18 | import { Input } from "@/components/ui/input"; |
| 17 | import { Label } from "@/components/ui/label"; | 19 | import { Label } from "@/components/ui/label"; |
| @@ -51,7 +53,10 @@ function PomodoroContent() { | |||
| 51 | const [pending, setPending] = createSignal(false); | 53 | const [pending, setPending] = createSignal(false); |
| 52 | const [flash, setFlash] = createFlash(); | 54 | const [flash, setFlash] = createFlash(); |
| 53 | const now = createNow(1000); | 55 | const now = createNow(1000); |
| 56 | + // The newest sessions feed the clock and the stat cards; the history table | ||
| 57 | + // below pages through the whole log as the reader scrolls. | ||
| 54 | const [log, { refetch }] = createResource(() => getPomodoroMe({ limit: 20 })); | 58 | const [log, { refetch }] = createResource(() => getPomodoroMe({ limit: 20 })); |
| 59 | + const history = createInfiniteList(() => "pomodoro", (_key, paging) => getPomodoroMe(paging)); | ||
| 55 | const [limits] = createResource(() => getLimits().catch(() => null)); | 60 | const [limits] = createResource(() => getLimits().catch(() => null)); |
| 56 | const [focusLabel, setFocusLabel] = createSignal(""); | 61 | const [focusLabel, setFocusLabel] = createSignal(""); |
| 57 | const running = createMemo(() => log()?.items.find((item) => item.finished_at == null) ?? null); | 62 | const running = createMemo(() => log()?.items.find((item) => item.finished_at == null) ?? null); |
| @@ -155,6 +160,7 @@ function PomodoroContent() { | |||
| 155 | try { | 160 | try { |
| 156 | await action(); | 161 | await action(); |
| 157 | await refetch(); | 162 | await refetch(); |
| 163 | + history.reload(); | ||
| 158 | setFlash(ok); | 164 | setFlash(ok); |
| 159 | if (action === postPomodoroFinish) { | 165 | if (action === postPomodoroFinish) { |
| 160 | triggerConfetti(); | 166 | triggerConfetti(); |
| @@ -188,9 +194,12 @@ function PomodoroContent() { | |||
| 188 | <Alert variant="success">{flash()}</Alert> | 194 | <Alert variant="success">{flash()}</Alert> |
| 189 | </Show> | 195 | </Show> |
| 190 | {error() && <Alert variant="destructive">{error()}</Alert>} | 196 | {error() && <Alert variant="destructive">{error()}</Alert>} |
| 197 | + <Show when={log.error}> | ||
| 198 | + <ErrorAlert message={formatApiError(log.error)} onRetry={() => void refetch()} /> | ||
| 199 | + </Show> | ||
| 191 | 200 | ||
| 192 | <section class="grid gap-4 xl:grid-cols-[minmax(0,1.45fr)_minmax(18rem,0.55fr)]"> | 201 | <section class="grid gap-4 xl:grid-cols-[minmax(0,1.45fr)_minmax(18rem,0.55fr)]"> |
| 193 | - <div class="overflow-hidden rounded-lg border border-border bg-card shadow-xs"> | 202 | + <div class="overflow-hidden rounded-xl border border-border-line bg-card shadow-xs"> |
| 194 | <div class="flex flex-wrap items-center justify-between gap-3 border-b border-border/70 px-5 py-4"> | 203 | <div class="flex flex-wrap items-center justify-between gap-3 border-b border-border/70 px-5 py-4"> |
| 195 | <div class="flex min-w-0 items-center gap-3"> | 204 | <div class="flex min-w-0 items-center gap-3"> |
| 196 | <span class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border bg-muted/40 text-muted-foreground"> | 205 | <span class="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border bg-muted/40 text-muted-foreground"> |
| @@ -282,7 +291,7 @@ function PomodoroContent() { | |||
| 282 | type="button" | 291 | type="button" |
| 283 | size="sm" | 292 | size="sm" |
| 284 | variant={targetMinutes() === minutes ? "default" : "outline"} | 293 | variant={targetMinutes() === minutes ? "default" : "outline"} |
| 285 | - class="h-7 min-w-11 rounded-lg px-2 text-xs" | 294 | + class="h-10 min-w-11 rounded-full px-3 text-[13px] sm:h-8 touch:h-10" |
| 286 | disabled={!!running()} | 295 | disabled={!!running()} |
| 287 | onClick={() => setTargetMinutes(minutes)} | 296 | onClick={() => setTargetMinutes(minutes)} |
| 288 | > | 297 | > |
| @@ -296,8 +305,9 @@ function PomodoroContent() { | |||
| 296 | max={MAX_MINUTES} | 305 | max={MAX_MINUTES} |
| 297 | value={targetMinutes()} | 306 | value={targetMinutes()} |
| 298 | disabled={!!running()} | 307 | disabled={!!running()} |
| 299 | - class="h-7 w-16 rounded-lg px-2 text-xs" | 308 | + class="h-10 w-16 rounded-full px-3 text-[13px] sm:h-8 touch:h-10" |
| 300 | title={t("pomodoro.customMinutes")} | 309 | title={t("pomodoro.customMinutes")} |
| 310 | + aria-label={t("pomodoro.customMinutes")} | ||
| 301 | onInput={(event) => { | 311 | onInput={(event) => { |
| 302 | const value = Number(event.currentTarget.value); | 312 | const value = Number(event.currentTarget.value); |
| 303 | if (Number.isFinite(value) && value > 0 && value <= MAX_MINUTES) setTargetMinutes(value); | 313 | if (Number.isFinite(value) && value > 0 && value <= MAX_MINUTES) setTargetMinutes(value); |
| @@ -335,9 +345,17 @@ function PomodoroContent() { | |||
| 335 | </p> | 345 | </p> |
| 336 | </div> | 346 | </div> |
| 337 | </div> | 347 | </div> |
| 338 | - <Suspense fallback={<DataTableSkeleton />}> | 348 | + <Show when={history.error()}> |
| 339 | - <DataTable columns={columns()} data={log()?.items ?? []} empty={t("pomodoro.empty")} enablePagination pageSize={10} urlState /> | 349 | + {(err) => <ErrorAlert message={formatApiError(err())} onRetry={() => history.reload()} />} |
| 340 | - </Suspense> | 350 | + </Show> |
| 351 | + <Show when={!history.initialLoading()} fallback={<DataTableSkeleton />}> | ||
| 352 | + <DataTable | ||
| 353 | + columns={columns()} | ||
| 354 | + data={history.items()} | ||
| 355 | + empty={t("pomodoro.empty")} | ||
| 356 | + infinite={{ hasMore: history.hasMore(), loading: history.loading(), total: history.total(), onLoadMore: history.loadMore }} | ||
| 357 | + /> | ||
| 358 | + </Show> | ||
| 341 | </section> | 359 | </section> |
| 342 | </div> | 360 | </div> |
| 343 | ); | 361 | ); |
src/pages/profile-page.tsxmodified+3 -1
| @@ -10,6 +10,8 @@ import { RouteGuard } from "@/components/layout/route-guard"; | |||
| 10 | import { RoleBadge } from "@/components/layout/role-badge"; | 10 | import { RoleBadge } from "@/components/layout/role-badge"; |
| 11 | import { Badge } from "@/components/ui/badge"; | 11 | import { Badge } from "@/components/ui/badge"; |
| 12 | import { Button } from "@/components/ui/button"; | 12 | import { Button } from "@/components/ui/button"; |
| 13 | +import { TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | ||
| 14 | +import { cn } from "@/lib/cn"; | ||
| 13 | import { DetailField } from "@/components/ui/detail-field"; | 15 | import { DetailField } from "@/components/ui/detail-field"; |
| 14 | import { ErrorAlert } from "@/components/ui/error-alert"; | 16 | import { ErrorAlert } from "@/components/ui/error-alert"; |
| 15 | import { IconEdit, IconSchool, IconUserCircle } from "@/components/ui/icons"; | 17 | import { IconEdit, IconSchool, IconUserCircle } from "@/components/ui/icons"; |
| @@ -203,7 +205,7 @@ function ProfileContent() { | |||
| 203 | </div> | 205 | </div> |
| 204 | </div> | 206 | </div> |
| 205 | {/* Header actions are toolbar pills: h-10 below `sm` and on touch, h-8 above. */} | 207 | {/* Header actions are toolbar pills: h-10 below `sm` and on touch, h-8 above. */} |
| 206 | - <div class="mt-3 flex flex-wrap gap-2 [&_button]:h-10 [&_button]:rounded-full [&_button]:px-3.5 [&_button]:text-[13px] sm:[&_button]:h-8 touch:[&_button]:h-10"> | 208 | + <div class={cn("mt-3 flex flex-wrap gap-2", TOOLBAR_SLOT)}> |
| 207 | <Show when={infoSource(p())}> | 209 | <Show when={infoSource(p())}> |
| 208 | <Button type="button" size="sm" variant="outline" onClick={() => setInfoOpen(true)}> | 210 | <Button type="button" size="sm" variant="outline" onClick={() => setInfoOpen(true)}> |
| 209 | <IconUserCircle class="mr-1.5 h-4 w-4" /> | 211 | <IconUserCircle class="mr-1.5 h-4 w-4" /> |
src/pages/question-bank-page.tsxmodified+2 -0
| @@ -244,6 +244,8 @@ function QuestionBankContent() { | |||
| 244 | onSearchInput={setQuery} | 244 | onSearchInput={setQuery} |
| 245 | infinite={{ hasMore: list.hasMore(), loading: list.loading(), total: total(), onLoadMore: list.loadMore }} | 245 | infinite={{ hasMore: list.hasMore(), loading: list.loading(), total: total(), onLoadMore: list.loadMore }} |
| 246 | empty={t("bank.empty")} | 246 | empty={t("bank.empty")} |
| 247 | + filtersActive={subjectFilter() !== "all"} | ||
| 248 | + onClearFilters={() => setSubjectFilter("all")} | ||
| 247 | storageKey="question-bank" | 249 | storageKey="question-bank" |
| 248 | onRowClick={(question) => navigate({ to: "/question-bank/$id", params: { id: question.id } })} | 250 | onRowClick={(question) => navigate({ to: "/question-bank/$id", params: { id: question.id } })} |
| 249 | filters={ | 251 | filters={ |
src/pages/question-detail-page.tsxmodified+7 -7
| @@ -10,6 +10,8 @@ import { formatApiError } from "@/api/client"; | |||
| 10 | import { RouteGuard } from "@/components/layout/route-guard"; | 10 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 11 | import { PageSpinner } from "@/components/ui/page-spinner"; | 11 | import { PageSpinner } from "@/components/ui/page-spinner"; |
| 12 | import { Button } from "@/components/ui/button"; | 12 | import { Button } from "@/components/ui/button"; |
| 13 | +import { TOOLBAR_CONTROL, TOOLBAR_SLOT } from "@/components/ui/data-toolbar"; | ||
| 14 | +import { cn } from "@/lib/cn"; | ||
| 13 | import { FormDialog } from "@/components/ui/form-dialog"; | 15 | import { FormDialog } from "@/components/ui/form-dialog"; |
| 14 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 16 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 15 | import { Label } from "@/components/ui/label"; | 17 | import { Label } from "@/components/ui/label"; |
| @@ -29,11 +31,9 @@ import { formatBytes, maxUploadBytes } from "@/lib/upload-limits"; | |||
| 29 | // Lazy so the drawing pad rides its own chunk, off the question detail's initial load. | 31 | // Lazy so the drawing pad rides its own chunk, off the question detail's initial load. |
| 30 | const DrawCanvas = lazy(() => import("@/components/ui/draw-canvas").then((m) => ({ default: m.DrawCanvas }))); | 32 | const DrawCanvas = lazy(() => import("@/components/ui/draw-canvas").then((m) => ({ default: m.DrawCanvas }))); |
| 31 | 33 | ||
| 32 | -// Approve and the actions menu share one row: the toolbar pill, touch-sized | 34 | +// Approve and the actions menu share one row of toolbar pills. The menu |
| 33 | -// (h-10) below `sm` and on touch screens, h-8 above. The menu trigger is a | 35 | +// trigger is a <button> too, so the slot rule sizes both. |
| 34 | -// <button> too, so one rule sizes both. | 36 | +const HEADER_CONTROLS = cn("flex flex-wrap items-center gap-2", TOOLBAR_SLOT); |
| 35 | -const HEADER_CONTROLS = | ||
| 36 | - "flex flex-wrap items-center gap-2 [&_button]:h-10 [&_button]:rounded-full [&_button]:px-3.5 [&_button]:text-[13px] sm:[&_button]:h-8 touch:[&_button]:h-10"; | ||
| 37 | 37 | ||
| 38 | export default function QuestionDetailPage() { | 38 | export default function QuestionDetailPage() { |
| 39 | return ( | 39 | return ( |
| @@ -216,8 +216,8 @@ function QuestionDetailContent() { | |||
| 216 | <div class="mt-8"> | 216 | <div class="mt-8"> |
| 217 | <div class="flex items-center justify-between mb-4"> | 217 | <div class="flex items-center justify-between mb-4"> |
| 218 | <h2 class="text-xl font-semibold ">{t("pool.solutions")}</h2> | 218 | <h2 class="text-xl font-semibold ">{t("pool.solutions")}</h2> |
| 219 | - <Button variant="outline" onClick={() => setOfferOpen(true)}> | 219 | + <Button variant="outline" size="sm" class={cn(TOOLBAR_CONTROL, "px-3.5")} onClick={() => setOfferOpen(true)}> |
| 220 | - <IconMessage class="mr-2 h-4 w-4" /> | 220 | + <IconMessage class="h-4 w-4" /> |
| 221 | {t("pool.offerSolution")} | 221 | {t("pool.offerSolution")} |
| 222 | </Button> | 222 | </Button> |
| 223 | </div> | 223 | </div> |
src/pages/question-generation-page.tsxmodified+22 -10
| @@ -63,8 +63,11 @@ function QuestionGenerationContent() { | |||
| 63 | const [result, setResult] = createSignal<RagQuestionSet | null>(null); | 63 | const [result, setResult] = createSignal<RagQuestionSet | null>(null); |
| 64 | const [draft, setDraft] = createSignal<Draft | null>(null); | 64 | const [draft, setDraft] = createSignal<Draft | null>(null); |
| 65 | 65 | ||
| 66 | - const scope = () => scopes()?.find((option) => option.key === scopeKey()) ?? null; | 66 | + // A failed scope read is a load error, not "you teach nothing". |
| 67 | - const courses = createMemo(() => [...new Map((scopes() ?? []).map((option) => [option.course.id, option.course])).values()]); | 67 | + const scopeList = () => (scopes.error ? [] : scopes() ?? []); |
| 68 | + const noScopes = () => !scopes.loading && !scopes.error && scopeList().length === 0; | ||
| 69 | + const scope = () => scopeList().find((option) => option.key === scopeKey()) ?? null; | ||
| 70 | + const courses = createMemo(() => [...new Map(scopeList().map((option) => [option.course.id, option.course])).values()]); | ||
| 68 | const canBank = () => modules.isEnabled("bank_questions"); | 71 | const canBank = () => modules.isEnabled("bank_questions"); |
| 69 | const difficultyLabel = (value: Difficulty) => | 72 | const difficultyLabel = (value: Difficulty) => |
| 70 | value === "kolay" ? rag().difficultyEasy : value === "zor" ? rag().difficultyHard : rag().difficultyMedium; | 73 | value === "kolay" ? rag().difficultyEasy : value === "zor" ? rag().difficultyHard : rag().difficultyMedium; |
| @@ -112,12 +115,21 @@ function QuestionGenerationContent() { | |||
| 112 | <Alert variant="success">{flash()}</Alert> | 115 | <Alert variant="success">{flash()}</Alert> |
| 113 | </Show> | 116 | </Show> |
| 114 | 117 | ||
| 118 | + <Show when={scopes.error}> | ||
| 119 | + {(err) => <Alert variant="destructive">{formatApiError(err())}</Alert>} | ||
| 120 | + </Show> | ||
| 121 | + | ||
| 122 | + {/* Someone who teaches no course gets one plain notice, not a form | ||
| 123 | + column beside a results pane asking them to pick a course. */} | ||
| 124 | + <Show when={noScopes()}> | ||
| 125 | + <section class="data-shell p-4 sm:p-5"> | ||
| 126 | + <EmptyInline class="py-10" size="md" illustration="exams" title={t("qgen.noScopes")} /> | ||
| 127 | + </section> | ||
| 128 | + </Show> | ||
| 129 | + | ||
| 130 | + <Show when={!noScopes() && !scopes.error}> | ||
| 115 | <div class="grid grid-cols-1 items-start gap-5 lg:grid-cols-[22rem_minmax(0,1fr)]"> | 131 | <div class="grid grid-cols-1 items-start gap-5 lg:grid-cols-[22rem_minmax(0,1fr)]"> |
| 116 | <form class="data-shell space-y-4 p-4 sm:p-5" onSubmit={(event) => void generate(event)}> | 132 | <form class="data-shell space-y-4 p-4 sm:p-5" onSubmit={(event) => void generate(event)}> |
| 117 | - <Show | ||
| 118 | - when={scopes.loading || (scopes()?.length ?? 0) > 0} | ||
| 119 | - fallback={<p class="text-sm leading-6 text-muted-foreground">{t("qgen.noScopes")}</p>} | ||
| 120 | - > | ||
| 121 | <div class="space-y-1.5"> | 133 | <div class="space-y-1.5"> |
| 122 | <Label for="qgen-scope">{t("qgen.scope")}</Label> | 134 | <Label for="qgen-scope">{t("qgen.scope")}</Label> |
| 123 | <SearchableSelect | 135 | <SearchableSelect |
| @@ -126,7 +138,7 @@ function QuestionGenerationContent() { | |||
| 126 | onChange={setScopeKey} | 138 | onChange={setScopeKey} |
| 127 | placeholder={t("qgen.scopePlaceholder")} | 139 | placeholder={t("qgen.scopePlaceholder")} |
| 128 | disabled={scopes.loading} | 140 | disabled={scopes.loading} |
| 129 | - options={(scopes() ?? []).map((option) => ({ value: option.key, label: option.label }))} | 141 | + options={scopeList().map((option) => ({ value: option.key, label: option.label }))} |
| 130 | /> | 142 | /> |
| 131 | </div> | 143 | </div> |
| 132 | 144 | ||
| @@ -159,7 +171,7 @@ function QuestionGenerationContent() { | |||
| 159 | role="radio" | 171 | role="radio" |
| 160 | aria-checked={difficulty() === value} | 172 | aria-checked={difficulty() === value} |
| 161 | class={cn( | 173 | class={cn( |
| 162 | - "h-8 flex-1 rounded-md px-2 text-xs font-medium transition-colors", | 174 | + "h-8 flex-1 rounded-md px-2 text-xs font-medium transition-colors touch:h-10", |
| 163 | difficulty() === value ? "bg-primary text-primary-foreground shadow-2xs" : "text-muted-foreground hover:text-foreground", | 175 | difficulty() === value ? "bg-primary text-primary-foreground shadow-2xs" : "text-muted-foreground hover:text-foreground", |
| 164 | )} | 176 | )} |
| 165 | onClick={() => setDifficulty(value)} | 177 | onClick={() => setDifficulty(value)} |
| @@ -182,11 +194,10 @@ function QuestionGenerationContent() { | |||
| 182 | <p class="text-xs text-muted-foreground">{t("qgen.seedHint")}</p> | 194 | <p class="text-xs text-muted-foreground">{t("qgen.seedHint")}</p> |
| 183 | </div> | 195 | </div> |
| 184 | 196 | ||
| 185 | - <Button type="submit" size="sm" class="w-full rounded-lg" disabled={!scope() || !pagesInput().trim() || pending()}> | 197 | + <Button type="submit" size="sm" class="w-full rounded-lg touch:h-10" disabled={!scope() || !pagesInput().trim() || pending()}> |
| 186 | <IconSparkles class="h-4 w-4" /> | 198 | <IconSparkles class="h-4 w-4" /> |
| 187 | {pending() ? t("qgen.generating") : t("qgen.generate")} | 199 | {pending() ? t("qgen.generating") : t("qgen.generate")} |
| 188 | </Button> | 200 | </Button> |
| 189 | - </Show> | ||
| 190 | </form> | 201 | </form> |
| 191 | 202 | ||
| 192 | <section class="data-shell min-h-[20rem] space-y-4 p-4 sm:p-5" aria-label={t("qgen.results")} aria-live="polite"> | 203 | <section class="data-shell min-h-[20rem] space-y-4 p-4 sm:p-5" aria-label={t("qgen.results")} aria-live="polite"> |
| @@ -234,6 +245,7 @@ function QuestionGenerationContent() { | |||
| 234 | </Switch> | 245 | </Switch> |
| 235 | </section> | 246 | </section> |
| 236 | </div> | 247 | </div> |
| 248 | + </Show> | ||
| 237 | 249 | ||
| 238 | <SidePanel | 250 | <SidePanel |
| 239 | guardUnsaved | 251 | guardUnsaved |
src/pages/questions-page.tsxmodified+31 -12
| @@ -1,4 +1,5 @@ | |||
| 1 | import { For, Show, Suspense, createEffect, createSignal, lazy } from "solid-js"; | 1 | import { For, Show, Suspense, createEffect, createSignal, lazy } from "solid-js"; |
| 2 | +import { createScrollRestore } from "@/lib/scroll-restore"; | ||
| 2 | import { createResource } from "@/lib/create-resource"; | 3 | import { createResource } from "@/lib/create-resource"; |
| 3 | import { createInfiniteList } from "@/lib/infinite-list"; | 4 | import { createInfiniteList } from "@/lib/infinite-list"; |
| 4 | import { InfiniteSentinel } from "@/components/ui/infinite-sentinel"; | 5 | import { InfiniteSentinel } from "@/components/ui/infinite-sentinel"; |
| @@ -22,7 +23,9 @@ import { hasMinRole } from "@/lib/roles"; | |||
| 22 | 23 | ||
| 23 | import { ErrorAlert } from "@/components/ui/error-alert"; | 24 | import { ErrorAlert } from "@/components/ui/error-alert"; |
| 24 | import { showToast } from "@/components/ui/toast"; | 25 | import { showToast } from "@/components/ui/toast"; |
| 25 | -import { useT } from "@/stores/preferences-context"; | 26 | +import { usePreferences, useT } from "@/stores/preferences-context"; |
| 27 | +import { formatDate } from "@/lib/format"; | ||
| 28 | +import { Alert } from "@/components/ui/alert"; | ||
| 26 | import { useAuth } from "@/stores/auth-context"; | 29 | import { useAuth } from "@/stores/auth-context"; |
| 27 | import { cn } from "@/lib/cn"; | 30 | import { cn } from "@/lib/cn"; |
| 28 | import { formatBytes, maxUploadBytes } from "@/lib/upload-limits"; | 31 | import { formatBytes, maxUploadBytes } from "@/lib/upload-limits"; |
| @@ -40,6 +43,7 @@ export default function QuestionsPage() { | |||
| 40 | 43 | ||
| 41 | function QuestionsContent() { | 44 | function QuestionsContent() { |
| 42 | const t = useT(); | 45 | const t = useT(); |
| 46 | + const { locale } = usePreferences(); | ||
| 43 | const auth = useAuth(); | 47 | const auth = useAuth(); |
| 44 | const navigate = useNavigate(); | 48 | const navigate = useNavigate(); |
| 45 | const location = useLocation(); | 49 | const location = useLocation(); |
| @@ -55,6 +59,8 @@ function QuestionsContent() { | |||
| 55 | { restoreKey: "questions" }, | 59 | { restoreKey: "questions" }, |
| 56 | ); | 60 | ); |
| 57 | const list = () => questions.items(); | 61 | const list = () => questions.items(); |
| 62 | + // Back from a question lands on the same row once the list is drawn. | ||
| 63 | + createScrollRestore(`questions:${statusFilter()}`, () => list().length > 0); | ||
| 58 | const refetch = () => questions.refresh(); | 64 | const refetch = () => questions.refresh(); |
| 59 | 65 | ||
| 60 | const [askOpen, setAskOpen] = createSignal(location().searchStr.includes("action=new")); | 66 | const [askOpen, setAskOpen] = createSignal(location().searchStr.includes("action=new")); |
| @@ -66,6 +72,14 @@ function QuestionsContent() { | |||
| 66 | } | 72 | } |
| 67 | }); | 73 | }); |
| 68 | 74 | ||
| 75 | + const poolTabClass = (active: boolean) => | ||
| 76 | + cn( | ||
| 77 | + "inline-flex h-10 shrink-0 items-center justify-center whitespace-nowrap border-b-2 border-r border-r-border-line px-3 text-sm font-medium transition-colors last:border-r-0 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring", | ||
| 78 | + active | ||
| 79 | + ? "border-b-primary bg-surface-base text-foreground" | ||
| 80 | + : "border-b-transparent text-muted-foreground hover:bg-muted/50 hover:text-foreground", | ||
| 81 | + ); | ||
| 82 | + | ||
| 69 | const canDelete = (question: any) => | 83 | const canDelete = (question: any) => |
| 70 | question.asker.id === auth.user()?.id || hasMinRole(auth.user()?.role, "teacher"); | 84 | question.asker.id === auth.user()?.id || hasMinRole(auth.user()?.role, "teacher"); |
| 71 | 85 | ||
| @@ -85,22 +99,26 @@ function QuestionsContent() { | |||
| 85 | 99 | ||
| 86 | return ( | 100 | return ( |
| 87 | <div class="space-y-6"> | 101 | <div class="space-y-6"> |
| 88 | - <div class="inline-flex max-w-full items-center gap-1 rounded-xl border border-border/70 bg-card/80 p-1 shadow-xs"> | 102 | + {/* Links, since the status lives in the URL, drawn like the app's Tabs |
| 103 | + (TabsList / TabsTrigger) so this row matches every other tab row. */} | ||
| 104 | + <nav aria-label={t("pool.title")} class="inline-flex h-auto w-full max-w-full items-stretch overflow-x-auto rounded-lg border border-border-line bg-surface-base sm:w-fit"> | ||
| 89 | <Link | 105 | <Link |
| 90 | to="/questions" | 106 | to="/questions" |
| 91 | search={{ status: "approved" }} | 107 | search={{ status: "approved" }} |
| 92 | - class={cn("group inline-flex h-8 shrink-0 items-center justify-center whitespace-nowrap rounded-lg border px-3 text-sm font-medium transition-colors", statusFilter() === "approved" ? "border-border bg-surface-base text-foreground shadow-xs" : "border-transparent text-muted-foreground hover:bg-muted/70 hover:text-foreground")} | 108 | + aria-current={statusFilter() === "approved" ? "page" : undefined} |
| 109 | + class={poolTabClass(statusFilter() === "approved")} | ||
| 93 | > | 110 | > |
| 94 | {t("pool.approved")} | 111 | {t("pool.approved")} |
| 95 | </Link> | 112 | </Link> |
| 96 | <Link | 113 | <Link |
| 97 | to="/questions" | 114 | to="/questions" |
| 98 | search={{ status: "pending" }} | 115 | search={{ status: "pending" }} |
| 99 | - class={cn("group inline-flex h-8 shrink-0 items-center justify-center whitespace-nowrap rounded-lg border px-3 text-sm font-medium transition-colors", statusFilter() === "pending" ? "border-border bg-surface-base text-foreground shadow-xs" : "border-transparent text-muted-foreground hover:bg-muted/70 hover:text-foreground")} | 116 | + aria-current={statusFilter() === "pending" ? "page" : undefined} |
| 117 | + class={poolTabClass(statusFilter() === "pending")} | ||
| 100 | > | 118 | > |
| 101 | {t("pool.pending")} | 119 | {t("pool.pending")} |
| 102 | </Link> | 120 | </Link> |
| 103 | - </div> | 121 | + </nav> |
| 104 | 122 | ||
| 105 | <DataSection | 123 | <DataSection |
| 106 | title={t("pool.title")} | 124 | title={t("pool.title")} |
| @@ -116,7 +134,7 @@ function QuestionsContent() { | |||
| 116 | > | 134 | > |
| 117 | <div class="-mx-4 -mb-4 border-t border-border-hairline"> | 135 | <div class="-mx-4 -mb-4 border-t border-border-hairline"> |
| 118 | <Show when={questions.error()}> | 136 | <Show when={questions.error()}> |
| 119 | - {(err) => <p class="p-4 text-sm text-destructive-text">{formatApiError(err())}</p>} | 137 | + {(err) => <Alert variant="destructive" class="m-4">{formatApiError(err())}</Alert>} |
| 120 | </Show> | 138 | </Show> |
| 121 | <Show when={!questions.initialLoading()} fallback={<PageSpinner />}> | 139 | <Show when={!questions.initialLoading()} fallback={<PageSpinner />}> |
| 122 | <Show when={list().length > 0} fallback={<EmptyState kind="search" title={t("pool.noQuestions")} />}> | 140 | <Show when={list().length > 0} fallback={<EmptyState kind="search" title={t("pool.noQuestions")} />}> |
| @@ -128,7 +146,7 @@ function QuestionsContent() { | |||
| 128 | <div class="flex items-center gap-2"> | 146 | <div class="flex items-center gap-2"> |
| 129 | <h3 class="truncate text-base font-semibold text-foreground group-hover:text-primary-text transition-colors">{question.title}</h3> | 147 | <h3 class="truncate text-base font-semibold text-foreground group-hover:text-primary-text transition-colors">{question.title}</h3> |
| 130 | <Show when={question.image}> | 148 | <Show when={question.image}> |
| 131 | - <IconPhoto class="h-4 w-4 text-muted-foreground" /> | 149 | + <IconPhoto class="h-4 w-4 shrink-0 text-muted-foreground" aria-label={t("pool.image")} /> |
| 132 | </Show> | 150 | </Show> |
| 133 | </div> | 151 | </div> |
| 134 | <p class="mt-1 line-clamp-2 text-sm text-muted-foreground">{question.body}</p> | 152 | <p class="mt-1 line-clamp-2 text-sm text-muted-foreground">{question.body}</p> |
| @@ -140,16 +158,16 @@ function QuestionsContent() { | |||
| 140 | {personLabel(question.asker)} | 158 | {personLabel(question.asker)} |
| 141 | </span> | 159 | </span> |
| 142 | <span>•</span> | 160 | <span>•</span> |
| 143 | - <span>{new Date(question.asked_at).toLocaleDateString()}</span> | 161 | + <span>{formatDate(question.asked_at, locale())}</span> |
| 144 | </div> | 162 | </div> |
| 145 | </Link> | 163 | </Link> |
| 146 | 164 | ||
| 147 | <div class="mt-2 flex items-center gap-3 sm:mt-0 sm:pl-4 shrink-0"> | 165 | <div class="mt-2 flex items-center gap-3 sm:mt-0 sm:pl-4 shrink-0"> |
| 148 | <Show | 166 | <Show |
| 149 | when={question.status === "approved"} | 167 | when={question.status === "approved"} |
| 150 | - fallback={<span class="inline-flex items-center rounded-full bg-amber-500/10 px-2.5 py-0.5 text-xs font-medium text-amber-600 dark:text-amber-400"><IconClock class="mr-1 h-3 w-3" /> {t("pool.pending")}</span>} | 168 | + fallback={<span class="inline-flex items-center rounded-full bg-warning/10 px-2.5 py-0.5 text-xs font-medium text-warning-text"><IconClock class="mr-1 h-3 w-3" /> {t("pool.pending")}</span>} |
| 151 | > | 169 | > |
| 152 | - <span class="inline-flex items-center rounded-full bg-emerald-500/10 px-2.5 py-0.5 text-xs font-medium text-emerald-600 dark:text-emerald-400"><IconCheck class="mr-1 h-3 w-3" /> {t("pool.approved")}</span> | 170 | + <span class="inline-flex items-center rounded-full bg-success/10 px-2.5 py-0.5 text-xs font-medium text-success-text"><IconCheck class="mr-1 h-3 w-3" /> {t("pool.approved")}</span> |
| 153 | </Show> | 171 | </Show> |
| 154 | 172 | ||
| 155 | <Show when={canDelete(question)}> | 173 | <Show when={canDelete(question)}> |
| @@ -157,8 +175,9 @@ function QuestionsContent() { | |||
| 157 | type="button" | 175 | type="button" |
| 158 | variant="ghost" | 176 | variant="ghost" |
| 159 | size="sm" | 177 | size="sm" |
| 160 | - class="h-8 w-8 p-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive-text rounded-lg" | 178 | + class="h-8 w-8 rounded-lg p-0 text-muted-foreground hover:bg-destructive/10 hover:text-destructive-text touch:h-10 touch:w-10" |
| 161 | title={t("common.delete")} | 179 | title={t("common.delete")} |
| 180 | + aria-label={t("common.delete")} | ||
| 162 | onClick={(e) => { | 181 | onClick={(e) => { |
| 163 | e.preventDefault(); | 182 | e.preventDefault(); |
| 164 | e.stopPropagation(); | 183 | e.stopPropagation(); |
| @@ -278,7 +297,7 @@ function AskQuestionDialog(props: { onClose: () => void; onSuccess: () => void } | |||
| 278 | type="button" | 297 | type="button" |
| 279 | variant="ghost" | 298 | variant="ghost" |
| 280 | size="icon" | 299 | size="icon" |
| 281 | - class="h-6 w-6 rounded-full hover:bg-destructive/10 hover:text-destructive-text z-10" | 300 | + class="z-10 h-6 w-6 rounded-full hover:bg-destructive/10 hover:text-destructive-text touch:h-10 touch:w-10" |
| 282 | onClick={(e) => { | 301 | onClick={(e) => { |
| 283 | e.stopPropagation(); | 302 | e.stopPropagation(); |
| 284 | e.preventDefault(); | 303 | e.preventDefault(); |
src/pages/register-page.tsxmodified+8 -8
| @@ -97,7 +97,7 @@ function RegisterForm() { | |||
| 97 | <Label for="register-school">{t("auth.school")}</Label> | 97 | <Label for="register-school">{t("auth.school")}</Label> |
| 98 | <Select | 98 | <Select |
| 99 | id="register-school" | 99 | id="register-school" |
| 100 | - class="h-9" | 100 | + class="h-10 sm:h-9 touch:h-10" |
| 101 | required | 101 | required |
| 102 | disabled={schools.loading || noSchoolOpen() || Boolean(schools.error)} | 102 | disabled={schools.loading || noSchoolOpen() || Boolean(schools.error)} |
| 103 | value={school()} | 103 | value={school()} |
| @@ -118,7 +118,7 @@ function RegisterForm() { | |||
| 118 | <Label for="register-username">{t("auth.username")}</Label> | 118 | <Label for="register-username">{t("auth.username")}</Label> |
| 119 | <Input | 119 | <Input |
| 120 | id="register-username" | 120 | id="register-username" |
| 121 | - class="h-9" | 121 | + class="h-10 sm:h-9 touch:h-10" |
| 122 | autocomplete="username" | 122 | autocomplete="username" |
| 123 | minlength={limits()?.user.min_username_len} | 123 | minlength={limits()?.user.min_username_len} |
| 124 | maxlength={limits()?.user.max_username_len} | 124 | maxlength={limits()?.user.max_username_len} |
| @@ -133,7 +133,7 @@ function RegisterForm() { | |||
| 133 | <div class="relative"> | 133 | <div class="relative"> |
| 134 | <Input | 134 | <Input |
| 135 | id="register-password" | 135 | id="register-password" |
| 136 | - class="h-9 pr-10" | 136 | + class="h-10 pr-10 sm:h-9 touch:h-10" |
| 137 | type={showPassword() ? "text" : "password"} | 137 | type={showPassword() ? "text" : "password"} |
| 138 | autocomplete="new-password" | 138 | autocomplete="new-password" |
| 139 | minlength={minPasswordLength()} | 139 | minlength={minPasswordLength()} |
| @@ -148,7 +148,7 @@ function RegisterForm() { | |||
| 148 | <button | 148 | <button |
| 149 | type="button" | 149 | type="button" |
| 150 | onClick={() => setShowPassword(!showPassword())} | 150 | onClick={() => setShowPassword(!showPassword())} |
| 151 | - class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground" | 151 | + class="absolute right-0.5 top-1/2 inline-flex h-9 w-9 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors outline-hidden hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring" |
| 152 | aria-label={showPassword() ? t("auth.hidePassword") : t("auth.showPassword")} | 152 | aria-label={showPassword() ? t("auth.hidePassword") : t("auth.showPassword")} |
| 153 | > | 153 | > |
| 154 | <Show when={showPassword()} fallback={<IconEye class="h-4 w-4" />}> | 154 | <Show when={showPassword()} fallback={<IconEye class="h-4 w-4" />}> |
| @@ -169,7 +169,7 @@ function RegisterForm() { | |||
| 169 | <div class="relative"> | 169 | <div class="relative"> |
| 170 | <Input | 170 | <Input |
| 171 | id="register-confirm" | 171 | id="register-confirm" |
| 172 | - class="h-9 pr-10" | 172 | + class="h-10 pr-10 sm:h-9 touch:h-10" |
| 173 | type={showConfirm() ? "text" : "password"} | 173 | type={showConfirm() ? "text" : "password"} |
| 174 | autocomplete="new-password" | 174 | autocomplete="new-password" |
| 175 | minlength={minPasswordLength()} | 175 | minlength={minPasswordLength()} |
| @@ -184,7 +184,7 @@ function RegisterForm() { | |||
| 184 | <button | 184 | <button |
| 185 | type="button" | 185 | type="button" |
| 186 | onClick={() => setShowConfirm(!showConfirm())} | 186 | onClick={() => setShowConfirm(!showConfirm())} |
| 187 | - class="absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground transition-colors hover:text-foreground" | 187 | + class="absolute right-0.5 top-1/2 inline-flex h-9 w-9 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors outline-hidden hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring" |
| 188 | aria-label={showConfirm() ? t("auth.hideConfirmPassword") : t("auth.showConfirmPassword")} | 188 | aria-label={showConfirm() ? t("auth.hideConfirmPassword") : t("auth.showConfirmPassword")} |
| 189 | > | 189 | > |
| 190 | <Show when={showConfirm()} fallback={<IconEye class="h-4 w-4" />}> | 190 | <Show when={showConfirm()} fallback={<IconEye class="h-4 w-4" />}> |
| @@ -200,10 +200,10 @@ function RegisterForm() { | |||
| 200 | </div> | 200 | </div> |
| 201 | 201 | ||
| 202 | {error() && ( | 202 | {error() && ( |
| 203 | - <p class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> | 203 | + <p role="alert" class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive-text">{error()}</p> |
| 204 | )} | 204 | )} |
| 205 | 205 | ||
| 206 | - <Button type="submit" class="h-9 w-full text-sm" disabled={pending() || schools.loading || noSchoolOpen() || Boolean(schools.error) || !school()}> | 206 | + <Button type="submit" class="h-10 w-full text-sm sm:h-9 touch:h-10" disabled={pending() || schools.loading || noSchoolOpen() || Boolean(schools.error) || !school()}> |
| 207 | {pending() ? t("common.loading") : t("auth.register")} | 207 | {pending() ? t("common.loading") : t("auth.register")} |
| 208 | </Button> | 208 | </Button> |
| 209 | </form> | 209 | </form> |
src/pages/settings-page.tsxmodified+3 -2
| @@ -12,6 +12,7 @@ import { PageHeader } from "@/components/layout/page-header"; | |||
| 12 | import { Alert } from "@/components/ui/alert"; | 12 | import { Alert } from "@/components/ui/alert"; |
| 13 | import { Badge } from "@/components/ui/badge"; | 13 | import { Badge } from "@/components/ui/badge"; |
| 14 | import { Button } from "@/components/ui/button"; | 14 | import { Button } from "@/components/ui/button"; |
| 15 | +import { TOOLBAR_CONTROL } from "@/components/ui/data-toolbar"; | ||
| 15 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; | 16 | import { ConfirmDialog } from "@/components/ui/confirm-dialog"; |
| 16 | import { ErrorAlert } from "@/components/ui/error-alert"; | 17 | import { ErrorAlert } from "@/components/ui/error-alert"; |
| 17 | import { IconAlert, IconPlus, IconTrash } from "@/components/ui/icons"; | 18 | import { IconAlert, IconPlus, IconTrash } from "@/components/ui/icons"; |
| @@ -222,7 +223,7 @@ function SettingsContent() { | |||
| 222 | <Button | 223 | <Button |
| 223 | type="button" | 224 | type="button" |
| 224 | size="sm" | 225 | size="sm" |
| 225 | - class="min-w-[7.5rem] rounded-lg" | 226 | + class="min-w-[7.5rem]" |
| 226 | disabled={pending() || !dirty()} | 227 | disabled={pending() || !dirty()} |
| 227 | onClick={() => void save()} | 228 | onClick={() => void save()} |
| 228 | > | 229 | > |
| @@ -752,7 +753,7 @@ function SettingsContent() { | |||
| 752 | <p class="mt-1 max-w-64 text-xs text-destructive-text" role="alert">{error()}</p> | 753 | <p class="mt-1 max-w-64 text-xs text-destructive-text" role="alert">{error()}</p> |
| 753 | </Show> | 754 | </Show> |
| 754 | </div> | 755 | </div> |
| 755 | - <Button type="button" size="sm" class="shrink-0 rounded-lg" disabled={pending()} onClick={() => void save()}> | 756 | + <Button type="button" size="sm" class={cn(TOOLBAR_CONTROL, "shrink-0 px-3.5")} disabled={pending()} onClick={() => void save()}> |
| 756 | {t("common.save")} | 757 | {t("common.save")} |
| 757 | </Button> | 758 | </Button> |
| 758 | </div> | 759 | </div> |
src/pages/staff-work-page.tsxmodified+12 -8
| @@ -486,14 +486,18 @@ function StaffCard(props: { person: PersonRef; stats: StaffCardStats | null | un | |||
| 486 | )} | 486 | )} |
| 487 | </Show> | 487 | </Show> |
| 488 | 488 | ||
| 489 | - <div class="border-t border-border-hairline pt-2 text-xs text-text-subtle"> | 489 | + {/* No stats (still loading, or the read failed): no footer, rather than |
| 490 | - <Show | 490 | + an empty band under a hairline. */} |
| 491 | - when={props.stats?.daysThisMonth != null} | 491 | + <Show when={props.stats}> |
| 492 | - fallback={<Show when={props.stats}>{t("work.totalEntries", { count: String(props.stats?.total ?? 0) })}</Show>} | 492 | + <div class="border-t border-border-hairline pt-2 text-xs text-text-subtle"> |
| 493 | - > | 493 | + <Show |
| 494 | - {t("work.daysThisMonth", { count: String(props.stats?.daysThisMonth) })} | 494 | + when={props.stats?.daysThisMonth != null} |
| 495 | - </Show> | 495 | + fallback={t("work.totalEntries", { count: String(props.stats?.total ?? 0) })} |
| 496 | - </div> | 496 | + > |
| 497 | + {t("work.daysThisMonth", { count: String(props.stats?.daysThisMonth) })} | ||
| 498 | + </Show> | ||
| 499 | + </div> | ||
| 500 | + </Show> | ||
| 497 | </button> | 501 | </button> |
| 498 | ); | 502 | ); |
| 499 | } | 503 | } |
src/pages/student-attendance-page.tsxmodified+11 -9
| @@ -6,7 +6,6 @@ import { ApiError, formatApiError } from "@/api/client"; | |||
| 6 | import type { ClassGroup, PersonRef } from "@/api/client"; | 6 | import type { ClassGroup, PersonRef } from "@/api/client"; |
| 7 | import { AttendanceReportView } from "@/components/attendance/attendance-report-view"; | 7 | import { AttendanceReportView } from "@/components/attendance/attendance-report-view"; |
| 8 | import { RouteGuard } from "@/components/layout/route-guard"; | 8 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 9 | -import { Alert } from "@/components/ui/alert"; | ||
| 10 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 9 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 11 | import { ErrorAlert } from "@/components/ui/error-alert"; | 10 | import { ErrorAlert } from "@/components/ui/error-alert"; |
| 12 | import { DropdownSelect } from "@/components/ui/select"; | 11 | import { DropdownSelect } from "@/components/ui/select"; |
| @@ -33,6 +32,9 @@ function StudentAttendanceContent() { | |||
| 33 | const t = useT(); | 32 | const t = useT(); |
| 34 | const [viewUser, setViewUser] = createSignal<PersonRef | null>(null); | 33 | const [viewUser, setViewUser] = createSignal<PersonRef | null>(null); |
| 35 | const [error, setError] = createSignal(""); | 34 | const [error, setError] = createSignal(""); |
| 35 | + // The roster read's own failure: shown in place of the table with a retry, | ||
| 36 | + // so a failed load does not read as "no students". | ||
| 37 | + const [listError, setListError] = createSignal(""); | ||
| 36 | 38 | ||
| 37 | // No endpoint reports attendance or focus time for a list of students — | 39 | // No endpoint reports attendance or focus time for a list of students — |
| 38 | // only one student at a time — so the list stays a roster (a column per | 40 | // only one student at a time — so the list stays a roster (a column per |
| @@ -43,11 +45,11 @@ function StudentAttendanceContent() { | |||
| 43 | // picked class's roster, so the dropdown keeps listing every class and the | 45 | // picked class's roster, so the dropdown keeps listing every class and the |
| 44 | // scoped fetch resolves the picked class without another request. | 46 | // scoped fetch resolves the picked class without another request. |
| 45 | const [allClasses, setAllClasses] = createSignal<ClassGroup[]>([]); | 47 | const [allClasses, setAllClasses] = createSignal<ClassGroup[]>([]); |
| 46 | - const [list] = createResource( | 48 | + const [list, { refetch: refetchList }] = createResource( |
| 47 | () => classFilter(), | 49 | () => classFilter(), |
| 48 | async (classId) => { | 50 | async (classId) => { |
| 49 | try { | 51 | try { |
| 50 | - setError(""); | 52 | + setListError(""); |
| 51 | if (!classId) { | 53 | if (!classId) { |
| 52 | const rows = await getStudentDirectory(); | 54 | const rows = await getStudentDirectory(); |
| 53 | const seen = new Map<string, ClassGroup>(); | 55 | const seen = new Map<string, ClassGroup>(); |
| @@ -58,7 +60,7 @@ function StudentAttendanceContent() { | |||
| 58 | const picked = allClasses().find((cls) => cls.id === classId); | 60 | const picked = allClasses().find((cls) => cls.id === classId); |
| 59 | return await getStudentDirectory(picked); | 61 | return await getStudentDirectory(picked); |
| 60 | } catch (err) { | 62 | } catch (err) { |
| 61 | - setError(formatApiError(err)); | 63 | + setListError(formatApiError(err)); |
| 62 | return []; | 64 | return []; |
| 63 | } | 65 | } |
| 64 | }, | 66 | }, |
| @@ -121,11 +123,11 @@ function StudentAttendanceContent() { | |||
| 121 | return ( | 123 | return ( |
| 122 | <div class="space-y-6"> | 124 | <div class="space-y-6"> |
| 123 | <section class="space-y-4 p-0"> | 125 | <section class="space-y-4 p-0"> |
| 124 | - <Show when={error() && !viewUser()}> | 126 | + <Show when={listError()}> |
| 125 | - <Alert variant="destructive">{error()}</Alert> | 127 | + <ErrorAlert message={listError()} onRetry={() => void refetchList()} /> |
| 126 | </Show> | 128 | </Show> |
| 127 | 129 | ||
| 128 | - <Show when={!listLoading()} fallback={<DataTableSkeleton columns={4} rows={6} />}> | 130 | + <Show when={!listLoading() && !listError()} fallback={<Show when={!listError()}><DataTableSkeleton columns={4} rows={6} /></Show>}> |
| 129 | <DataTable | 131 | <DataTable |
| 130 | urlState | 132 | urlState |
| 131 | title={t("nav.studentAttendance")} | 133 | title={t("nav.studentAttendance")} |
| @@ -135,6 +137,7 @@ function StudentAttendanceContent() { | |||
| 135 | tableClass="min-w-xl" | 137 | tableClass="min-w-xl" |
| 136 | empty={t("form.noStudents")} | 138 | empty={t("form.noStudents")} |
| 137 | searchPredicate={searchPerson} | 139 | searchPredicate={searchPerson} |
| 140 | + filterPlaceholder={t("roster.searchDirectory")} | ||
| 138 | filters={ | 141 | filters={ |
| 139 | <DropdownSelect | 142 | <DropdownSelect |
| 140 | labelPrefix={t("roster.class")} | 143 | labelPrefix={t("roster.class")} |
| @@ -146,7 +149,7 @@ function StudentAttendanceContent() { | |||
| 146 | filtersActive={classFilter() !== ""} | 149 | filtersActive={classFilter() !== ""} |
| 147 | pageResetKey={classFilter()} | 150 | pageResetKey={classFilter()} |
| 148 | onClearFilters={() => setClassFilter("")} | 151 | onClearFilters={() => setClassFilter("")} |
| 149 | - filterHint={t("search.hint.people")} | 152 | + filterHint={t("search.hint.studentDirectory")} |
| 150 | enablePagination | 153 | enablePagination |
| 151 | pageSize={PAGE_SIZE} | 154 | pageSize={PAGE_SIZE} |
| 152 | storageKey="student-attendance" | 155 | storageKey="student-attendance" |
| @@ -168,7 +171,6 @@ function StudentAttendanceContent() { | |||
| 168 | } | 171 | } |
| 169 | }} | 172 | }} |
| 170 | title={t("attendance.forUser", { user: personLabel(viewUser()) })} | 173 | title={t("attendance.forUser", { user: personLabel(viewUser()) })} |
| 171 | - description={t("attendance.lookup")} | ||
| 172 | bodyClass="bg-muted/20" | 174 | bodyClass="bg-muted/20" |
| 173 | > | 175 | > |
| 174 | <div class="min-w-0 space-y-3"> | 176 | <div class="min-w-0 space-y-3"> |
src/pages/student-marks-page.tsxmodified+64 -20
| @@ -7,11 +7,11 @@ import type { MarksReport } from "@/api/client"; | |||
| 7 | import { cn } from "@/lib/cn"; | 7 | import { cn } from "@/lib/cn"; |
| 8 | import { MarksReportView } from "@/components/marks/marks-report-view"; | 8 | import { MarksReportView } from "@/components/marks/marks-report-view"; |
| 9 | import { RouteGuard } from "@/components/layout/route-guard"; | 9 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 10 | -import { Alert } from "@/components/ui/alert"; | ||
| 11 | import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; | 10 | import { FAN_OUT_LIMIT, mapConcurrent } from "@/lib/map-concurrent"; |
| 12 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 11 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 13 | import { ErrorAlert } from "@/components/ui/error-alert"; | 12 | import { ErrorAlert } from "@/components/ui/error-alert"; |
| 14 | import { IconEye } from "@/components/ui/icons"; | 13 | import { IconEye } from "@/components/ui/icons"; |
| 14 | +import { DropdownSelect } from "@/components/ui/select"; | ||
| 15 | import { SidePanel } from "@/components/ui/side-panel"; | 15 | import { SidePanel } from "@/components/ui/side-panel"; |
| 16 | import { studentDirectoryColumns } from "@/components/users/student-directory-columns"; | 16 | import { studentDirectoryColumns } from "@/components/users/student-directory-columns"; |
| 17 | import { TableRowActions } from "@/components/ui/table-row-actions"; | 17 | import { TableRowActions } from "@/components/ui/table-row-actions"; |
| @@ -34,44 +34,65 @@ export default function StudentMarksPage() { | |||
| 34 | 34 | ||
| 35 | const MARKS_FETCH_CAP = 200; | 35 | const MARKS_FETCH_CAP = 200; |
| 36 | 36 | ||
| 37 | +// While the per-student marks load, a pulse rather than the empty-cell dash: | ||
| 38 | +// "-" would claim the student has no marks. Empty values use DataTable's own | ||
| 39 | +// faded "-", the same one the band column gets from its accessor. | ||
| 40 | +const CellPending = () => <span class="inline-block h-3 w-8 animate-pulse rounded bg-muted align-middle" />; | ||
| 41 | +const CellEmpty = () => <span class="text-muted-foreground/40">-</span>; | ||
| 42 | + | ||
| 37 | function StudentMarksContent() { | 43 | function StudentMarksContent() { |
| 38 | const t = useT(); | 44 | const t = useT(); |
| 39 | const { locale } = usePreferences(); | 45 | const { locale } = usePreferences(); |
| 40 | const [viewStudent, setViewStudent] = createSignal<StudentDirectoryRow | null>(null); | 46 | const [viewStudent, setViewStudent] = createSignal<StudentDirectoryRow | null>(null); |
| 41 | const [error, setError] = createSignal(""); | 47 | const [error, setError] = createSignal(""); |
| 48 | + // The roster read's own failure: shown in place of the table with a retry, | ||
| 49 | + // so a failed load does not read as "no students". | ||
| 50 | + const [listError, setListError] = createSignal(""); | ||
| 42 | 51 | ||
| 43 | - const [list] = createResource(async () => { | 52 | + const [list, { refetch: refetchList }] = createResource(async () => { |
| 44 | try { | 53 | try { |
| 45 | - setError(""); | 54 | + setListError(""); |
| 46 | return await getStudentDirectory(); | 55 | return await getStudentDirectory(); |
| 47 | } catch (err) { | 56 | } catch (err) { |
| 48 | - setError(formatApiError(err)); | 57 | + setListError(formatApiError(err)); |
| 49 | return []; | 58 | return []; |
| 50 | } | 59 | } |
| 51 | }, { initialValue: [] as StudentDirectoryRow[] }); | 60 | }, { initialValue: [] as StudentDirectoryRow[] }); |
| 52 | 61 | ||
| 62 | + // The class filter Yoklamalar and Pomodorolar offer too. The directory is | ||
| 63 | + // read whole, so it narrows client-side. | ||
| 64 | + const [classFilter, setClassFilter] = createSignal(""); | ||
| 65 | + const filteredList = createMemo(() => { | ||
| 66 | + const picked = classFilter(); | ||
| 67 | + return picked ? list().filter((row) => row.classes.some((cls) => cls.id === picked)) : list(); | ||
| 68 | + }); | ||
| 69 | + | ||
| 53 | // Per-student overall marks for the inline "average" column. No bulk endpoint | 70 | // Per-student overall marks for the inline "average" column. No bulk endpoint |
| 54 | // exists, so this is one getUserMarks call per listed student — at most | 71 | // exists, so this is one getUserMarks call per listed student — at most |
| 55 | - // FAN_OUT_LIMIT in flight, and skipped past the cap with a visible notice | 72 | + // FAN_OUT_LIMIT in flight. The cap applies to the rows on screen, not the |
| 56 | - // instead of a column that silently reads "—" for everyone. | 73 | + // school: past it the whole-school list stays blank (the header's "i" says |
| 74 | + // so), and picking a class fills the column for that class. Reports already | ||
| 75 | + // read are kept, so switching classes only fetches the new students. | ||
| 76 | + const marksCache = new Map<string, MarksReport | null>(); | ||
| 57 | const [marksMapRes] = createResource( | 77 | const [marksMapRes] = createResource( |
| 58 | () => { | 78 | () => { |
| 59 | - const ids = list().map((row) => row.person.id); | 79 | + const ids = filteredList().map((row) => row.person.id); |
| 60 | return ids.length > 0 && ids.length <= MARKS_FETCH_CAP ? ids : null; | 80 | return ids.length > 0 && ids.length <= MARKS_FETCH_CAP ? ids : null; |
| 61 | }, | 81 | }, |
| 62 | async (ids) => { | 82 | async (ids) => { |
| 63 | - const pairs = await mapConcurrent(ids, FAN_OUT_LIMIT, async (id) => { | 83 | + const missing = ids.filter((id) => !marksCache.has(id)); |
| 84 | + await mapConcurrent(missing, FAN_OUT_LIMIT, async (id) => { | ||
| 64 | try { | 85 | try { |
| 65 | - return [id, await getUserMarks(id)] as const; | 86 | + marksCache.set(id, await getUserMarks(id)); |
| 66 | } catch { | 87 | } catch { |
| 67 | - return [id, null] as const; | 88 | + marksCache.set(id, null); |
| 68 | } | 89 | } |
| 69 | }); | 90 | }); |
| 70 | - return Object.fromEntries(pairs) as Record<string, MarksReport | null>; | 91 | + return Object.fromEntries(ids.map((id) => [id, marksCache.get(id) ?? null])) as Record<string, MarksReport | null>; |
| 71 | }, | 92 | }, |
| 72 | ); | 93 | ); |
| 73 | // A memo: the columns read it, and must not rebuild on every list refetch. | 94 | // A memo: the columns read it, and must not rebuild on every list refetch. |
| 74 | - const marksCapped = createMemo(() => !list.loading && (list() ?? []).length > MARKS_FETCH_CAP); | 95 | + const marksCapped = createMemo(() => !list.loading && filteredList().length > MARKS_FETCH_CAP); |
| 75 | const marksOf = (id: string) => marksMapRes()?.[id]; | 96 | const marksOf = (id: string) => marksMapRes()?.[id]; |
| 76 | const examCountOf = (id: string) => { | 97 | const examCountOf = (id: string) => { |
| 77 | const rep = marksOf(id); | 98 | const rep = marksOf(id); |
| @@ -100,9 +121,16 @@ function StudentMarksContent() { | |||
| 100 | // data-array identity, so without a new reference the averages only appear once | 121 | // data-array identity, so without a new reference the averages only appear once |
| 101 | // something forces a re-derive (e.g. sorting). Track marksMapRes and hand back a | 122 | // something forces a re-derive (e.g. sorting). Track marksMapRes and hand back a |
| 102 | // fresh array so the column fills in as soon as the marks load. | 123 | // fresh array so the column fills in as soon as the marks load. |
| 124 | + const classOptions = createMemo(() => { | ||
| 125 | + const seen = new Map<string, string>(); | ||
| 126 | + for (const row of list()) for (const cls of row.classes) seen.set(cls.id, cls.name); | ||
| 127 | + return [...seen] | ||
| 128 | + .sort((a, b) => a[1].localeCompare(b[1], "tr", { numeric: true })) | ||
| 129 | + .map(([value, label]) => ({ value, label })); | ||
| 130 | + }); | ||
| 103 | const rows = () => { | 131 | const rows = () => { |
| 104 | marksMapRes(); | 132 | marksMapRes(); |
| 105 | - return [...list()]; | 133 | + return [...filteredList()]; |
| 106 | }; | 134 | }; |
| 107 | const listLoading = () => list.loading; | 135 | const listLoading = () => list.loading; |
| 108 | const searchPerson = (row: StudentDirectoryRow, query: string) => | 136 | const searchPerson = (row: StudentDirectoryRow, query: string) => |
| @@ -120,7 +148,7 @@ function StudentMarksContent() { | |||
| 120 | meta: { align: "right", headerInfo: marksCapped() ? t("marks.averageCapped", { cap: MARKS_FETCH_CAP }) : undefined }, | 148 | meta: { align: "right", headerInfo: marksCapped() ? t("marks.averageCapped", { cap: MARKS_FETCH_CAP }) : undefined }, |
| 121 | cell: (cell) => { | 149 | cell: (cell) => { |
| 122 | const average = marksOf(cell.row.original.person.id)?.overall_average; | 150 | const average = marksOf(cell.row.original.person.id)?.overall_average; |
| 123 | - if (average == null) return <span class="text-sm text-muted-foreground">—</span>; | 151 | + if (average == null) return marksMapRes.loading ? <CellPending /> : <CellEmpty />; |
| 124 | return <span class={cn("font-semibold tabular-nums", avgTone(average))}>{formatDecimal(average, locale())}</span>; | 152 | return <span class={cn("font-semibold tabular-nums", avgTone(average))}>{formatDecimal(average, locale())}</span>; |
| 125 | }, | 153 | }, |
| 126 | }, | 154 | }, |
| @@ -131,7 +159,7 @@ function StudentMarksContent() { | |||
| 131 | header: t("marks.band"), | 159 | header: t("marks.band"), |
| 132 | accessorFn: (row) => marksOf(row.person.id)?.overall_grade ?? "", | 160 | accessorFn: (row) => marksOf(row.person.id)?.overall_grade ?? "", |
| 133 | meta: { align: "right" }, | 161 | meta: { align: "right" }, |
| 134 | - cell: (cell) => <span class="tabular-nums text-muted-foreground">{marksOf(cell.row.original.person.id)?.overall_grade ?? "—"}</span>, | 162 | + cell: (cell) => <span class="tabular-nums text-muted-foreground">{marksOf(cell.row.original.person.id)?.overall_grade}</span>, |
| 135 | }, | 163 | }, |
| 136 | // Graded exams behind the average, counted from the same report. | 164 | // Graded exams behind the average, counted from the same report. |
| 137 | { | 165 | { |
| @@ -139,7 +167,11 @@ function StudentMarksContent() { | |||
| 139 | header: t("marks.examCount"), | 167 | header: t("marks.examCount"), |
| 140 | accessorFn: (row) => examCountOf(row.person.id) ?? -1, | 168 | accessorFn: (row) => examCountOf(row.person.id) ?? -1, |
| 141 | meta: { align: "right" }, | 169 | meta: { align: "right" }, |
| 142 | - cell: (cell) => <span class="tabular-nums text-muted-foreground">{examCountOf(cell.row.original.person.id) ?? "—"}</span>, | 170 | + cell: (cell) => { |
| 171 | + const count = examCountOf(cell.row.original.person.id); | ||
| 172 | + if (count == null) return marksMapRes.loading ? <CellPending /> : <CellEmpty />; | ||
| 173 | + return <span class="tabular-nums text-muted-foreground">{count}</span>; | ||
| 174 | + }, | ||
| 143 | }, | 175 | }, |
| 144 | { | 176 | { |
| 145 | id: "actions", | 177 | id: "actions", |
| @@ -169,11 +201,11 @@ function StudentMarksContent() { | |||
| 169 | return ( | 201 | return ( |
| 170 | <div class="space-y-6"> | 202 | <div class="space-y-6"> |
| 171 | <section class="space-y-4 p-0"> | 203 | <section class="space-y-4 p-0"> |
| 172 | - <Show when={error() && !viewStudent()}> | 204 | + <Show when={listError()}> |
| 173 | - <Alert variant="destructive">{error()}</Alert> | 205 | + <ErrorAlert message={listError()} onRetry={() => void refetchList()} /> |
| 174 | </Show> | 206 | </Show> |
| 175 | 207 | ||
| 176 | - <Show when={!listLoading()} fallback={<DataTableSkeleton columns={7} rows={6} />}> | 208 | + <Show when={!listLoading() && !listError()} fallback={<Show when={!listError()}><DataTableSkeleton columns={7} rows={6} /></Show>}> |
| 177 | <DataTable | 209 | <DataTable |
| 178 | urlState | 210 | urlState |
| 179 | title={t("nav.studentMarks")} | 211 | title={t("nav.studentMarks")} |
| @@ -183,7 +215,19 @@ function StudentMarksContent() { | |||
| 183 | tableClass="min-w-xl" | 215 | tableClass="min-w-xl" |
| 184 | empty={t("form.noStudents")} | 216 | empty={t("form.noStudents")} |
| 185 | searchPredicate={searchPerson} | 217 | searchPredicate={searchPerson} |
| 186 | - filterHint={t("search.hint.people")} | 218 | + filterPlaceholder={t("roster.searchDirectory")} |
| 219 | + filterHint={t("search.hint.studentDirectory")} | ||
| 220 | + filters={ | ||
| 221 | + <DropdownSelect | ||
| 222 | + labelPrefix={t("roster.class")} | ||
| 223 | + value={classFilter()} | ||
| 224 | + onChange={setClassFilter} | ||
| 225 | + options={[{ value: "", label: t("common.all") }, ...classOptions()]} | ||
| 226 | + /> | ||
| 227 | + } | ||
| 228 | + filtersActive={classFilter() !== ""} | ||
| 229 | + pageResetKey={classFilter()} | ||
| 230 | + onClearFilters={() => setClassFilter("")} | ||
| 187 | enablePagination | 231 | enablePagination |
| 188 | pageSize={PAGE_SIZE} | 232 | pageSize={PAGE_SIZE} |
| 189 | storageKey="student-marks" | 233 | storageKey="student-marks" |
src/pages/student-pomodoro-page.tsxmodified+11 -9
| @@ -6,7 +6,6 @@ import type { ClassGroup, PersonRef } from "@/api/client"; | |||
| 6 | import { ApiError, formatApiError } from "@/api/client"; | 6 | import { ApiError, formatApiError } from "@/api/client"; |
| 7 | import { RouteGuard } from "@/components/layout/route-guard"; | 7 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 8 | import { PomodoroLogView } from "@/components/pomodoro/pomodoro-log-view"; | 8 | import { PomodoroLogView } from "@/components/pomodoro/pomodoro-log-view"; |
| 9 | -import { Alert } from "@/components/ui/alert"; | ||
| 10 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; | 9 | import { DataTable, DataTableSkeleton } from "@/components/ui/data-table"; |
| 11 | import { ErrorAlert } from "@/components/ui/error-alert"; | 10 | import { ErrorAlert } from "@/components/ui/error-alert"; |
| 12 | import { DropdownSelect } from "@/components/ui/select"; | 11 | import { DropdownSelect } from "@/components/ui/select"; |
| @@ -33,6 +32,9 @@ function StudentPomodoroContent() { | |||
| 33 | const t = useT(); | 32 | const t = useT(); |
| 34 | const [viewUser, setViewUser] = createSignal<PersonRef | null>(null); | 33 | const [viewUser, setViewUser] = createSignal<PersonRef | null>(null); |
| 35 | const [error, setError] = createSignal(""); | 34 | const [error, setError] = createSignal(""); |
| 35 | + // The roster read's own failure: shown in place of the table with a retry, | ||
| 36 | + // so a failed load does not read as "no students". | ||
| 37 | + const [listError, setListError] = createSignal(""); | ||
| 36 | 38 | ||
| 37 | // No endpoint reports attendance or focus time for a list of students — | 39 | // No endpoint reports attendance or focus time for a list of students — |
| 38 | // only one student at a time — so the list stays a roster (a column per | 40 | // only one student at a time — so the list stays a roster (a column per |
| @@ -43,11 +45,11 @@ function StudentPomodoroContent() { | |||
| 43 | // picked class's roster, so the dropdown keeps listing every class and the | 45 | // picked class's roster, so the dropdown keeps listing every class and the |
| 44 | // scoped fetch resolves the picked class without another request. | 46 | // scoped fetch resolves the picked class without another request. |
| 45 | const [allClasses, setAllClasses] = createSignal<ClassGroup[]>([]); | 47 | const [allClasses, setAllClasses] = createSignal<ClassGroup[]>([]); |
| 46 | - const [list] = createResource( | 48 | + const [list, { refetch: refetchList }] = createResource( |
| 47 | () => classFilter(), | 49 | () => classFilter(), |
| 48 | async (classId) => { | 50 | async (classId) => { |
| 49 | try { | 51 | try { |
| 50 | - setError(""); | 52 | + setListError(""); |
| 51 | if (!classId) { | 53 | if (!classId) { |
| 52 | const rows = await getStudentDirectory(); | 54 | const rows = await getStudentDirectory(); |
| 53 | const seen = new Map<string, ClassGroup>(); | 55 | const seen = new Map<string, ClassGroup>(); |
| @@ -58,7 +60,7 @@ function StudentPomodoroContent() { | |||
| 58 | const picked = allClasses().find((cls) => cls.id === classId); | 60 | const picked = allClasses().find((cls) => cls.id === classId); |
| 59 | return await getStudentDirectory(picked); | 61 | return await getStudentDirectory(picked); |
| 60 | } catch (err) { | 62 | } catch (err) { |
| 61 | - setError(formatApiError(err)); | 63 | + setListError(formatApiError(err)); |
| 62 | return []; | 64 | return []; |
| 63 | } | 65 | } |
| 64 | }, | 66 | }, |
| @@ -118,11 +120,11 @@ function StudentPomodoroContent() { | |||
| 118 | return ( | 120 | return ( |
| 119 | <div class="space-y-6"> | 121 | <div class="space-y-6"> |
| 120 | <section class="space-y-4 p-0"> | 122 | <section class="space-y-4 p-0"> |
| 121 | - <Show when={error() && !viewUser()}> | 123 | + <Show when={listError()}> |
| 122 | - <Alert variant="destructive">{error()}</Alert> | 124 | + <ErrorAlert message={listError()} onRetry={() => void refetchList()} /> |
| 123 | </Show> | 125 | </Show> |
| 124 | 126 | ||
| 125 | - <Show when={!listLoading()} fallback={<DataTableSkeleton columns={4} rows={6} />}> | 127 | + <Show when={!listLoading() && !listError()} fallback={<Show when={!listError()}><DataTableSkeleton columns={4} rows={6} /></Show>}> |
| 126 | <DataTable | 128 | <DataTable |
| 127 | urlState | 129 | urlState |
| 128 | title={t("nav.studentPomodoro")} | 130 | title={t("nav.studentPomodoro")} |
| @@ -132,6 +134,7 @@ function StudentPomodoroContent() { | |||
| 132 | tableClass="min-w-xl" | 134 | tableClass="min-w-xl" |
| 133 | empty={t("form.noStudents")} | 135 | empty={t("form.noStudents")} |
| 134 | searchPredicate={searchPerson} | 136 | searchPredicate={searchPerson} |
| 137 | + filterPlaceholder={t("roster.searchDirectory")} | ||
| 135 | filters={ | 138 | filters={ |
| 136 | <DropdownSelect | 139 | <DropdownSelect |
| 137 | labelPrefix={t("roster.class")} | 140 | labelPrefix={t("roster.class")} |
| @@ -143,7 +146,7 @@ function StudentPomodoroContent() { | |||
| 143 | filtersActive={classFilter() !== ""} | 146 | filtersActive={classFilter() !== ""} |
| 144 | pageResetKey={classFilter()} | 147 | pageResetKey={classFilter()} |
| 145 | onClearFilters={() => setClassFilter("")} | 148 | onClearFilters={() => setClassFilter("")} |
| 146 | - filterHint={t("search.hint.people")} | 149 | + filterHint={t("search.hint.studentDirectory")} |
| 147 | enablePagination | 150 | enablePagination |
| 148 | pageSize={PAGE_SIZE} | 151 | pageSize={PAGE_SIZE} |
| 149 | storageKey="student-pomodoro" | 152 | storageKey="student-pomodoro" |
| @@ -165,7 +168,6 @@ function StudentPomodoroContent() { | |||
| 165 | } | 168 | } |
| 166 | }} | 169 | }} |
| 167 | title={t("pomodoro.forUser", { user: personLabel(viewUser()) })} | 170 | title={t("pomodoro.forUser", { user: personLabel(viewUser()) })} |
| 168 | - description={t("pomodoro.lookup")} | ||
| 169 | > | 171 | > |
| 170 | <div class="min-w-0 space-y-3"> | 172 | <div class="min-w-0 space-y-3"> |
| 171 | <Show when={error()}> | 173 | <Show when={error()}> |
src/pages/students-roster-page.tsxmodified+5 -3
| @@ -80,11 +80,11 @@ function StudentsRosterContent() { | |||
| 80 | const columns = createMemo<ColumnDef<StudentRow>[]>(() => [ | 80 | const columns = createMemo<ColumnDef<StudentRow>[]>(() => [ |
| 81 | { | 81 | { |
| 82 | id: "student_number", | 82 | id: "student_number", |
| 83 | - accessorFn: (row) => row.person.student_number ?? "", | 83 | + accessorFn: (row) => row.person.student_number?.trim() ?? "", |
| 84 | size: 110, | 84 | size: 110, |
| 85 | header: t("roster.studentNumber"), | 85 | header: t("roster.studentNumber"), |
| 86 | meta: { cellClass: "whitespace-nowrap" }, | 86 | meta: { cellClass: "whitespace-nowrap" }, |
| 87 | - cell: (cell) => <span class="mono text-sm">{cell.row.original.person.student_number?.trim() || "—"}</span>, | 87 | + cell: (cell) => <span class="mono text-sm">{cell.row.original.person.student_number?.trim()}</span>, |
| 88 | }, | 88 | }, |
| 89 | { | 89 | { |
| 90 | id: "student", size: 220, | 90 | id: "student", size: 220, |
| @@ -94,10 +94,12 @@ function StudentsRosterContent() { | |||
| 94 | { | 94 | { |
| 95 | id: "class", | 95 | id: "class", |
| 96 | size: 90, | 96 | size: 90, |
| 97 | + // "" for a student in no class, so DataTable draws its empty-cell dash. | ||
| 98 | + accessorFn: (row) => row.classes.map((cls) => cls.name).join(", "), | ||
| 97 | header: t("roster.class"), | 99 | header: t("roster.class"), |
| 98 | meta: { cellClass: "max-w-0" }, | 100 | meta: { cellClass: "max-w-0" }, |
| 99 | cell: (cell) => ( | 101 | cell: (cell) => ( |
| 100 | - <span class="block truncate text-sm" title={cell.row.original.classes.map((cls) => cls.name).join(", ") || undefined}>{cell.row.original.classes.map((cls) => cls.name).join(", ") || "—"}</span> | 102 | + <span class="block truncate text-sm" title={cell.row.original.classes.map((cls) => cls.name).join(", ")}>{cell.row.original.classes.map((cls) => cls.name).join(", ")}</span> |
| 101 | ), | 103 | ), |
| 102 | }, | 104 | }, |
| 103 | { | 105 | { |
src/pages/teachers-roster-page.tsxmodified+5 -3
| @@ -86,12 +86,14 @@ function TeachersRosterContent() { | |||
| 86 | { | 86 | { |
| 87 | id: "sections", | 87 | id: "sections", |
| 88 | size: 260, | 88 | size: 260, |
| 89 | - accessorFn: (row) => row.sections.length, | 89 | + // Empty lists read as "" so DataTable draws its one empty-cell dash, |
| 90 | + // the same one the homeroom column gets. | ||
| 91 | + accessorFn: (row) => row.sections.join(", "), | ||
| 90 | header: t("roster.taughtSections"), | 92 | header: t("roster.taughtSections"), |
| 91 | meta: { cellClass: "max-w-0" }, | 93 | meta: { cellClass: "max-w-0" }, |
| 92 | cell: (cell) => { | 94 | cell: (cell) => { |
| 93 | const list = cell.row.original.sections; | 95 | const list = cell.row.original.sections; |
| 94 | - return list.length ? <span class="block truncate text-sm" title={list.join("\n")}>{list.join(", ")}</span> : "—"; | 96 | + return <span class="block truncate text-sm" title={list.join("\n")}>{list.join(", ")}</span>; |
| 95 | }, | 97 | }, |
| 96 | }, | 98 | }, |
| 97 | { | 99 | { |
| @@ -100,7 +102,7 @@ function TeachersRosterContent() { | |||
| 100 | accessorFn: (row) => row.homeroom.join(", "), | 102 | accessorFn: (row) => row.homeroom.join(", "), |
| 101 | header: t("roster.homeroomOf"), | 103 | header: t("roster.homeroomOf"), |
| 102 | meta: { cellClass: "max-w-0" }, | 104 | meta: { cellClass: "max-w-0" }, |
| 103 | - cell: (cell) => <span class="block truncate text-sm" title={cell.row.original.homeroom.join(", ") || undefined}>{cell.row.original.homeroom.join(", ") || "—"}</span>, | 105 | + cell: (cell) => <span class="block truncate text-sm" title={cell.row.original.homeroom.join(", ")}>{cell.row.original.homeroom.join(", ")}</span>, |
| 104 | }, | 106 | }, |
| 105 | { | 107 | { |
| 106 | id: "actions", | 108 | id: "actions", |
src/pages/terms-page.tsxmodified+1 -1
| @@ -218,7 +218,7 @@ function TermsContent() { | |||
| 218 | return; | 218 | return; |
| 219 | } | 219 | } |
| 220 | if (!editing() && !yearId()) { | 220 | if (!editing() && !yearId()) { |
| 221 | - setError(t("academicYears.year")); | 221 | + setError(t("form.selectAcademicYear")); |
| 222 | return; | 222 | return; |
| 223 | } | 223 | } |
| 224 | setPending(true); | 224 | setPending(true); |
src/pages/whiteboards-page.tsxmodified+16 -2
| @@ -1,4 +1,5 @@ | |||
| 1 | import { useNavigate } from "@tanstack/solid-router"; | 1 | import { useNavigate } from "@tanstack/solid-router"; |
| 2 | +import { createScrollRestore } from "@/lib/scroll-restore"; | ||
| 2 | import { For, Show, createEffect, createMemo, createSignal, onCleanup } from "solid-js"; | 3 | import { For, Show, createEffect, createMemo, createSignal, onCleanup } from "solid-js"; |
| 3 | import { createDebouncedSignal } from "@/lib/create-debounced-signal"; | 4 | import { createDebouncedSignal } from "@/lib/create-debounced-signal"; |
| 4 | import { createInfiniteList } from "@/lib/infinite-list"; | 5 | import { createInfiniteList } from "@/lib/infinite-list"; |
| @@ -48,6 +49,8 @@ function WhiteboardsContent() { | |||
| 48 | ); | 49 | ); |
| 49 | const [createOpen, setCreateOpen] = createSignal(false); | 50 | const [createOpen, setCreateOpen] = createSignal(false); |
| 50 | const visibleBoards = () => boards.items(); | 51 | const visibleBoards = () => boards.items(); |
| 52 | + // Back from a board lands on the same card once the grid is drawn. | ||
| 53 | + createScrollRestore(`whiteboards${window.location.search}`, () => visibleBoards().length > 0); | ||
| 51 | 54 | ||
| 52 | const meId = () => auth.user()?.id ?? ""; | 55 | const meId = () => auth.user()?.id ?? ""; |
| 53 | 56 | ||
| @@ -165,6 +168,7 @@ function CreateBoardPanel(props: { | |||
| 165 | // live search below (the admin-only `/users` list would 403 a manager/teacher). | 168 | // live search below (the admin-only `/users` list would 403 a manager/teacher). |
| 166 | const canSearch = () => hasMinRole(auth.user()?.role, "teacher"); | 169 | const canSearch = () => hasMinRole(auth.user()?.role, "teacher"); |
| 167 | const [searchResults, setSearchResults] = createSignal<PersonRef[]>([]); | 170 | const [searchResults, setSearchResults] = createSignal<PersonRef[]>([]); |
| 171 | + const [searching, setSearching] = createSignal(false); | ||
| 168 | let searchController: AbortController | null = null; | 172 | let searchController: AbortController | null = null; |
| 169 | let searchTimer: ReturnType<typeof setTimeout> | undefined; | 173 | let searchTimer: ReturnType<typeof setTimeout> | undefined; |
| 170 | createEffect(() => { | 174 | createEffect(() => { |
| @@ -173,8 +177,10 @@ function CreateBoardPanel(props: { | |||
| 173 | clearTimeout(searchTimer); | 177 | clearTimeout(searchTimer); |
| 174 | if (!canSearch() || q.length === 0) { | 178 | if (!canSearch() || q.length === 0) { |
| 175 | setSearchResults([]); | 179 | setSearchResults([]); |
| 180 | + setSearching(false); | ||
| 176 | return; | 181 | return; |
| 177 | } | 182 | } |
| 183 | + setSearching(true); | ||
| 178 | searchTimer = setTimeout(() => { | 184 | searchTimer = setTimeout(() => { |
| 179 | const ctrl = new AbortController(); | 185 | const ctrl = new AbortController(); |
| 180 | searchController = ctrl; | 186 | searchController = ctrl; |
| @@ -182,6 +188,9 @@ function CreateBoardPanel(props: { | |||
| 182 | .then((page) => setSearchResults(page.items)) | 188 | .then((page) => setSearchResults(page.items)) |
| 183 | .catch(() => { | 189 | .catch(() => { |
| 184 | if (!ctrl.signal.aborted) setSearchResults([]); | 190 | if (!ctrl.signal.aborted) setSearchResults([]); |
| 191 | + }) | ||
| 192 | + .finally(() => { | ||
| 193 | + if (!ctrl.signal.aborted) setSearching(false); | ||
| 185 | }); | 194 | }); |
| 186 | }, 300); | 195 | }, 300); |
| 187 | }); | 196 | }); |
| @@ -259,7 +268,7 @@ function CreateBoardPanel(props: { | |||
| 259 | </div> | 268 | </div> |
| 260 | 269 | ||
| 261 | <div class="space-y-1.5"> | 270 | <div class="space-y-1.5"> |
| 262 | - <Label>{t("whiteboard.participants")}</Label> | 271 | + <Label for="new-whiteboard-participant">{t("whiteboard.participants")}</Label> |
| 263 | <p class="text-xs text-muted-foreground">{t("whiteboard.participantsHint")}</p> | 272 | <p class="text-xs text-muted-foreground">{t("whiteboard.participantsHint")}</p> |
| 264 | <Show when={selected().length > 0}> | 273 | <Show when={selected().length > 0}> |
| 265 | <div class="flex flex-wrap gap-1.5"> | 274 | <div class="flex flex-wrap gap-1.5"> |
| @@ -267,7 +276,8 @@ function CreateBoardPanel(props: { | |||
| 267 | {(u) => ( | 276 | {(u) => ( |
| 268 | <button | 277 | <button |
| 269 | type="button" | 278 | type="button" |
| 270 | - class="inline-flex items-center gap-1 rounded-full border bg-muted px-2 py-0.5 text-xs" | 279 | + class="inline-flex h-8 items-center gap-1 rounded-full border bg-muted px-2.5 text-xs outline-hidden hover:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring touch:h-10" |
| 280 | + aria-label={`${t("common.remove")}: ${personLabel(u)}`} | ||
| 271 | onClick={() => setSelected((prev) => prev.filter((x) => x.id !== u.id))} | 281 | onClick={() => setSelected((prev) => prev.filter((x) => x.id !== u.id))} |
| 272 | > | 282 | > |
| 273 | {personLabel(u)} | 283 | {personLabel(u)} |
| @@ -278,6 +288,7 @@ function CreateBoardPanel(props: { | |||
| 278 | </div> | 288 | </div> |
| 279 | </Show> | 289 | </Show> |
| 280 | <Input | 290 | <Input |
| 291 | + id="new-whiteboard-participant" | ||
| 281 | placeholder={t("whiteboard.addParticipant")} | 292 | placeholder={t("whiteboard.addParticipant")} |
| 282 | value={query()} | 293 | value={query()} |
| 283 | disabled={!canSearch()} | 294 | disabled={!canSearch()} |
| @@ -287,6 +298,9 @@ function CreateBoardPanel(props: { | |||
| 287 | <Show when={!canSearch()}> | 298 | <Show when={!canSearch()}> |
| 288 | <p class="text-xs text-muted-foreground">{t("form.searchNoPermission")}</p> | 299 | <p class="text-xs text-muted-foreground">{t("form.searchNoPermission")}</p> |
| 289 | </Show> | 300 | </Show> |
| 301 | + <Show when={canSearch() && query().trim() && filtered().length === 0 && searchResults().length === 0 && !searching()}> | ||
| 302 | + <p class="text-xs text-muted-foreground">{t("common.noResults")}</p> | ||
| 303 | + </Show> | ||
| 290 | <Show when={query().trim() && filtered().length > 0}> | 304 | <Show when={query().trim() && filtered().length > 0}> |
| 291 | <div class="rounded-lg border"> | 305 | <div class="rounded-lg border"> |
| 292 | <For each={filtered()}> | 306 | <For each={filtered()}> |
src/pages/work-log-page.tsxmodified+13 -18
| @@ -1,4 +1,5 @@ | |||
| 1 | -import { Show, Suspense, createMemo, createSignal } from "solid-js"; | 1 | +import { Show, createMemo, createSignal } from "solid-js"; |
| 2 | +import { createInfiniteList } from "@/lib/infinite-list"; | ||
| 2 | import { createResource } from "@/lib/create-resource"; | 3 | import { createResource } from "@/lib/create-resource"; |
| 3 | import type { ColumnDef } from "@tanstack/solid-table"; | 4 | import type { ColumnDef } from "@tanstack/solid-table"; |
| 4 | import { getMyWorkLog } from "@/api/work"; | 5 | import { getMyWorkLog } from "@/api/work"; |
| @@ -18,8 +19,6 @@ import { formatDateTime, formatDurationMinutes } from "@/lib/format"; | |||
| 18 | import { usePreferences, useT } from "@/stores/preferences-context"; | 19 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| 19 | import type { WorkEntry } from "@/api/client"; | 20 | import type { WorkEntry } from "@/api/client"; |
| 20 | 21 | ||
| 21 | -const WORK_PAGE_SIZE = 15; | ||
| 22 | - | ||
| 23 | export default function WorkLogPage() { | 22 | export default function WorkLogPage() { |
| 24 | return ( | 23 | return ( |
| 25 | <RouteGuard minRole="teacher"> | 24 | <RouteGuard minRole="teacher"> |
| @@ -42,12 +41,9 @@ function WorkLogContent() { | |||
| 42 | ); | 41 | ); |
| 43 | const openEntry = createMemo(() => (openProbe() ?? []).find((entry) => entry.check_out == null) ?? null); | 42 | const openEntry = createMemo(() => (openProbe() ?? []).find((entry) => entry.check_out == null) ?? null); |
| 44 | 43 | ||
| 45 | - const [list, { refetch }] = createResource( | 44 | + // The log is server-paged: rows load a page at a time as the reader scrolls. |
| 46 | - () => version(), | 45 | + const list = createInfiniteList(() => "work", (_key, paging) => getMyWorkLog(paging)); |
| 47 | - async () => getMyWorkLog(), | 46 | + const pageItems = () => list.items(); |
| 48 | - ); | ||
| 49 | - | ||
| 50 | - const pageItems = () => list()?.items ?? []; | ||
| 51 | const columns = createMemo<ColumnDef<WorkEntry>[]>(() => [ | 47 | const columns = createMemo<ColumnDef<WorkEntry>[]>(() => [ |
| 52 | { | 48 | { |
| 53 | accessorKey: "check_in", | 49 | accessorKey: "check_in", |
| @@ -87,7 +83,8 @@ function WorkLogContent() { | |||
| 87 | setFlash(t("common.saved")); | 83 | setFlash(t("common.saved")); |
| 88 | } | 84 | } |
| 89 | setVersion((value) => value + 1); | 85 | setVersion((value) => value + 1); |
| 90 | - await Promise.all([refetch(), refetchOpen()]); | 86 | + list.reload(); |
| 87 | + await refetchOpen(); | ||
| 91 | } catch (err) { | 88 | } catch (err) { |
| 92 | setError(formatApiError(err)); | 89 | setError(formatApiError(err)); |
| 93 | } finally { | 90 | } finally { |
| @@ -113,21 +110,19 @@ function WorkLogContent() { | |||
| 113 | /> | 110 | /> |
| 114 | 111 | ||
| 115 | <section class="space-y-4 p-0"> | 112 | <section class="space-y-4 p-0"> |
| 116 | - <Suspense fallback={<PageSpinner />}> | 113 | + <Show when={list.error()}> |
| 117 | - <Show when={list.error}> | 114 | + {(err) => <ErrorAlert message={formatApiError(err())} onRetry={() => list.reload()} />} |
| 118 | - <ErrorAlert message={formatApiError(list.error)} onRetry={() => void refetch()} /> | 115 | + </Show> |
| 119 | - </Show> | 116 | + <Show when={!list.initialLoading()} fallback={<PageSpinner />}> |
| 120 | <DataTable | 117 | <DataTable |
| 121 | - urlState | ||
| 122 | title={t("work.entries")} | 118 | title={t("work.entries")} |
| 123 | description={t("work.ready")} | 119 | description={t("work.ready")} |
| 124 | columns={columns()} | 120 | columns={columns()} |
| 125 | data={pageItems()} | 121 | data={pageItems()} |
| 126 | - enablePagination | 122 | + infinite={{ hasMore: list.hasMore(), loading: list.loading(), total: list.total(), onLoadMore: list.loadMore }} |
| 127 | - pageSize={WORK_PAGE_SIZE} | ||
| 128 | empty={t("work.empty")} | 123 | empty={t("work.empty")} |
| 129 | /> | 124 | /> |
| 130 | - </Suspense> | 125 | + </Show> |
| 131 | </section> | 126 | </section> |
| 132 | </div> | 127 | </div> |
| 133 | ); | 128 | ); |