🛠 improve list filters and page usability
Browse files at this commit23e3aaab80cd6b151c5827bde0f077fecb8ccd9fParent: 76f3534- fix
- 🛠 improve list filters and page usability
26 changed files +481 -270
- README.md +48 -130
- docs/backend/live-list-filter-drift-2026-09-25.md +16 -0
- docs/frontend/frontend-next-steps.md +15 -2
- src/components/appointments/publish-slots-form.tsx +2 -2
- src/components/appointments/reschedule-form.tsx +2 -2
- src/components/meals/meal-day-group.tsx +11 -5
- src/components/meals/meal-day-picker.tsx +46 -0
- src/components/meals/meal-menu-row.tsx +10 -9
- src/components/meals/meal-week-nav.tsx +2 -2
- src/components/ui/data-table-search.tsx +1 -1
- src/i18n/locales/en.ts +19 -12
- src/i18n/locales/tr.ts +19 -12
- src/i18n/messages.ts +7 -0
- src/pages/calendar-page.tsx +4 -1
- src/pages/courses-page.test.tsx +12 -0
- src/pages/courses-page.tsx +29 -13
- src/pages/exams-page.tsx +4 -2
- src/pages/guide-page.tsx +16 -12
- src/pages/homework-page.test.tsx +49 -0
- src/pages/homework-page.tsx +32 -24
- src/pages/meals-page.tsx +24 -9
- src/pages/messages-page.tsx +20 -17
- src/pages/settings-page.test.tsx +49 -0
- src/pages/settings-page.tsx +32 -14
- src/pages/staff-work-page.tsx +9 -1
- src/pages/whiteboards-page.tsx +3 -0
README.mdmodified+48 -130
| @@ -1,164 +1,82 @@ | ||
| 1 | 1 | # Hezarfen Frontend |
| 2 | 2 | |
| 3 | -A modern, high-performance **SolidJS + TypeScript** web application for the Hezarfen Campus & Learning Management System. Built with Vite, TanStack Router, Tailwind CSS, and a rich, accessible dark mode design system. | |
| 3 | +Hezarfen's school dashboard and learning portal, built with SolidJS, TypeScript, TanStack Router, Tailwind CSS, and shadcn-solid components. The dashboard is a read-only status board; other pages provide role-scoped learning and school-management workflows. The interface supports Turkish and English. | |
| 4 | 4 | |
| 5 | ---- | |
| 5 | +## Local development | |
| 6 | 6 | |
| 7 | -## 🚀 Key Highlights & UI/UX Experience | |
| 8 | - | |
| 9 | -- **Çelebi AI Assistant**: Top-bar instant AI study and campus guide accessible from every page (`IconSparkles`). | |
| 10 | -- **Smart Notebook & Import Assistant**: Upload PDF, TXT, or MD files and automatically extract clean Markdown notes (OCR warning, split line joining, header stripping). | |
| 11 | -- **Freehand Drawing Canvas (`.hzdraw`)**: Unbounded pannable/zoomable drawing canvas with stroke smoothing, dark mode grid paper, and PNG scene JSON metadata embedding. | |
| 12 | -- **Question Bank & Verified Solutions**: Question repository (`/questions`) supporting written/multiple-choice answers, teacher verification badges, and subject taxonomy. | |
| 13 | -- **Live Exam Room & Real-Time Monitor**: Server-clock-synchronized countdown timer (`GET /time`), WebSocket + REST autosave, teacher SSE live monitoring, and answer sheet grading. | |
| 14 | -- **Unified Sky-Blue Container (`data-shell`)**: Cohesive, elegant dark mode surfaces (`border-sky-500/15 bg-sky-500/[0.025]`) across Courses, Exams, Events, Calendar, and Guide pages. | |
| 15 | -- **Redesigned Tab System**: Stationary tab dimensions (zero layout shifts), glowing dark mode halo rings (`dark:shadow-[0_0_16px_rgba(255,255,255,0.08)]`), dynamic alternating accent lines, and perfectly aligned icon + text triggers. | |
| 16 | -- **Çelebi Primary Button Styling**: Hairline borders, translucent fill (`bg-primary/15`), subtle rings, and clean hover micro-interactions. | |
| 17 | - | |
| 18 | ---- | |
| 19 | - | |
| 20 | -## 🛠️ Stack & Architecture | |
| 21 | - | |
| 22 | -- **Core**: SolidJS 1.8+ & TypeScript 5+ (scaffolded with Vite 6) | |
| 23 | -- **Routing**: TanStack Router (`@tanstack/solid-router`, code-based route tree, route-level code splitting via `lazy()`) | |
| 24 | -- **UI Primitives**: Custom **shadcn-solid** wrappers under `src/components/ui/` styled with Tailwind CSS (using `clsx` + `tailwind-merge` + `cva`) | |
| 25 | -- **API Layer**: Domain-driven `src/api/<domain>/` functions using `fetch` inside SolidJS `createResource` boundaries. Pages never call `fetch` directly. | |
| 26 | -- **Testing**: Vitest with 100% endpoint test coverage (`src/api/__tests__/`) and custom `mockFetch` utilities. | |
| 27 | -- **Runtime Targets**: Under ~70KB gzipped bundle size for lightning-fast loads. | |
| 28 | - | |
| 29 | ---- | |
| 30 | - | |
| 31 | -## 📦 Prerequisites & Setup | |
| 32 | - | |
| 33 | -- **Node.js** 20+ or **bun** (recommended) | |
| 34 | -- A Hezarfen backend to talk to — the deployed frontend proxies `/api/*` to it, so `https://hezarfen.dizey.sh` is enough in a browser; for a direct backend (dev) door use `https://hezarfen-backend.dizey.sh`, or `BACKEND_ORIGIN=http://127.0.0.1:7656` against a backend on the same machine | |
| 35 | - | |
| 36 | -### Installation & Development | |
| 7 | +Install [Bun](https://bun.sh/) and run: | |
| 37 | 8 | |
| 38 | 9 | ```bash |
| 39 | -# Install dependencies | |
| 40 | 10 | bun install |
| 41 | - | |
| 42 | -# Start Vite development server | |
| 43 | 11 | bun run dev |
| 44 | - | |
| 45 | -# Run unit tests | |
| 46 | -bun run test | |
| 47 | - | |
| 48 | -# Typecheck and build production bundle | |
| 49 | -bun run build | |
| 50 | 12 | ``` |
| 51 | 13 | |
| 52 | -Open [http://localhost:5173](http://localhost:5173) in your browser. | |
| 53 | - | |
| 54 | -> **Proxy Note**: Vite proxies `/api/*` and WebSocket connections to `BACKEND_ORIGIN`, preserving HttpOnly session cookies across same-origin calls. Local development defaults to `https://hezarfen-backend.dizey.sh`, so `bun run dev` works without a backend process on the laptop; use `BACKEND_ORIGIN=http://127.0.0.1:7656 bun run dev` to target one locally. The production Bun server gets its co-located loopback default from the image and can be overridden through `hezarfen_frontend.env` (see "Run in a container" below). | |
| 55 | - | |
| 56 | -> **Dev auto sign-in**: for local testing, put `VITE_DEV_AUTOLOGIN_USERNAME` and `VITE_DEV_AUTOLOGIN_PASSWORD` (optionally `VITE_DEV_AUTOLOGIN_SCHOOL`, a school uuid) in `.env.local`, which git ignores. `bun run dev` then signs in on the first `401`; logging out turns it off for that tab. It lives in `src/lib/dev-auto-login.ts` behind `import.meta.env.DEV`, so `vite build` drops it and the credentials never reach `dist/`. | |
| 57 | - | |
| 58 | -> **Demo sign-in**: set `VITE_DEMO_LOGIN_USERNAME` and `VITE_DEMO_LOGIN_PASSWORD` at build time and the login page opens filled with them, plus a one-click "Demo hesabıyla gir" button (`src/lib/demo-login.ts`). Unlike the dev auto sign-in these values are bundled into `dist/`, so set them only for a demo school's build. | |
| 59 | - | |
| 60 | ---- | |
| 61 | - | |
| 62 | -## 🐳 Run in a container (podman) | |
| 14 | +Open <http://localhost:5173>. Vite proxies `/api/*` and WebSocket traffic to `https://hezarfen-backend.dizey.sh` by default. To use a local backend: | |
| 63 | 15 | |
| 64 | 16 | ```bash |
| 65 | -podman compose up -d --build # build + start, http://127.0.0.1:5173 | |
| 66 | -podman compose logs -f frontend | |
| 67 | -podman compose down # stop | |
| 17 | +BACKEND_ORIGIN=http://127.0.0.1:7656 bun run dev | |
| 68 | 18 | ``` |
| 69 | 19 | |
| 70 | -The `Containerfile` is a two-stage build: `bun install --frozen-lockfile` plus `bun run build` produce `dist/`, and `oven/bun:1-slim` serves it with `server.ts` — which also reverse-proxies `/api/*` (plain HTTP and the exam-room WebSocket) to `BACKEND_ORIGIN`. No nginx, no node_modules at runtime, no state: one container and no volumes. It runs with `network_mode: host`, so it shares the host's loopback and reaches a backend published on `127.0.0.1:7656` exactly as a host process would (a bridge network would resolve `127.0.0.1` to the container itself). Host networking means no port mapping: the app binds the host's interface directly, so set `HOST=127.0.0.1` and let the reverse proxy on the same loopback be the only door. | |
| 71 | - | |
| 72 | -**Knobs live in two places and are never mixed.** The defaults are written once, in the image's `ENV` block (`Containerfile`) — `BACKEND_ORIGIN`, `HOST`, `PORT` — and nothing else in the repo repeats them: `server.ts` reads all three and refuses to boot without them, the compose healthcheck asks the container for `PORT`, and the deploy reads the port back out of the running container. A laptop needs no extra files. On a server the operator copies `deploy/hezarfen_frontend.env.example` to `$HOME/hezarfen_frontend/hezarfen_frontend.env`, `chmod 0600` it and edits it — nothing automated creates, overwrites or uploads that file. The service declares it as `env_file:`, so **every key it carries overrides the image default with no extra flag**; nothing is interpolated from it, and the only compose-level variable is `HEZARFEN_TAG`, which the deploy owns in `stack.env`. | |
| 20 | +The proxy keeps browser requests and session cookies on the frontend origin. A backend account is needed for authenticated pages. For local testing, `.env.local` can hold `VITE_DEV_AUTOLOGIN_USERNAME` and `VITE_DEV_AUTOLOGIN_PASSWORD`, plus optional `VITE_DEV_AUTOLOGIN_SCHOOL`. Dev auto sign-in runs only in Vite development mode. `VITE_DEMO_LOGIN_USERNAME` and `VITE_DEMO_LOGIN_PASSWORD` instead prefill the demo login at build time; those values **are included in the built bundle**, so use only demo credentials. | |
| 73 | 21 | |
| 74 | -Environment values are read when the container **starts**: after editing the file, recreate (`podman compose up -d`, or `systemctl --user restart hezarfen_frontend_compose`). `podman restart` keeps the old environment. | |
| 75 | - | |
| 76 | -`deploy/hezarfen_frontend_compose.service` is a systemd **user** unit that brings the stack up at boot: | |
| 22 | +### Checks | |
| 77 | 23 | |
| 78 | 24 | ```bash |
| 79 | -podman compose --env-file ~/hezarfen_frontend/hezarfen_frontend.env \ | |
| 80 | - --env-file ~/hezarfen_frontend/stack.env up -d --no-build | |
| 25 | +bun run check # TypeScript | |
| 26 | +bun run test # Vitest unit tests | |
| 27 | +bun run build # TypeScript + production bundle | |
| 28 | +bun run test:e2e # Playwright; starts Vite and requires a live backend | |
| 29 | +bun run test:contract # Live API contract tests; requires CONTRACT_BASE_URL | |
| 81 | 30 | ``` |
| 82 | 31 | |
| 83 | -`--env-file` feeds both compose's interpolation and — through `env_file:` — the container; the second file is compose-owned and carries `HEZARFEN_TAG` (a later `--env-file` wins for duplicate keys). Because the unit passes `--no-build`, the image must already exist on the host (`podman compose build`, or `podman load` of a tarball shipped from elsewhere). After an env change: `systemctl --user restart hezarfen_frontend_compose`. | |
| 84 | - | |
| 85 | -Deploying is GitHub Actions' job, not the server's. `.github/workflows/main.yml` typechecks (`tsc --noEmit`, its own runner, parallel with the rest), runs the vitest suite, builds the SPA, builds the repo `Containerfile`'s image (the same one a laptop builds — its `ENV` block is the single source of the deployment defaults), and ships the image tarball together with `compose.yaml`, the `hezarfen_frontend_compose.service` unit and a `tag` file as the run's artifact. The deploy job loads that image on the server and starts the stack with `podman compose up -d --no-build`; the tag travels in a deploy-owned `stack.env`, so a release never rewrites the operator's knobs file. A health gate protects the swap: the new container must serve the SPA shell and must be *this* build's image, otherwise the deploy rolls back to `previous_tag` (and on a first deploy stops the stack instead). The operator's only manual step is writing the env file once (above). | |
| 86 | - | |
| 87 | -It needs three repository secrets — `SSH_PRIVATE_KEY`, `SSH_HOST`, `SSH_USER`, the same three names the backend deploy uses — plus `loginctl enable-linger` for the deploy user. `workflow_dispatch` (Actions → Run workflow, or `gh workflow run main.yml --ref main`) redeploys the newest green build without re-running the suite, which is the door to use when only the server side changed. | |
| 32 | +The Playwright and live contract suites are local, on-demand checks. The push workflow runs typechecking, unit tests, and the production build. | |
| 88 | 33 | |
| 89 | ---- | |
| 34 | +## Application map | |
| 90 | 35 | |
| 91 | -## 👥 Role Scope Matrix | |
| 36 | +| Area | Routes | Purpose | | |
| 37 | +| --- | --- | --- | | |
| 38 | +| Home and account | `/`, `/profile/me`, `/guide` | Status dashboard, profile, and in-app guide. | | |
| 39 | +| Learning | `/courses`, `/courses/$id`, `/instances/$id`, `/homework`, `/exams`, `/notes`, `/whiteboards` | Catalog courses, class-specific course instances, assignments, exams, notes, and boards. | | |
| 40 | +| Questions and AI | `/questions`, `/question-bank`, `/ai/studio`, `/ai/study`, `/ai/insights` | Community questions, staff question bank, AI note studio, study assistant, and insights. | | |
| 41 | +| School life | `/calendar`, `/events`, `/appointments`, `/meals`, `/messages` | Calendar, events, appointments, meal menus, and messages. | | |
| 42 | +| Personal progress | `/marks`, `/pomodoro`, `/payments` | Student marks and focus sessions; parent payment statements. | | |
| 43 | +| School management | `/management/classes`, `/management/students`, `/management/teachers`, `/management/student-attendance`, `/management/student-marks`, `/management/pomodoros` | Classes, rosters, and student progress. | | |
| 44 | +| Administration | `/management/academic-years`, `/management/terms`, `/management/holidays`, `/management/staff-work`, `/management/settings`, `/management/payments`, `/admin/users` | Academic calendar, staff work, settings, payments, and users. | | |
| 92 | 45 | |
| 93 | -`student < teacher < manager < admin` — Higher roles inherit lower capabilities. Public registration creates a `student`. | |
| 46 | +There are separate `parent`, `student`, `teacher`, `manager`, and `admin` experiences, plus a platform builder session under `/builder`. Pages and data are scoped by role and enabled school modules. See [the sitemap](docs/frontend/sitemap.md) for the complete route and access map. | |
| 94 | 47 | |
| 95 | -| Role | Access & Capabilities | | |
| 96 | -|---|---| | |
| 97 | -| **Student (`student`)** | Personal notebook, PDF import, drawing canvas, enrolled courses, live exam room, question bank, pomodoro focus log, personal report card & attendance history. | | |
| 98 | -| **Teacher (`teacher`)** | Course/study creation, student enrollment, lesson session roll call, exam question authoring, live exam monitoring, answer sheet grading, and solution verification. | | |
| 99 | -| **Manager (`manager`)** | Academic settings, term definitions, attendance reports, global course/exam oversight, and staff work logs. | | |
| 100 | -| **Admin (`admin`)** | Global management scope across all users, role assignments, system policies, settings, and terms. | | |
| 48 | +A course at `/courses/$id` is a catalog record. An instance at `/instances/$id` attaches that course to a class and owns its enrollment, sessions, homework, exams, and roll call. Keep that distinction when extending API calls or UI. | |
| 101 | 49 | |
| 102 | ---- | |
| 50 | +## Code layout | |
| 103 | 51 | |
| 104 | -## 🗺️ Page Routes & System Navigation | |
| 52 | +| Path | Contents | | |
| 53 | +| --- | --- | | |
| 54 | +| `src/api/` | Domain-based API functions and endpoint tests. Pages use this layer rather than calling `fetch` directly. | | |
| 55 | +| `src/components/` | Shared UI, layout, and domain components, including side panels. | | |
| 56 | +| `src/pages/` | Page components, loaded lazily by the router. | | |
| 57 | +| `src/routes/router.tsx` | Route definitions and redirects. | | |
| 58 | +| `src/i18n/` | Turkish and English messages. | | |
| 59 | +| `src/stores/` | Shared SolidJS contexts. | | |
| 60 | +| `docs/` | Product, UI, auth, frontend, and backend notes. | | |
| 105 | 61 | |
| 106 | -| Path | Access Scope | Description | | |
| 107 | -|---|---|---| | |
| 108 | -| `/login`, `/register` | Guests | Authentication with same-origin cookie management. | | |
| 109 | -| `/` | Authenticated | Read-only observation dashboard with role-scoped portal cards, attention items, and upcoming events. | | |
| 110 | -| `/guide` | Authenticated | Redesigned product guide featuring role scope matrix, 6 core feature cards, and pro tips. | | |
| 111 | -| `/profile` | Authenticated | User profile management (display name, email, phone, birth date). | | |
| 112 | -| `/notes` | Student+ | Personal notebook with paper-style cards, Note Import Assistant (PDF/TXT), reader drawer, file attachments, and `.hzdraw` live canvas. | | |
| 113 | -| `/ai` | Authenticated | AI hub: the note studio (course-note AI outputs plus narrated podcast audio with live job progress, cancellation and playback), the ZEKA analysis board, and the Çelebi entry point. `/sound-studio` redirects to its note-studio tab. | | |
| 114 | -| `/questions`, `/questions/:id` | Student+ | Community Question Bank with solution authoring and teacher verification. | | |
| 115 | -| `/courses`, `/courses/:id` | Student+ | Course catalog, student enrollment, curriculum subjects, homework assignments, and lesson session roll call. | | |
| 116 | -| `/exams`, `/exams/:id` | Student+ | Exam list and details, subject-tagged questions, draft/publish controls, and grading statistics. | | |
| 117 | -| `/exam-room/:id` | Student+ | WebSocket real-time exam room with autosave, server timer (`/time`), and automatic turn-in on expiry. | | |
| 118 | -| `/exams/:id/live` | Teacher+ | Live exam monitor over SSE/polling with answer sheets, auto-score suggestions, and inline grading. | | |
| 119 | -| `/events`, `/events/:id` | Student+ | Campus event list and detail views with search filters and attendance roster. | | |
| 120 | -| `/calendar` | Student+ | Full calendar view with sky-blue container, event & exam markers, and day detail inspection. | | |
| 121 | -| `/marks` | Student+ | Report card with weighted exam average calculations and course breakdown. | | |
| 122 | -| `/messages` | Student+ | Messaging portal with folder navigation, unread badges, and micro-animations. | | |
| 123 | -| `/pomodoro` | Student | Student focus log with server-stamped session tracking. | | |
| 124 | -| `/admin/users` | Admin | User account administration and role assignment. | | |
| 62 | +SolidJS components execute once. Use signals and memos for reactive state; do not assume React-style rerenders. Repository conventions and area-specific skills are listed in [AGENTS.md](AGENTS.md). | |
| 125 | 63 | |
| 126 | ---- | |
| 64 | +## Container and deployment | |
| 127 | 65 | |
| 128 | -## 🎨 UI/UX Design System Tokens | |
| 66 | +Use Podman: | |
| 129 | 67 | |
| 130 | -- **Data Shell Surface**: Subtle sky-blue background container (`border-sky-500/15 bg-sky-500/[0.025]`) used across data-heavy views for visual cohesion. | |
| 131 | -- **Domain Accent Colors**: Centralized single source of truth (`src/lib/domain-colors.ts`) mapping domain colors exclusively to hairline borders and ring highlights (amber for Notes, violet for Messages, rose for Exams, emerald for Events, sky for Courses, cyan for Questions, teal for Marks). | |
| 132 | -- **Tab Indicators**: Recessed list tracks, stationary pill triggers, halo ring glow outlines, and alternating accent lines. | |
| 133 | -- **Button Styling**: Çelebi-themed translucent fill (`bg-primary/15`), hairline borders, and subtle rings (`ring-1 ring-primary/25`). | |
| 134 | -- **Invisible Scrollbars**: Functional scrolling without visible scrollbar clutter across all browsers (`scrollbar-width: none`). | |
| 135 | - | |
| 136 | ---- | |
| 137 | - | |
| 138 | -## 📁 Project Directory Structure | |
| 139 | - | |
| 140 | -``` | |
| 141 | -src/ | |
| 142 | -├── api/ # Endpoint functions organized by domain (notes, exams, courses, etc.) | |
| 143 | -│ └── __tests__/ # Vitest endpoint tests (100% API coverage) | |
| 144 | -├── components/ # Domain & UI components | |
| 145 | -│ ├── exams/ # Exam cards, forms, live monitor, WS room | |
| 146 | -│ ├── layout/ # AppShell, PageHeader, Sidebar, RouteGuard | |
| 147 | -│ ├── notes/ # Note cards, reader panel, file attachment manager | |
| 148 | -│ ├── ui/ # Design system (Button, Badge, DataTable, SidePanel, Tabs, etc.) | |
| 149 | -│ └── users/ # User search, profile form, admin user table | |
| 150 | -├── i18n/ # Localization dictionaries (TR / EN) and MessageKey types | |
| 151 | -├── lib/ # Shared utilities (domain-colors, note-importer, stroke-smoothing, etc.) | |
| 152 | -├── pages/ # Lazy-loaded page components for TanStack Router | |
| 153 | -├── routes/ # TanStack Router route tree definition | |
| 154 | -└── stores/ # Cross-cutting contexts (AuthContext, PreferencesContext) | |
| 68 | +```bash | |
| 69 | +podman compose up -d --build | |
| 70 | +podman compose logs -f frontend | |
| 71 | +podman compose down | |
| 155 | 72 | ``` |
| 156 | 73 | |
| 157 | ---- | |
| 74 | +The `Containerfile` builds the app with Bun, then `server.ts` serves `dist/` and proxies `/api/*`, including the exam-room WebSocket. `compose.yaml` uses host networking. The image defines defaults for `BACKEND_ORIGIN`, `HOST`, and `PORT`; production overrides them with an operator-owned `~/hezarfen_frontend/hezarfen_frontend.env` created from `deploy/hezarfen_frontend.env.example`. Set `HOST=127.0.0.1` when a reverse proxy on the same server is the public entry point. Keep the env file private with mode `0600`. | |
| 75 | + | |
| 76 | +The systemd user unit at `deploy/hezarfen_frontend_compose.service` starts the stack. After changing its env file, recreate the container with `systemctl --user restart hezarfen_frontend_compose` so it reads the new values. A plain `podman restart` retains the old environment. | |
| 158 | 77 | |
| 159 | -## 📜 Commit & Quality Workflow | |
| 78 | +On pushes to `main`, `.github/workflows/main.yml` checks, tests, builds, and deploys an image over SSH, then verifies the new container. It requires repository secrets `SSH_PRIVATE_KEY`, `SSH_HOST`, and `SSH_USER`, plus Podman and a compose provider on the server. The operator creates the production env file once; the workflow does not overwrite it. `workflow_dispatch` redeploys the latest successful build artifact. | |
| 160 | 79 | |
| 161 | -All contributions adhere to the strict repository rulebook (`AGENTS.md`): | |
| 80 | +## Contributing | |
| 162 | 81 | |
| 163 | -1. **Pre-commit Check**: `bun run test` (35 test files, 238 tests) and `bun run build` (`tsc --noEmit && vite build`) must pass green before committing. | |
| 164 | -2. **Conventional Commits**: Format `type: emoji short summary` with technical bullet details written in English. | |
| 82 | +Keep changes reviewable and use Bun for JavaScript and TypeScript tooling. Before a commit, run `bun run build`; run relevant tests for behavior changes. Commit messages use the repository's `type: emoji short summary` format with English details. See [AGENTS.md](AGENTS.md) and the `commit-workflow` skill for the full rules. |
docs/backend/live-list-filter-drift-2026-09-25.mdadded+16 -0
| @@ -0,0 +1,16 @@ | ||
| 1 | +# Live list filter drift — 2026-09-25 | |
| 2 | + | |
| 3 | +This note records behavior observed against the authenticated live backend on | |
| 4 | +2026-09-25. It describes that deployment, not a permanent API guarantee. | |
| 5 | + | |
| 6 | +| List | Request / observation | Contract impact | | |
| 7 | +|---|---|---| | |
| 8 | +| `GET /courses` | `?limit=5&offset=0&q=zzzx-no-such-course` returned HTTP 200, `total=10`, and five ordinary courses. | `q` was ignored in this check; frontend search and pagination cannot be trusted to reflect the query. | | |
| 9 | +| `GET /courses` | A `taught=false` request still returned taught courses. | The taught filter was ignored in this check. | | |
| 10 | +| `GET /homework` | A `due_before` request used by the Past tab still returned future deadlines. | The Past tab did not filter as requested. | | |
| 11 | + | |
| 12 | +The live OpenAPI document currently lists `limit` and `offset` for these list | |
| 13 | +routes, but does not list the filters above. Frontend API helpers send them; | |
| 14 | +their presence in frontend code does not establish backend support. Verify the | |
| 15 | +deployed response and OpenAPI document again after a backend update. Do not | |
| 16 | +infer the status of other filters from these observations. |
docs/frontend/frontend-next-steps.mdmodified+15 -2
| @@ -66,8 +66,13 @@ Active backend/class/meals alignment is tracked in: | ||
| 66 | 66 | - Main lists use real server paging (`limit`/`offset` + `total`) when no client-only filter is active: |
| 67 | 67 | - exams and events (hybrid: full fetch only while client-only filters need it) |
| 68 | 68 | - notes, terms, work log, admin users (server page; admin metrics still load full list once) |
| 69 | -- Courses temporarily load the visible list once and filter/paginate locally because | |
| 70 | - backend course filters remain a documented prerequisite. | |
| 69 | +- Courses now request server pages with `kind`, `q`, and `taught`; the current | |
| 70 | + deployment does not honor at least `q` and `taught=false`, so the list can | |
| 71 | + show unfiltered rows or misleading page counts until the backend is fixed. | |
| 72 | +- Homework requests `due_after`, `due_before`, and `class_course` for its tabs | |
| 73 | + and section picker. The current deployment ignores at least `due_before`, | |
| 74 | + so the Past tab can include future deadlines. See | |
| 75 | + `docs/backend/live-list-filter-drift-2026-09-25.md` for observed requests. | |
| 71 | 76 | - Nested/deferred lists unwrap full `.items` (sessions, enrollments, attendance, exam results/questions). |
| 72 | 77 | - `/exams/:id/live`: client-paginated roster over snapshot/SSE (not the list envelope). |
| 73 | 78 | - Progress Report card and Attendance tabs: not paged; aggregate report shapes. |
| @@ -111,6 +116,14 @@ Active backend/class/meals alignment is tracked in: | ||
| 111 | 116 | linked and included in deadlines for every role. |
| 112 | 117 | - Terms page: SidePanel create/edit + dense table row actions; header create buttons use shared min-width/radius. |
| 113 | 118 | - Settings: dirty-state save gate and auto-clearing success message. |
| 119 | +- Settings: comma-separated branch and excuse-kind fields round-trip as lists; | |
| 120 | + a fixed save bar appears while there are unsaved changes, with a leave guard. | |
| 121 | +- Staff work: the staff card grid has a separated pagination row and record | |
| 122 | + range; opening a card keeps the selected person's work log in a side panel. | |
| 123 | +- Meals: week and slot controls lead into a seven-day picker. Selecting a day | |
| 124 | + shows its menus or an explicit empty-day state; publish remains a side panel. | |
| 125 | +- Homework: the section picker tolerates asynchronous option loading without | |
| 126 | + crashing while the list or panel mounts. | |
| 114 | 127 | - Nested breadcrumbs on exam room and live monitor. |
| 115 | 128 | |
| 116 | 129 | ### UX batch (2026-07, observation UI + feedback) |
src/components/appointments/publish-slots-form.tsxmodified+2 -2
| @@ -93,7 +93,7 @@ export function PublishSlotsForm(props: { | ||
| 93 | 93 | placeholder="09:00" |
| 94 | 94 | pattern="[0-2][0-9]:[0-5][0-9]" |
| 95 | 95 | value={startsTime()} |
| 96 | - aria-label={t("appointments.starts")} | |
| 96 | + aria-label={t("appointments.startTime")} | |
| 97 | 97 | onInput={(e) => setStartsTime(e.currentTarget.value)} |
| 98 | 98 | /> |
| 99 | 99 | </div> |
| @@ -109,7 +109,7 @@ export function PublishSlotsForm(props: { | ||
| 109 | 109 | placeholder="10:00" |
| 110 | 110 | pattern="[0-2][0-9]:[0-5][0-9]" |
| 111 | 111 | value={endsTime()} |
| 112 | - aria-label={t("appointments.ends")} | |
| 112 | + aria-label={t("appointments.endTime")} | |
| 113 | 113 | onInput={(e) => setEndsTime(e.currentTarget.value)} |
| 114 | 114 | /> |
| 115 | 115 | </div> |
src/components/appointments/reschedule-form.tsxmodified+2 -2
| @@ -61,7 +61,7 @@ export function RescheduleForm(props: { | ||
| 61 | 61 | placeholder="09:00" |
| 62 | 62 | pattern="[0-2][0-9]:[0-5][0-9]" |
| 63 | 63 | value={startsTime()} |
| 64 | - aria-label={t("appointments.starts")} | |
| 64 | + aria-label={t("appointments.startTime")} | |
| 65 | 65 | onInput={(e) => setStartsTime(e.currentTarget.value)} |
| 66 | 66 | /> |
| 67 | 67 | </div> |
| @@ -77,7 +77,7 @@ export function RescheduleForm(props: { | ||
| 77 | 77 | placeholder="10:00" |
| 78 | 78 | pattern="[0-2][0-9]:[0-5][0-9]" |
| 79 | 79 | value={endsTime()} |
| 80 | - aria-label={t("appointments.ends")} | |
| 80 | + aria-label={t("appointments.endTime")} | |
| 81 | 81 | onInput={(e) => setEndsTime(e.currentTarget.value)} |
| 82 | 82 | /> |
| 83 | 83 | </div> |
src/components/meals/meal-day-group.tsxmodified+11 -5
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import { For, Show } from "solid-js"; |
| 2 | 2 | import type { MealMenu } from "@/api/client"; |
| 3 | 3 | import { Badge } from "@/components/ui/badge"; |
| 4 | +import { EmptyInline } from "@/components/ui/empty-inline"; | |
| 4 | 5 | import { MealMenuRow } from "@/components/meals/meal-menu-row"; |
| 5 | 6 | import { formatMealDay } from "@/lib/meals"; |
| 6 | 7 | import { useT } from "@/stores/preferences-context"; |
| @@ -19,11 +20,16 @@ export function MealDayGroup(props: { | ||
| 19 | 20 | <span class="first-letter:uppercase">{formatMealDay(props.date, props.locale)}</span> |
| 20 | 21 | <Show when={props.isToday}><Badge variant="info">{t("meals.today")}</Badge></Show> |
| 21 | 22 | </h3> |
| 22 | - <div class="divide-y divide-border-hairline overflow-hidden rounded-xl border border-border-line"> | |
| 23 | - <For each={props.menus}> | |
| 24 | - {(menu) => <MealMenuRow menu={menu} locale={props.locale} />} | |
| 25 | - </For> | |
| 26 | - </div> | |
| 23 | + <Show | |
| 24 | + when={props.menus.length > 0} | |
| 25 | + fallback={<EmptyInline illustration="meals" title={t("meals.emptyDay")} hint={t("meals.emptyDayHint")} class="rounded-xl border border-border-line bg-surface-tint/40 py-8" />} | |
| 26 | + > | |
| 27 | + <div class="divide-y divide-border-hairline overflow-hidden rounded-xl border border-border-line"> | |
| 28 | + <For each={props.menus}> | |
| 29 | + {(menu) => <MealMenuRow menu={menu} locale={props.locale} />} | |
| 30 | + </For> | |
| 31 | + </div> | |
| 32 | + </Show> | |
| 27 | 33 | </section> |
| 28 | 34 | ); |
| 29 | 35 | } |
src/components/meals/meal-day-picker.tsxadded+46 -0
| @@ -0,0 +1,46 @@ | ||
| 1 | +import { For } from "solid-js"; | |
| 2 | +import type { MealMenu } from "@/api/client"; | |
| 3 | +import { cn } from "@/lib/cn"; | |
| 4 | +import { addDaysIso, formatMealDay } from "@/lib/meals"; | |
| 5 | +import { useT } from "@/stores/preferences-context"; | |
| 6 | + | |
| 7 | +/** All seven days stay visible, including days with no published menu. */ | |
| 8 | +export function MealDayPicker(props: { | |
| 9 | + weekStart: string; | |
| 10 | + selectedDate: string; | |
| 11 | + locale: string; | |
| 12 | + days: { date: string; menus: MealMenu[] }[]; | |
| 13 | + onSelect: (date: string) => void; | |
| 14 | +}) { | |
| 15 | + const t = useT(); | |
| 16 | + const dates = () => Array.from({ length: 7 }, (_, index) => addDaysIso(props.weekStart, index)); | |
| 17 | + const count = (date: string) => props.days.find((day) => day.date === date)?.menus.length ?? 0; | |
| 18 | + const weekday = (date: string) => new Intl.DateTimeFormat(props.locale, { weekday: "short", timeZone: "UTC" }).format(new Date(`${date}T00:00:00Z`)); | |
| 19 | + | |
| 20 | + return ( | |
| 21 | + <nav aria-label={t("meals.weekDays")} class="-mx-4 overflow-x-auto px-4 pb-1"> | |
| 22 | + <div class="flex min-w-max gap-2 sm:min-w-0"> | |
| 23 | + <For each={dates()}> | |
| 24 | + {(date) => ( | |
| 25 | + <button | |
| 26 | + type="button" | |
| 27 | + aria-pressed={date === props.selectedDate} | |
| 28 | + aria-label={`${formatMealDay(date, props.locale)} · ${t("meals.menuCount", { count: count(date) })}`} | |
| 29 | + onClick={() => props.onSelect(date)} | |
| 30 | + class={cn( | |
| 31 | + "flex min-h-20 min-w-16 flex-1 flex-col items-center justify-center rounded-lg border px-2 py-2 text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", | |
| 32 | + date === props.selectedDate | |
| 33 | + ? "border-primary bg-primary/10 text-foreground" | |
| 34 | + : "border-border-line bg-card text-muted-foreground hover:border-border hover:bg-surface-tint", | |
| 35 | + )} | |
| 36 | + > | |
| 37 | + <span class="text-xs font-medium uppercase">{weekday(date)}</span> | |
| 38 | + <span class="mt-0.5 text-lg font-semibold tabular-nums text-foreground">{Number(date.slice(-2))}</span> | |
| 39 | + <span class={cn("mt-1 h-1.5 w-1.5 rounded-full", count(date) > 0 ? "bg-primary" : "bg-border-line")} aria-hidden="true" /> | |
| 40 | + </button> | |
| 41 | + )} | |
| 42 | + </For> | |
| 43 | + </div> | |
| 44 | + </nav> | |
| 45 | + ); | |
| 46 | +} |
src/components/meals/meal-menu-row.tsxmodified+10 -9
| @@ -20,22 +20,23 @@ export function MealMenuRow(props: { menu: MealMenu; locale: string }) { | ||
| 20 | 20 | <Link |
| 21 | 21 | to="/meals/$id" |
| 22 | 22 | params={{ id: props.menu.id }} |
| 23 | - class="group grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 gap-y-1 px-4 py-3 transition-colors hover:bg-surface-tint focus-visible:bg-surface-tint focus-visible:outline-none sm:grid-cols-[9rem_minmax(0,1fr)_7rem_6rem_1rem]" | |
| 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" | |
| 24 | 24 | > |
| 25 | - <span class="col-start-1 row-start-1 truncate font-medium 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 flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground sm:col-span-1 sm:col-start-auto sm:row-start-auto"> | |
| 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"> | |
| 27 | + <span class="block leading-relaxed">{dishes() || t("meals.noDishes")}</span> | |
| 27 | 28 | <Show when={conflicts().length > 0}> |
| 28 | - <span class="shrink-0 text-warning-text" title={`${t("meals.conflict")}: ${conflicts().map((tag) => dietaryTagLabel(tag, t)).join(", ")}`}> | |
| 29 | - <IconAlert class="h-4 w-4" /> | |
| 29 | + <span class="mt-1 flex items-start gap-1 text-xs text-warning-text"> | |
| 30 | + <IconAlert class="mt-0.5 h-3.5 w-3.5 shrink-0" /> | |
| 31 | + {t("meals.conflict")}: {conflicts().map((tag) => dietaryTagLabel(tag, t)).join(", ")} | |
| 30 | 32 | </span> |
| 31 | 33 | </Show> |
| 32 | - <span class="truncate">{dishes() || t("meals.noDishes")}</span> | |
| 33 | 34 | </span> |
| 34 | - <span class="hidden text-right text-xs text-muted-foreground tabular-nums sm:block"> | |
| 35 | + <span class="col-start-1 row-start-3 text-xs text-muted-foreground tabular-nums sm:col-start-auto sm:row-start-auto sm:text-right"> | |
| 35 | 36 | {t("meals.capacity")} {capacity()} |
| 36 | 37 | </span> |
| 37 | - <span class="col-start-2 row-start-1 text-right font-medium tabular-nums sm:col-start-auto sm:row-start-auto">{formatTry(total(), props.locale)}</span> | |
| 38 | - <IconChevronRight class="hidden h-4 w-4 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 sm:block" /> | |
| 38 | + <span class="col-start-2 row-start-1 text-right font-semibold tabular-nums sm:col-start-auto sm:row-start-auto">{formatTry(total(), props.locale)}</span> | |
| 39 | + <IconChevronRight class="col-start-2 row-start-3 ml-auto h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 sm:hidden" /> | |
| 39 | 40 | </Link> |
| 40 | 41 | ); |
| 41 | 42 | } |
src/components/meals/meal-week-nav.tsxmodified+2 -2
| @@ -15,7 +15,7 @@ export function MealWeekNav(props: { | ||
| 15 | 15 | locale: string; |
| 16 | 16 | slot: string; |
| 17 | 17 | slots: MealSlot[]; |
| 18 | - onWeekChange: (weekStart: string) => void; | |
| 18 | + onWeekChange: (weekStart: string, selectedDate?: string) => void; | |
| 19 | 19 | onSlotChange: (slot: string) => void; |
| 20 | 20 | }) { |
| 21 | 21 | const t = useT(); |
| @@ -39,7 +39,7 @@ export function MealWeekNav(props: { | ||
| 39 | 39 | class="h-8 w-40" |
| 40 | 40 | placeholder={t("meals.goToDate")} |
| 41 | 41 | value="" |
| 42 | - onChange={(value) => { const iso = inputDateToIso(value); if (iso) props.onWeekChange(weekStartIso(iso)); }} | |
| 42 | + onChange={(value) => { const iso = inputDateToIso(value); if (iso) props.onWeekChange(weekStartIso(iso), iso); }} | |
| 43 | 43 | /> |
| 44 | 44 | <Select id="menus-slot" aria-label={t("meals.slot")} wrapperClass="w-auto" class="h-8 rounded-lg text-[13px]" value={props.slot} onChange={(e) => props.onSlotChange(e.currentTarget.value)}> |
| 45 | 45 | <option value="all">{t("meals.slot")}: {t("common.all")}</option> |
src/components/ui/data-table-search.tsxmodified+1 -1
| @@ -68,7 +68,7 @@ export function DataTableSearch(props: DataTableSearchProps) { | ||
| 68 | 68 | <Show when={props.hint && focused()}> |
| 69 | 69 | <p |
| 70 | 70 | id={hintId} |
| 71 | - class={cn("absolute left-0 top-full z-30 mt-1 w-full min-w-max max-w-[22rem] rounded-lg border border-border/80 bg-popover px-2.5 py-1.5 text-[11px] leading-snug text-muted-foreground shadow-md", props.hintClass)} | |
| 71 | + class={cn("pointer-events-none absolute bottom-full left-0 z-30 mb-1 w-full min-w-max max-w-[22rem] rounded-lg border border-border/80 bg-popover px-2.5 py-1.5 text-[11px] leading-snug text-muted-foreground shadow-md sm:bottom-auto sm:top-full sm:mb-0 sm:mt-1", props.hintClass)} | |
| 72 | 72 | > |
| 73 | 73 | {props.hint} |
| 74 | 74 | </p> |
src/i18n/locales/en.tsmodified+19 -12
| @@ -1341,6 +1341,7 @@ export const en: Dict = { | ||
| 1341 | 1341 | "calendar.title": "Calendar", |
| 1342 | 1342 | "calendar.feedsFailed": "Could not load: {feeds}. The calendar is missing those items.", |
| 1343 | 1343 | "calendar.today": "Today", |
| 1344 | + "calendar.weekScrollHint": "Swipe sideways to see the other days.", | |
| 1344 | 1345 | "calendar.month": "Month", |
| 1345 | 1346 | "calendar.year": "Year", |
| 1346 | 1347 | "calendar.noEvents": "Nothing scheduled on this day.", |
| @@ -1382,6 +1383,8 @@ export const en: Dict = { | ||
| 1382 | 1383 | "appointments.until": "Repeat until", |
| 1383 | 1384 | "appointments.starts": "Start", |
| 1384 | 1385 | "appointments.ends": "End", |
| 1386 | + "appointments.startTime": "Start time", | |
| 1387 | + "appointments.endTime": "End time", | |
| 1385 | 1388 | "appointments.teacher": "Teacher", |
| 1386 | 1389 | "appointments.student": "Requested by", |
| 1387 | 1390 | "appointments.proposedTime": "Proposed time", |
| @@ -1723,19 +1726,19 @@ export const en: Dict = { | ||
| 1723 | 1726 | "guide.modules.title": "Core flows and features", |
| 1724 | 1727 | "guide.modules.subtitle": "The platform's main modules and how each one is used.", |
| 1725 | 1728 | "guide.step.ai.badge": "AI", |
| 1726 | - "guide.step.ai.title": "Çelebi AI assistant", | |
| 1727 | - "guide.step.ai.description": "The assistant reachable from every page through “Ask Çelebi” in the top bar. It answers about your campus data, your course topics and the system itself.", | |
| 1728 | - "guide.step.ai.cta": "Try Çelebi", | |
| 1729 | - "guide.step.ai.f1": "One click from every page", | |
| 1730 | - "guide.step.ai.f2": "Campus and course-aware answers", | |
| 1731 | - "guide.step.ai.f3": "Contextual study guidance", | |
| 1729 | + "guide.step.ai.title": "Study with AI", | |
| 1730 | + "guide.step.ai.description": "Open your study chats in the AI Study area and work through course topics. For a quick question, use the Çelebi panel in the top bar.", | |
| 1731 | + "guide.step.ai.cta": "Open AI Study", | |
| 1732 | + "guide.step.ai.f1": "Find your study chats in one place", | |
| 1733 | + "guide.step.ai.f2": "Ask about course topics", | |
| 1734 | + "guide.step.ai.f3": "Open Çelebi from the top bar", | |
| 1732 | 1735 | "guide.step.notes.badge": "Notes and drawing", |
| 1733 | 1736 | "guide.step.notes.title": "Smart notebook and drawing canvas", |
| 1734 | - "guide.step.notes.description": "Turn PDF, TXT and Markdown material into clean Markdown notes. Add freehand sketches and diagrams with the built-in .hzdraw canvas.", | |
| 1737 | + "guide.step.notes.description": "Create a private note on the Notes page, import a PDF or TXT file, and make freehand drawings on the canvas.", | |
| 1735 | 1738 | "guide.step.notes.cta": "Go to notes", |
| 1736 | 1739 | "guide.step.notes.f1": "Automatic PDF and TXT converter", |
| 1737 | 1740 | "guide.step.notes.f2": "Built-in .hzdraw freehand canvas", |
| 1738 | - "guide.step.notes.f3": "Markdown formatting and an OCR warning", | |
| 1741 | + "guide.step.notes.f3": "Rich-text editor and OCR warning", | |
| 1739 | 1742 | "guide.step.questions.badge": "Question pool", |
| 1740 | 1743 | "guide.step.questions.title": "Question pool and solutions", |
| 1741 | 1744 | "guide.step.questions.description": "Share your questions in the community pool and add written or multiple-choice solutions. Teacher-approved solutions mark the answer to trust.", |
| @@ -1753,7 +1756,7 @@ export const en: Dict = { | ||
| 1753 | 1756 | "guide.step.exams.badge": "Exam room", |
| 1754 | 1757 | "guide.step.exams.title": "Exam room and live monitoring", |
| 1755 | 1758 | "guide.step.exams.description": "A live exam room with a countdown and autosave. Teachers follow answer sheets and instant marking suggestions from the live monitor.", |
| 1756 | - "guide.step.exams.cta": "Exam room", | |
| 1759 | + "guide.step.exams.cta": "View exams", | |
| 1757 | 1760 | "guide.step.exams.f1": "Countdown synced to the server clock", |
| 1758 | 1761 | "guide.step.exams.f2": "WebSocket and REST autosave", |
| 1759 | 1762 | "guide.step.exams.f3": "Live teacher monitoring and marking", |
| @@ -1771,7 +1774,7 @@ export const en: Dict = { | ||
| 1771 | 1774 | "guide.tips.sync.title": "Automatic saving", |
| 1772 | 1775 | "guide.tips.sync.body": "Your exam-room answers and canvas drafts are saved in the background against the server clock.", |
| 1773 | 1776 | "guide.tips.import.title": "Quick note import", |
| 1774 | - "guide.tips.import.body": "Use the import button on the notes page to turn PDF and TXT course documents into clean Markdown.", | |
| 1777 | + "guide.tips.import.body": "Use Import on the Notes page to create a note from a PDF or TXT file. Review the text before saving.", | |
| 1775 | 1778 | "guide.tips.weights.title": "Weighted marking", |
| 1776 | 1779 | "guide.tips.weights.body": "Exam results feed your report-card average using the exam-kind weights the school office defines.", |
| 1777 | 1780 | "guide.rolesTitle": "Who can do what?", |
| @@ -2032,7 +2035,7 @@ export const en: Dict = { | ||
| 2032 | 2035 | "course.removeStudentConfirm": "Are you sure you want to remove", |
| 2033 | 2036 | "events.userIdRequired": "Please select a student first.", |
| 2034 | 2037 | "settings.title": "School settings", |
| 2035 | - "settings.subtitle": "Configure exam types, attendance statuses, and grade bands used across the school.", | |
| 2038 | + "settings.subtitle": "Manage assessment, meal, and system policies for the school.", | |
| 2036 | 2039 | "settings.saved": "Settings saved.", |
| 2037 | 2040 | "settings.examKinds": "Exam kinds", |
| 2038 | 2041 | "settings.examKindsHelp": "Kinds and weights used in course averages.", |
| @@ -2147,6 +2150,10 @@ export const en: Dict = { | ||
| 2147 | 2150 | "meals.nextWeek": "Next week", |
| 2148 | 2151 | "meals.goToDate": "Go to date", |
| 2149 | 2152 | "meals.today": "Today", |
| 2153 | + "meals.weekDays": "Days of the week", | |
| 2154 | + "meals.menuCount": "{count} menus", | |
| 2155 | + "meals.emptyDay": "No menu published for this day.", | |
| 2156 | + "meals.emptyDayHint": "Choose another day or change the meal filter.", | |
| 2150 | 2157 | "meals.emptyWeek": "No menus published for this week.", |
| 2151 | 2158 | "meals.emptyWeekHint": "Switch to another week or clear the meal filter.", |
| 2152 | 2159 | "meals.unlimited": "Unlimited", |
| @@ -2371,7 +2378,7 @@ export const en: Dict = { | ||
| 2371 | 2378 | "search.hint.users": "Matches username, phone, name, e-mail, user id and role.", |
| 2372 | 2379 | "search.hint.exams": "Matches exam title, description, course, exam kind and status.", |
| 2373 | 2380 | "search.hint.events": "Matches event title, description, audience and date.", |
| 2374 | - "search.hint.courses": "Matches course title, description, creator, teacher and term.", | |
| 2381 | + "search.hint.courses": "Matches course title and description.", | |
| 2375 | 2382 | "search.hint.courseNotes": "Matches note title and content.", |
| 2376 | 2383 | "search.hint.classes": "Matches class name, grade and homeroom teacher.", |
| 2377 | 2384 | "search.hint.classMembers": "Matches student name, username and student number.", |
src/i18n/locales/tr.tsmodified+19 -12
| @@ -1337,6 +1337,7 @@ export const tr: Dict = { | ||
| 1337 | 1337 | "calendar.title": "Takvim", |
| 1338 | 1338 | "calendar.feedsFailed": "Yüklenemedi: {feeds}. Takvimde bu kayıtlar eksik.", |
| 1339 | 1339 | "calendar.today": "Bugün", |
| 1340 | + "calendar.weekScrollHint": "Diğer günleri görmek için yatay kaydırın.", | |
| 1340 | 1341 | "calendar.month": "Ay", |
| 1341 | 1342 | "calendar.year": "Yıl", |
| 1342 | 1343 | "calendar.noEvents": "Bu güne ait bir şey yok.", |
| @@ -1378,6 +1379,8 @@ export const tr: Dict = { | ||
| 1378 | 1379 | "appointments.until": "Şu tarihe kadar tekrarla", |
| 1379 | 1380 | "appointments.starts": "Başlangıç", |
| 1380 | 1381 | "appointments.ends": "Bitiş", |
| 1382 | + "appointments.startTime": "Başlangıç saati", | |
| 1383 | + "appointments.endTime": "Bitiş saati", | |
| 1381 | 1384 | "appointments.teacher": "Öğretmen", |
| 1382 | 1385 | "appointments.student": "Talep eden", |
| 1383 | 1386 | "appointments.proposedTime": "Önerilen saat", |
| @@ -1719,19 +1722,19 @@ export const tr: Dict = { | ||
| 1719 | 1722 | "guide.modules.title": "Temel akışlar ve özellikler", |
| 1720 | 1723 | "guide.modules.subtitle": "Hezarfen platformundaki ana modülleri ve kullanım adımlarını inceleyin.", |
| 1721 | 1724 | "guide.step.ai.badge": "Yapay zeka", |
| 1722 | - "guide.step.ai.title": "Çelebi AI asistanı", | |
| 1723 | - "guide.step.ai.description": "Tüm sayfalardan üst barda bulunan “Çelebi’ye Sor” butonuyla erişilebilir akıllı yapay zeka asistanı. Kampüs verileriniz, ders konularınız ve sistem hakkında anlık yanıtlar verir.", | |
| 1724 | - "guide.step.ai.cta": "Çelebi'yi dene", | |
| 1725 | - "guide.step.ai.f1": "Tüm sayfalardan tek tıkla erişim", | |
| 1726 | - "guide.step.ai.f2": "Kampüs ve ders odaklı yanıtlar", | |
| 1727 | - "guide.step.ai.f3": "Bağlamsal çalışma rehberliği", | |
| 1725 | + "guide.step.ai.title": "Yapay zekâ ile çalışma", | |
| 1726 | + "guide.step.ai.description": "Yapay Zekâ Çalışma alanında sohbetlerini açabilir ve ders konularını çalışabilirsin. Kısa sorular için üst çubuktaki Çelebi panelini kullan.", | |
| 1727 | + "guide.step.ai.cta": "Çalışma alanını aç", | |
| 1728 | + "guide.step.ai.f1": "Çalışma sohbetlerini tek yerde gör", | |
| 1729 | + "guide.step.ai.f2": "Ders konuları hakkında soru sor", | |
| 1730 | + "guide.step.ai.f3": "Çelebi paneline üst çubuktan eriş", | |
| 1728 | 1731 | "guide.step.notes.badge": "Notlar ve çizim", |
| 1729 | 1732 | "guide.step.notes.title": "Akıllı defter ve çizim tuvali", |
| 1730 | - "guide.step.notes.description": "PDF, TXT ve Markdown materyallerinizi temiz Markdown notlarına dönüştürün. Dahili .hzdraw tuvali ile derslerinize serbest el çizimleri ve grafikler ekleyin.", | |
| 1733 | + "guide.step.notes.description": "Notlar sayfasından yeni bir özel not aç, PDF veya TXT dosyası içe aktar ve çizim tuvalinde serbest çizimler oluştur.", | |
| 1731 | 1734 | "guide.step.notes.cta": "Notlara git", |
| 1732 | 1735 | "guide.step.notes.f1": "PDF ve TXT otomatik dönüştürücü", |
| 1733 | 1736 | "guide.step.notes.f2": "Dahili .hzdraw serbest çizim tuvali", |
| 1734 | - "guide.step.notes.f3": "Markdown biçimlendirme ve OCR uyarısı", | |
| 1737 | + "guide.step.notes.f3": "Zengin metin düzenleyici ve OCR uyarısı", | |
| 1735 | 1738 | "guide.step.questions.badge": "Soru havuzu", |
| 1736 | 1739 | "guide.step.questions.title": "Soru havuzu ve çözümler", |
| 1737 | 1740 | "guide.step.questions.description": "Topluluk soru havuzunda sorularınızı paylaşın, yazılı ve çoktan seçmeli çözümler ekleyin. Öğretmen onaylı çözümlerle ders konularında uzmanlaşın.", |
| @@ -1749,7 +1752,7 @@ export const tr: Dict = { | ||
| 1749 | 1752 | "guide.step.exams.badge": "Sınav odası", |
| 1750 | 1753 | "guide.step.exams.title": "Sınav odası ve canlı takip", |
| 1751 | 1754 | "guide.step.exams.description": "Geri sayım ve otomatik kaydetmeli canlı sınav odası. Öğretmenler canlı izleme panelinden yanıt kağıtlarını ve anlık puanlama önerilerini takip eder.", |
| 1752 | - "guide.step.exams.cta": "Sınav odası", | |
| 1755 | + "guide.step.exams.cta": "Sınavları gör", | |
| 1753 | 1756 | "guide.step.exams.f1": "Sunucu saati senkronize geri sayım", |
| 1754 | 1757 | "guide.step.exams.f2": "WebSocket ve REST otomatik kaydetme", |
| 1755 | 1758 | "guide.step.exams.f3": "Canlı öğretmen izleme ve puanlama", |
| @@ -1767,7 +1770,7 @@ export const tr: Dict = { | ||
| 1767 | 1770 | "guide.tips.sync.title": "Otomatik senkronizasyon", |
| 1768 | 1771 | "guide.tips.sync.body": "Sınav odasındaki yanıtlarınız ve çizim tuvalindeki taslaklarınız sunucu saatiyle arka planda güvenle kaydedilir.", |
| 1769 | 1772 | "guide.tips.import.title": "Hızlı not içe aktarma", |
| 1770 | - "guide.tips.import.body": "Notlar sayfasındaki içe aktar butonuyla PDF ve TXT ders dokümanlarınızı temiz Markdown metinlerine dönüştürebilirsiniz.", | |
| 1773 | + "guide.tips.import.body": "Notlar sayfasındaki içe aktar butonuyla PDF ve TXT dosyalarından yeni bir not oluşturabilirsiniz. Metni kaydetmeden önce gözden geçirin.", | |
| 1771 | 1774 | "guide.tips.weights.title": "Ağırlıklı not hesaplaması", |
| 1772 | 1775 | "guide.tips.weights.body": "Sınav sonuçlarınız, okul yönetiminin tanımladığı sınav türü ağırlıklarına göre doğrudan karne ortalamanıza yansıtılır.", |
| 1773 | 1776 | "guide.rolesTitle": "Kim ne yapabilir?", |
| @@ -2028,7 +2031,7 @@ export const tr: Dict = { | ||
| 2028 | 2031 | "course.removeStudentConfirm": "Bu öğrenciyi çıkarmak istediğine emin misin?", |
| 2029 | 2032 | "events.userIdRequired": "Önce bir öğrenci seçmelisin.", |
| 2030 | 2033 | "settings.title": "Okul ayarları", |
| 2031 | - "settings.subtitle": "Okul genelinde kullanılan sınav türlerini, yoklama durumlarını ve not bantlarını buradan yapılandırın.", | |
| 2034 | + "settings.subtitle": "Değerlendirme, yemekhane ve sistem kurallarını buradan yönetin.", | |
| 2032 | 2035 | "settings.saved": "Ayarlar kaydedildi.", |
| 2033 | 2036 | "settings.examKinds": "Sınav türleri", |
| 2034 | 2037 | "settings.examKindsHelp": "Ders ortalamalarında kullanılan tür ve ağırlıklar.", |
| @@ -2143,6 +2146,10 @@ export const tr: Dict = { | ||
| 2143 | 2146 | "meals.nextWeek": "Sonraki hafta", |
| 2144 | 2147 | "meals.goToDate": "Tarihe git", |
| 2145 | 2148 | "meals.today": "Bugün", |
| 2149 | + "meals.weekDays": "Haftanın günleri", | |
| 2150 | + "meals.menuCount": "{count} menü", | |
| 2151 | + "meals.emptyDay": "Bu gün için menü yayınlanmamış.", | |
| 2152 | + "meals.emptyDayHint": "Başka bir gün seçin veya öğün filtresini değiştirin.", | |
| 2146 | 2153 | "meals.emptyWeek": "Bu hafta için yayınlanmış menü yok.", |
| 2147 | 2154 | "meals.emptyWeekHint": "Başka bir haftaya geçin veya öğün filtresini kaldırın.", |
| 2148 | 2155 | "meals.unlimited": "Sınırsız", |
| @@ -2367,7 +2374,7 @@ export const tr: Dict = { | ||
| 2367 | 2374 | "search.hint.users": "Kullan\u0131c\u0131 ad\u0131, telefon, ad, e-posta, kullan\u0131c\u0131 ID'si ve rolde arar.", |
| 2368 | 2375 | "search.hint.exams": "S\u0131nav ad\u0131, a\u00e7\u0131klama, ders, s\u0131nav t\u00fcr\u00fc ve durumda arar.", |
| 2369 | 2376 | "search.hint.events": "Etkinlik ad\u0131, a\u00e7\u0131klama, kat\u0131l\u0131mc\u0131 kitlesi ve tarihte arar.", |
| 2370 | - "search.hint.courses": "Ders ad\u0131, a\u00e7\u0131klama, olu\u015fturan, \u00f6\u011fretmen ve d\u00f6nemde arar.", | |
| 2377 | + "search.hint.courses": "Ders ad\u0131 ve a\u00e7\u0131klamas\u0131nda arar.", | |
| 2371 | 2378 | "search.hint.courseNotes": "Not ba\u015fl\u0131\u011f\u0131 ve i\u00e7eri\u011finde arar.", |
| 2372 | 2379 | "search.hint.classes": "\u015eube ad\u0131, s\u0131n\u0131f d\u00fczeyi ve dan\u0131\u015fman \u00f6\u011fretmende arar.", |
| 2373 | 2380 | "search.hint.classMembers": "Öğrenci adı, kullanıcı adı ve öğrenci numarasında arar.", |
src/i18n/messages.tsmodified+7 -0
| @@ -2036,6 +2036,10 @@ export type MessageKey = | ||
| 2036 | 2036 | | "meals.nextWeek" |
| 2037 | 2037 | | "meals.goToDate" |
| 2038 | 2038 | | "meals.today" |
| 2039 | + | "meals.weekDays" | |
| 2040 | + | "meals.menuCount" | |
| 2041 | + | "meals.emptyDay" | |
| 2042 | + | "meals.emptyDayHint" | |
| 2039 | 2043 | | "meals.emptyWeek" |
| 2040 | 2044 | | "meals.emptyWeekHint" |
| 2041 | 2045 | | "meals.unlimited" |
| @@ -2316,6 +2320,7 @@ export type MessageKey = | ||
| 2316 | 2320 | | "calendar.title" |
| 2317 | 2321 | | "calendar.feedsFailed" |
| 2318 | 2322 | | "calendar.today" |
| 2323 | + | "calendar.weekScrollHint" | |
| 2319 | 2324 | | "calendar.month" |
| 2320 | 2325 | | "calendar.year" |
| 2321 | 2326 | | "calendar.noEvents" |
| @@ -2357,6 +2362,8 @@ export type MessageKey = | ||
| 2357 | 2362 | | "appointments.until" |
| 2358 | 2363 | | "appointments.starts" |
| 2359 | 2364 | | "appointments.ends" |
| 2365 | + | "appointments.startTime" | |
| 2366 | + | "appointments.endTime" | |
| 2360 | 2367 | | "appointments.teacher" |
| 2361 | 2368 | | "appointments.student" |
| 2362 | 2369 | | "appointments.proposedTime" |
src/pages/calendar-page.tsxmodified+4 -1
| @@ -502,7 +502,9 @@ function CalendarContent() { | ||
| 502 | 502 | block — the closest real-data equivalent of a school's |
| 503 | 503 | printed weekly schedule, built from the same session/exam/ |
| 504 | 504 | homework/event/appointment feed as the month grid. */} |
| 505 | - <div class="grid min-h-0 flex-1 grid-cols-7 gap-1 overflow-hidden rounded-lg border bg-card p-1 shadow-xs"> | |
| 505 | + <p class="text-xs text-muted-foreground sm:hidden">{t("calendar.weekScrollHint")}</p> | |
| 506 | + <div class="min-h-0 min-w-0 flex-1 overflow-x-auto rounded-lg border bg-card shadow-xs"> | |
| 507 | + <div class="grid min-h-full min-w-[49rem] grid-cols-7 gap-1 p-1 sm:min-w-0"> | |
| 506 | 508 | <For each={weekDays()}> |
| 507 | 509 | {(day) => { |
| 508 | 510 | const key = dateKey(day); |
| @@ -545,6 +547,7 @@ function CalendarContent() { | ||
| 545 | 547 | ); |
| 546 | 548 | }} |
| 547 | 549 | </For> |
| 550 | + </div> | |
| 548 | 551 | </div> |
| 549 | 552 | </Show> |
| 550 | 553 |
src/pages/courses-page.test.tsxmodified+12 -0
| @@ -123,3 +123,15 @@ test("student course list filters on the server via kind, q and taught", async ( | ||
| 123 | 123 | await waitFor(() => expect(screen.queryByRole("button", { name: /^Algebra/ })).toBeNull()); |
| 124 | 124 | expect(screen.queryByRole("button", { name: /^Robotics/ })).toBeNull(); |
| 125 | 125 | }); |
| 126 | + | |
| 127 | +test("course search checks returned rows when the backend ignores q", async () => { | |
| 128 | + getCourses.mockResolvedValue({ items: catalog, total: catalog.length, limit: 100, offset: 0 }); | |
| 129 | + render(() => <PreferencesProvider><CoursesPage /></PreferencesProvider>); | |
| 130 | + | |
| 131 | + expect(await screen.findByRole("button", { name: /^Algebra/ })).toBeTruthy(); | |
| 132 | + fireEvent.input(screen.getByPlaceholderText("Search…"), { target: { value: "no-such-course" } }); | |
| 133 | + | |
| 134 | + await waitFor(() => expect(getCourses.mock.calls.at(-1)[0].q).toBe("no-such-course"), { timeout: 2000 }); | |
| 135 | + await waitFor(() => expect(screen.queryByRole("button", { name: /^Algebra/ })).toBeNull()); | |
| 136 | + expect(screen.queryByRole("button", { name: /^Study Lab/ })).toBeNull(); | |
| 137 | +}); |
src/pages/courses-page.tsxmodified+29 -13
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | import { Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js"; |
| 2 | 2 | import { createResponsivePageSize } from "@/lib/create-page-size"; |
| 3 | +import { loadAllPages } from "@/lib/capped-list"; | |
| 3 | 4 | import { createResource } from "@/lib/create-resource"; |
| 4 | 5 | import { useNavigate, useSearch } from "@tanstack/solid-router"; |
| 5 | 6 | import type { ColumnDef } from "@tanstack/solid-table"; |
| @@ -27,6 +28,7 @@ import { createDebouncedSignal } from "@/lib/create-debounced-signal"; | ||
| 27 | 28 | import { createFlash } from "@/lib/flash"; |
| 28 | 29 | import { personLabel } from "@/lib/person"; |
| 29 | 30 | import { hasMinRole } from "@/lib/roles"; |
| 31 | +import { matchesSearch } from "@/lib/search-text"; | |
| 30 | 32 | import { createUrlEnum, readPageIndex, readString } from "@/lib/url-state"; |
| 31 | 33 | import { useAuth } from "@/stores/auth-context"; |
| 32 | 34 | import { usePreferences, useT } from "@/stores/preferences-context"; |
| @@ -53,11 +55,9 @@ function CoursesContent() { | ||
| 53 | 55 | const [showForm, setShowForm] = createSignal(routeSearch().action === "new"); |
| 54 | 56 | const [title, setTitle] = createSignal(""); |
| 55 | 57 | const [description, setDescription] = createSignal(""); |
| 56 | - // Filters and paging are server-side now: the kind tab is the `kind` param, | |
| 57 | - // the search box the `q` param, the sections dropdown the `taught` param, | |
| 58 | - // and the envelope's total is already the filtered one. `?kind=` tracks the | |
| 59 | - // tab; `?q=`, `?page=` and `?taught=` restore the list on a reload (Back | |
| 60 | - // from a course lands where the list was left). | |
| 58 | + // URL parameters restore the kind, search, taught filter and page on reload. | |
| 59 | + // Deployed backends can ignore list filters, so filtered results are checked | |
| 60 | + // locally after fetching the complete list. | |
| 61 | 61 | const [taughtFilter, setTaughtFilter] = createUrlEnum("taught", ["all", "taught", "untaught"] as const, "all"); |
| 62 | 62 | const taughtParam = () => (taughtFilter() === "taught" ? true : taughtFilter() === "untaught" ? false : undefined); |
| 63 | 63 | const pageSize = createResponsivePageSize(PAGE_SIZE); |
| @@ -76,28 +76,44 @@ function CoursesContent() { | ||
| 76 | 76 | }); |
| 77 | 77 | |
| 78 | 78 | const [limits, { refetch: refetchLimits }] = createResource(() => canCreate() ? getLimits() : null); |
| 79 | + const filtersActive = () => pageKind() != null || debouncedSearch().trim() !== "" || taughtParam() != null; | |
| 79 | 80 | // Scoped server-side: a student reads only the courses they take. The |
| 80 | - // source carries every input the fetch reads, so each change refetches. | |
| 81 | + // source carries every input the fetch reads. Filtered lists are read in | |
| 82 | + // full and checked locally because the current deployment accepts filter | |
| 83 | + // query keys but can return the unfiltered page and total. | |
| 81 | 84 | const [list, { refetch }] = createResource( |
| 82 | 85 | () => ({ |
| 83 | 86 | role: auth.user()?.role ?? null, |
| 84 | 87 | kind: pageKind(), |
| 85 | 88 | q: debouncedSearch().trim(), |
| 86 | 89 | taught: taughtParam(), |
| 87 | - page: page(), | |
| 90 | + page: filtersActive() ? 0 : page(), | |
| 88 | 91 | size: pageSize(), |
| 89 | 92 | }), |
| 90 | - (filters) => | |
| 91 | - getCourses({ | |
| 92 | - limit: filters.size, | |
| 93 | - offset: filters.page * filters.size, | |
| 93 | + async (filters) => { | |
| 94 | + const requested = { | |
| 94 | 95 | ...(filters.kind ? { kind: filters.kind } : {}), |
| 95 | 96 | ...(filters.q ? { q: filters.q } : {}), |
| 96 | 97 | ...(filters.taught != null ? { taught: filters.taught } : {}), |
| 97 | - }), | |
| 98 | + }; | |
| 99 | + if (!filters.kind && !filters.q && filters.taught == null) { | |
| 100 | + return getCourses({ limit: filters.size, offset: filters.page * filters.size }); | |
| 101 | + } | |
| 102 | + const all = await loadAllPages((paging) => getCourses({ ...requested, ...paging })); | |
| 103 | + const items = all.filter((course) => | |
| 104 | + (!filters.kind || course.kind === filters.kind) && | |
| 105 | + (!filters.q || matchesSearch(filters.q, course.title, course.description)) && | |
| 106 | + (filters.taught == null || (course.class_course_count > 0) === filters.taught), | |
| 107 | + ); | |
| 108 | + return { items, total: items.length, limit: filters.size, offset: 0 }; | |
| 109 | + }, | |
| 98 | 110 | ); |
| 99 | 111 | const listData = () => list.latest ?? list(); |
| 100 | 112 | const total = () => listData()?.total ?? 0; |
| 113 | + const visibleItems = () => { | |
| 114 | + const items = listData()?.items ?? []; | |
| 115 | + return filtersActive() ? items.slice(page() * pageSize(), (page() + 1) * pageSize()) : items; | |
| 116 | + }; | |
| 101 | 117 | // Deleting the last row of the last page shrinks the page count under the |
| 102 | 118 | // current page; clamp instead of stranding the user off the end. |
| 103 | 119 | const pageCount = () => Math.max(1, Math.ceil(total() / pageSize())); |
| @@ -300,7 +316,7 @@ function CoursesContent() { | ||
| 300 | 316 | </Show> |
| 301 | 317 | <DataTable |
| 302 | 318 | columns={columns()} |
| 303 | - data={listData()?.items ?? []} | |
| 319 | + data={visibleItems()} | |
| 304 | 320 | tableClass="table-fixed min-w-[44rem]" |
| 305 | 321 | filterPlaceholder={t("common.searchPlaceholder")} |
| 306 | 322 | filterHint={t("search.hint.courses")} |
src/pages/exams-page.tsxmodified+4 -2
| @@ -419,8 +419,10 @@ function ExamsContent() { | ||
| 419 | 419 | onRowClick={(exam) => void navigate({ to: "/exams/$id", params: { id: exam.id } })} |
| 420 | 420 | filters={ |
| 421 | 421 | <div class="flex flex-wrap items-center gap-2.5"> |
| 422 | - <DropdownSelect | |
| 423 | - labelPrefix={t("nav.courses")} | |
| 422 | + <label for="exams-course-filter" class="text-xs font-semibold text-muted-foreground">{t("nav.courses")}:</label> | |
| 423 | + <SearchableSelect | |
| 424 | + id="exams-course-filter" | |
| 425 | + class="h-8 min-w-[12rem] max-w-[18rem]" | |
| 424 | 426 | value={courseFilter()} |
| 425 | 427 | onChange={(val) => setCourseFilter(val)} |
| 426 | 428 | options={[ |
src/pages/guide-page.tsxmodified+16 -12
| @@ -1,8 +1,7 @@ | ||
| 1 | -import { For, type Component } from "solid-js"; | |
| 1 | +import { For, createEffect, createSignal, type Component } from "solid-js"; | |
| 2 | 2 | import { Link } from "@tanstack/solid-router"; |
| 3 | 3 | import { RouteGuard } from "@/components/layout/route-guard"; |
| 4 | 4 | import { PageHeader } from "@/components/layout/page-header"; |
| 5 | -import { Button } from "@/components/ui/button"; | |
| 6 | 5 | import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs"; |
| 7 | 6 | import { |
| 8 | 7 | IconSparkles, |
| @@ -23,6 +22,7 @@ import { | ||
| 23 | 22 | } from "@/components/ui/icons"; |
| 24 | 23 | import type { MessageKey } from "@/i18n/messages"; |
| 25 | 24 | import { useT } from "@/stores/preferences-context"; |
| 25 | +import { useAuth } from "@/stores/auth-context"; | |
| 26 | 26 | import { cn } from "@/lib/cn"; |
| 27 | 27 | |
| 28 | 28 | // Everything on this page is copy, so the arrays below carry message keys and |
| @@ -34,18 +34,19 @@ type GuideStep = { | ||
| 34 | 34 | icon: Component<{ class?: string }>; |
| 35 | 35 | iconColor: string; |
| 36 | 36 | to: string; |
| 37 | + studentOnly?: boolean; | |
| 37 | 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 | 41 | const BADGE_TONE = "border-sky-500/40 text-foreground bg-card"; |
| 41 | 42 | |
| 42 | 43 | const STEPS: GuideStep[] = [ |
| 43 | - { id: "ai", stepNumber: "01", borderTone: CARD_TONE, icon: IconSparkles, iconColor: "text-sky-400", to: "/" }, | |
| 44 | + { id: "ai", stepNumber: "01", borderTone: CARD_TONE, icon: IconSparkles, iconColor: "text-sky-400", to: "/ai/study" }, | |
| 44 | 45 | { id: "notes", stepNumber: "02", borderTone: CARD_TONE, icon: IconNote, iconColor: "text-sky-400", to: "/notes" }, |
| 45 | 46 | { id: "questions", stepNumber: "03", borderTone: CARD_TONE, icon: IconBook, iconColor: "text-sky-400", to: "/questions" }, |
| 46 | 47 | { id: "courses", stepNumber: "04", borderTone: CARD_TONE, icon: IconCalendarDays, iconColor: "text-sky-400", to: "/courses" }, |
| 47 | 48 | { id: "exams", stepNumber: "05", borderTone: CARD_TONE, icon: IconExam, iconColor: "text-sky-400", to: "/exams" }, |
| 48 | - { id: "marks", stepNumber: "06", borderTone: CARD_TONE, icon: IconReportAnalytics, iconColor: "text-sky-400", to: "/marks" }, | |
| 49 | + { id: "marks", stepNumber: "06", borderTone: CARD_TONE, icon: IconReportAnalytics, iconColor: "text-sky-400", to: "/marks", studentOnly: true }, | |
| 49 | 50 | ]; |
| 50 | 51 | |
| 51 | 52 | type RoleTab = { |
| @@ -81,7 +82,12 @@ export default function GuidePage() { | ||
| 81 | 82 | |
| 82 | 83 | function GuideContent() { |
| 83 | 84 | const t = useT(); |
| 85 | + const auth = useAuth(); | |
| 84 | 86 | const stepText = (id: string, field: string) => t(`guide.step.${id}.${field}` as MessageKey); |
| 87 | + const role = () => auth.user()?.role ?? "student"; | |
| 88 | + const visibleSteps = () => STEPS.filter((step) => !step.studentOnly || role() === "student"); | |
| 89 | + const [selectedRole, setSelectedRole] = createSignal("student"); | |
| 90 | + createEffect(() => setSelectedRole(role() === "manager" ? "admin" : role())); | |
| 85 | 91 | |
| 86 | 92 | return ( |
| 87 | 93 | <div class="space-y-6"> |
| @@ -93,7 +99,7 @@ function GuideContent() { | ||
| 93 | 99 | <p class="mt-1 text-xs text-muted-foreground">{t("guide.roles.subtitle")}</p> |
| 94 | 100 | </div> |
| 95 | 101 | |
| 96 | - <Tabs defaultValue="student" class="w-full"> | |
| 102 | + <Tabs value={selectedRole()} onChange={setSelectedRole} class="w-full"> | |
| 97 | 103 | <TabsList class="w-full justify-start"> |
| 98 | 104 | <For each={ROLE_TABS}> |
| 99 | 105 | {(role) => ( |
| @@ -136,11 +142,11 @@ function GuideContent() { | ||
| 136 | 142 | </div> |
| 137 | 143 | |
| 138 | 144 | <div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3"> |
| 139 | - <For each={STEPS}> | |
| 145 | + <For each={visibleSteps()}> | |
| 140 | 146 | {(step) => ( |
| 141 | 147 | <article |
| 142 | 148 | class={cn( |
| 143 | - "group relative flex flex-col justify-between overflow-hidden rounded-lg border bg-card p-5 shadow-xs transition-all duration-200 ease-out hover:-translate-y-1 hover:shadow-md", | |
| 149 | + "group relative flex flex-col justify-between overflow-hidden rounded-xl border bg-card p-5 transition-colors hover:bg-muted/20", | |
| 144 | 150 | step.borderTone, |
| 145 | 151 | )} |
| 146 | 152 | > |
| @@ -174,11 +180,9 @@ function GuideContent() { | ||
| 174 | 180 | </div> |
| 175 | 181 | |
| 176 | 182 | <div class="mt-5 border-t border-border/60 pt-3"> |
| 177 | - <Link to={step.to}> | |
| 178 | - <Button variant="default" size="sm" class="w-full justify-between rounded-lg text-xs"> | |
| 179 | - <span>{stepText(step.id, "cta")}</span> | |
| 180 | - <span class="font-bold">→</span> | |
| 181 | - </Button> | |
| 183 | + <Link to={step.to} class="inline-flex h-9 w-full items-center justify-between rounded-lg bg-primary px-3 text-xs font-medium text-primary-foreground hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"> | |
| 184 | + <span>{stepText(step.id, "cta")}</span> | |
| 185 | + <span aria-hidden="true" class="font-bold">→</span> | |
| 182 | 186 | </Link> |
| 183 | 187 | </div> |
| 184 | 188 | </article> |
src/pages/homework-page.test.tsxadded+49 -0
| @@ -0,0 +1,49 @@ | ||
| 1 | +import { cleanup, fireEvent, render, screen, waitFor } from "@solidjs/testing-library"; | |
| 2 | +import type { JSX } from "solid-js"; | |
| 3 | +import HomeworkPage from "@/pages/homework-page"; | |
| 4 | +import { PreferencesProvider } from "@/stores/preferences-context"; | |
| 5 | + | |
| 6 | +const { getHomework } = vi.hoisted(() => ({ getHomework: vi.fn() })); | |
| 7 | + | |
| 8 | +vi.mock("@tanstack/solid-router", () => ({ | |
| 9 | + Link: (props: { to: string; children: JSX.Element; class?: string }) => <a href={props.to} class={props.class}>{props.children}</a>, | |
| 10 | + Navigate: () => null, | |
| 11 | + useNavigate: () => vi.fn(), | |
| 12 | + useLocation: () => () => ({ pathname: "/homework", search: {}, searchStr: "", hash: "" }), | |
| 13 | +})); | |
| 14 | +vi.mock("@/stores/auth-context", () => ({ | |
| 15 | + useAuth: () => ({ user: () => ({ id: "student-1", role: "student" }), loading: () => false, error: () => null }), | |
| 16 | +})); | |
| 17 | +vi.mock("@/lib/instance-options", () => ({ loadInstanceOptions: vi.fn(async () => []) })); | |
| 18 | +vi.mock("@/lib/instance-labels", () => ({ loadInstanceLabels: vi.fn(async () => new Map()) })); | |
| 19 | +vi.mock("@/api/homework", () => ({ | |
| 20 | + getHomework, | |
| 21 | +})); | |
| 22 | +vi.mock("@/api/time", () => ({ getTime: vi.fn(async () => ({ now: Date.now() })) })); | |
| 23 | +vi.mock("@/api/instances", () => ({ getInstanceSubjects: vi.fn(async () => ({ subjects: [] })), postInstanceHomework: vi.fn() })); | |
| 24 | + | |
| 25 | +afterEach(() => { | |
| 26 | + cleanup(); | |
| 27 | + vi.restoreAllMocks(); | |
| 28 | +}); | |
| 29 | + | |
| 30 | +test("homework filter renders before its list request finishes", async () => { | |
| 31 | + getHomework.mockResolvedValue({ items: [], total: 0, limit: 100, offset: 0 }); | |
| 32 | + render(() => <PreferencesProvider><HomeworkPage /></PreferencesProvider>); | |
| 33 | + | |
| 34 | + expect(await screen.findByRole("combobox", { name: /Courses|Dersler/ })).toBeTruthy(); | |
| 35 | +}); | |
| 36 | + | |
| 37 | +test("past-due tab excludes future homework when the server ignores its date filter", async () => { | |
| 38 | + const rows = [ | |
| 39 | + { id: "past", title: "Past assignment", due_at: Date.now() - 86_400_000, class_course: "i-1", assigned: [] }, | |
| 40 | + { id: "future", title: "Future assignment", due_at: Date.now() + 86_400_000, class_course: "i-1", assigned: [] }, | |
| 41 | + ]; | |
| 42 | + getHomework.mockResolvedValue({ items: rows, total: rows.length, limit: 100, offset: 0 }); | |
| 43 | + render(() => <PreferencesProvider><HomeworkPage /></PreferencesProvider>); | |
| 44 | + | |
| 45 | + expect(await screen.findByText("Future assignment")).toBeTruthy(); | |
| 46 | + fireEvent.click(screen.getByRole("tab", { name: /Past due|Süresi geçen/ })); | |
| 47 | + await waitFor(() => expect(screen.queryByText("Future assignment")).toBeNull()); | |
| 48 | + expect(screen.getByText("Past assignment")).toBeTruthy(); | |
| 49 | +}); |
src/pages/homework-page.tsxmodified+32 -24
| @@ -19,7 +19,6 @@ import { IconEye, IconPlus, IconRotateCcw } from "@/components/ui/icons"; | ||
| 19 | 19 | import { Input } from "@/components/ui/input"; |
| 20 | 20 | import { Label } from "@/components/ui/label"; |
| 21 | 21 | import { SearchableSelect } from "@/components/ui/searchable-select"; |
| 22 | -import { DropdownSelect } from "@/components/ui/select"; | |
| 23 | 22 | import { SidePanel } from "@/components/ui/side-panel"; |
| 24 | 23 | import { TableRowActions } from "@/components/ui/table-row-actions"; |
| 25 | 24 | |
| @@ -89,16 +88,6 @@ function HomeworkContent() { | ||
| 89 | 88 | // The şube filter, as on /exams; it lives in the URL beside the table's own |
| 90 | 89 | // search and page. |
| 91 | 90 | const [courseFilter, setCourseFilter] = createUrlString("course", "all"); |
| 92 | - const courseFilterOptions = createMemo(() => { | |
| 93 | - const known = instances() ?? []; | |
| 94 | - const knownIds = new Set(known.map((row) => row.id)); | |
| 95 | - // Homework in a şube the picker does not list (e.g. one the caller only | |
| 96 | - // sees through an assignment) still gets its own entry, after the rest. | |
| 97 | - const extra = [...new Set((list()?.items ?? []).map((item) => item.class_course))] | |
| 98 | - .filter((id) => !knownIds.has(id) && courseNames()[id]) | |
| 99 | - .map((id) => ({ value: id, label: courseNames()[id] })); | |
| 100 | - return [{ value: "all", label: t("common.all") }, ...known.map((row) => ({ value: row.id, label: row.label })), ...extra]; | |
| 101 | - }); | |
| 102 | 91 | // A homework subject must sit in the chosen section's resolved subject set. |
| 103 | 92 | const [subjects] = createResource( |
| 104 | 93 | () => selectedCourseId() || null, |
| @@ -110,12 +99,9 @@ function HomeworkContent() { | ||
| 110 | 99 | const pageTitle = () => auth.user()?.role === "student" ? t("homework.mineTitle") : t("homework.title"); |
| 111 | 100 | type DueTab = "all" | "open" | "past"; |
| 112 | 101 | const [dueTab, setDueTab] = createSignal<DueTab>("all"); |
| 113 | - // Tab and section filters are enforced server-side, at the moment of the | |
| 114 | - // request: Open keeps rows still due (`due_after`), Past keeps rows already | |
| 115 | - // due (`due_before`), a picked section narrows to it (`class_course`); `all` | |
| 116 | - // sends no bound. The window rides in the source key so switching tabs | |
| 117 | - // refetches with that tab's bound, and every page of the filtered set is | |
| 118 | - // read (no cap, no truncation notice). | |
| 102 | + // Tab and section filters go to the API and are checked again locally because | |
| 103 | + // the deployed backend currently ignores them. The source key refetches on | |
| 104 | + // filter changes, and the windowed list has a shared cap. | |
| 119 | 105 | const [list, { refetch }] = createResource( |
| 120 | 106 | () => `${dueTab()}|${courseFilter()}`, |
| 121 | 107 | async (key) => { |
| @@ -125,15 +111,35 @@ function HomeworkContent() { | ||
| 125 | 111 | if (tab === "past") params.due_before = Date.now(); |
| 126 | 112 | if (course !== "all") params.class_course = course; |
| 127 | 113 | const page = await loadWindowedList((paging) => getHomework({ ...params, ...paging }), LIST_CAP); |
| 128 | - const labels = await loadInstanceLabels(page.items.map((item) => item.class_course), auth.user()?.role); | |
| 114 | + // Some deployed backends currently accept these query keys but ignore | |
| 115 | + // them. Recheck the complete response so the tabs never show wrong rows. | |
| 116 | + const items = page.items.filter((item) => | |
| 117 | + (params.due_after == null || item.due_at >= params.due_after) && | |
| 118 | + (params.due_before == null || item.due_at < params.due_before) && | |
| 119 | + (params.class_course == null || item.class_course === params.class_course), | |
| 120 | + ); | |
| 121 | + const labels = await loadInstanceLabels(items.map((item) => item.class_course), auth.user()?.role); | |
| 129 | 122 | setCourseNames(Object.fromEntries([...labels].map(([id, entry]) => [id, entry.label]))); |
| 130 | - return page; | |
| 123 | + return { items, total: items.length }; | |
| 131 | 124 | }, |
| 132 | 125 | ); |
| 126 | + const courseFilterOptions = createMemo(() => { | |
| 127 | + const known = instances() ?? []; | |
| 128 | + const knownIds = new Set(known.map((row) => row.id)); | |
| 129 | + // Homework in a şube the picker does not list (e.g. one the caller only | |
| 130 | + // sees through an assignment) still gets its own entry, after the rest. | |
| 131 | + const extra = [...new Set((list()?.items ?? []).map((item) => item.class_course))] | |
| 132 | + .filter((id) => !knownIds.has(id) && courseNames()[id]) | |
| 133 | + .map((id) => ({ value: id, label: courseNames()[id] })); | |
| 134 | + return [{ value: "all", label: t("common.all") }, ...known.map((row) => ({ value: row.id, label: row.label })), ...extra]; | |
| 135 | + }); | |
| 136 | + | |
| 137 | + const preferredCourseId = () => | |
| 138 | + manageableCourses().find((row) => row.id === courseFilter())?.id ?? manageableCourses()[0]?.id ?? ""; | |
| 133 | 139 | |
| 134 | 140 | createEffect(() => { |
| 135 | 141 | if (!createOpen()) return; |
| 136 | - if (!selectedCourseId()) setSelectedCourseId(manageableCourses()[0]?.id ?? ""); | |
| 142 | + if (!selectedCourseId()) setSelectedCourseId(preferredCourseId()); | |
| 137 | 143 | }); |
| 138 | 144 | |
| 139 | 145 | createEffect(() => { |
| @@ -143,7 +149,7 @@ function HomeworkContent() { | ||
| 143 | 149 | const resetForm = () => { |
| 144 | 150 | setTitle(""); |
| 145 | 151 | setDescription(""); |
| 146 | - setSelectedCourseId(manageableCourses()[0]?.id ?? ""); | |
| 152 | + setSelectedCourseId(preferredCourseId()); | |
| 147 | 153 | setSubjectId(""); |
| 148 | 154 | setDueDate(""); |
| 149 | 155 | setDueTime(""); |
| @@ -295,8 +301,10 @@ function HomeworkContent() { | ||
| 295 | 301 | onClearFilters={() => setCourseFilter("all")} |
| 296 | 302 | filters={ |
| 297 | 303 | <div class="flex flex-wrap items-center gap-2.5"> |
| 298 | - <DropdownSelect | |
| 299 | - labelPrefix={t("nav.courses")} | |
| 304 | + <label for="homework-course-filter" class="text-xs font-semibold text-muted-foreground">{t("nav.courses")}:</label> | |
| 305 | + <SearchableSelect | |
| 306 | + id="homework-course-filter" | |
| 307 | + class="h-8 min-w-[12rem] max-w-[18rem]" | |
| 300 | 308 | value={courseFilter()} |
| 301 | 309 | onChange={(val) => setCourseFilter(val)} |
| 302 | 310 | options={courseFilterOptions()} |
| @@ -317,7 +325,7 @@ function HomeworkContent() { | ||
| 317 | 325 | } |
| 318 | 326 | actions={ |
| 319 | 327 | <Show when={canCreate()}> |
| 320 | - <Button type="button" size="sm" class="rounded-lg" onClick={() => setCreateOpen(true)}> | |
| 328 | + <Button type="button" size="sm" class="rounded-lg" onClick={() => { setSelectedCourseId(preferredCourseId()); setCreateOpen(true); }}> | |
| 321 | 329 | <IconPlus class="h-4 w-4" /> |
| 322 | 330 | {t("homework.add")} |
| 323 | 331 | </Button> |
src/pages/meals-page.tsxmodified+24 -9
| @@ -1,10 +1,11 @@ | ||
| 1 | -import { For, Show, Suspense, createMemo, createSignal } from "solid-js"; | |
| 1 | +import { Show, Suspense, createMemo, createSignal } from "solid-js"; | |
| 2 | 2 | import { createResource } from "@/lib/create-resource"; |
| 3 | 3 | import { getLimits } from "@/api/limits"; |
| 4 | 4 | import { getMealMenus, postMealMenu } from "@/api/meals"; |
| 5 | 5 | import { getSettings } from "@/api/settings"; |
| 6 | 6 | import { formatApiError } from "@/api/client"; |
| 7 | 7 | import { MealDayGroup } from "@/components/meals/meal-day-group"; |
| 8 | +import { MealDayPicker } from "@/components/meals/meal-day-picker"; | |
| 8 | 9 | import { MealPublishPanel, type MealPublishInput } from "@/components/meals/meal-publish-panel"; |
| 9 | 10 | import { MealWeekNav } from "@/components/meals/meal-week-nav"; |
| 10 | 11 | import { DataSection } from "@/components/ui/data-section"; |
| @@ -38,6 +39,7 @@ function MealsContent() { | ||
| 38 | 39 | const today = localIsoDate(); |
| 39 | 40 | const thisWeek = weekStartIso(today); |
| 40 | 41 | const [weekStart, setWeekStart] = createSignal(thisWeek); |
| 42 | + const [selectedDate, setSelectedDate] = createSignal(today); | |
| 41 | 43 | const [slot, setSlot] = createSignal("all"); |
| 42 | 44 | const [showCreate, setShowCreate] = createSignal(false); |
| 43 | 45 | const [flash, setFlash] = createFlash(); |
| @@ -61,6 +63,12 @@ function MealsContent() { | ||
| 61 | 63 | ); |
| 62 | 64 | return groupMenusByDay(items, slots().map((item) => item.name)); |
| 63 | 65 | }); |
| 66 | + const selectedMenus = createMemo(() => days().find((day) => day.date === selectedDate())?.menus ?? []); | |
| 67 | + | |
| 68 | + const changeWeek = (start: string, chosenDate?: string) => { | |
| 69 | + setWeekStart(start); | |
| 70 | + setSelectedDate(chosenDate ?? (start === thisWeek ? today : start)); | |
| 71 | + }; | |
| 64 | 72 | |
| 65 | 73 | const publish = async (input: MealPublishInput) => { |
| 66 | 74 | await postMealMenu(input); |
| @@ -100,19 +108,26 @@ function MealsContent() { | ||
| 100 | 108 | locale={intlLocale()} |
| 101 | 109 | slot={slot()} |
| 102 | 110 | slots={slots()} |
| 103 | - onWeekChange={setWeekStart} | |
| 111 | + onWeekChange={changeWeek} | |
| 104 | 112 | onSlotChange={setSlot} |
| 105 | 113 | /> |
| 106 | 114 | <Suspense fallback={<PageSpinner />}> |
| 107 | 115 | <Show when={menus.error}><ErrorAlert message={formatApiError(menus.error)} onRetry={() => void refetch()} /></Show> |
| 108 | - <Show | |
| 109 | - when={days().length > 0} | |
| 110 | - fallback={<Show when={!menus.error}><EmptyState kind="meals" title={t("meals.emptyWeek")} description={t("meals.emptyWeekHint")} /></Show>} | |
| 111 | - > | |
| 116 | + <Show when={!menus.error}> | |
| 112 | 117 | <div class="space-y-5" aria-busy={menus.loading}> |
| 113 | - <For each={days()}> | |
| 114 | - {(day) => <MealDayGroup date={day.date} menus={day.menus} locale={intlLocale()} isToday={day.date === today} />} | |
| 115 | - </For> | |
| 118 | + <MealDayPicker | |
| 119 | + weekStart={weekStart()} | |
| 120 | + selectedDate={selectedDate()} | |
| 121 | + locale={intlLocale()} | |
| 122 | + days={days()} | |
| 123 | + onSelect={setSelectedDate} | |
| 124 | + /> | |
| 125 | + <Show | |
| 126 | + when={days().length > 0} | |
| 127 | + fallback={<EmptyState kind="meals" title={t("meals.emptyWeek")} description={t("meals.emptyWeekHint")} />} | |
| 128 | + > | |
| 129 | + <MealDayGroup date={selectedDate()} menus={selectedMenus()} locale={intlLocale()} isToday={selectedDate() === today} /> | |
| 130 | + </Show> | |
| 116 | 131 | </div> |
| 117 | 132 | </Show> |
| 118 | 133 | </Suspense> |
src/pages/messages-page.tsxmodified+20 -17
| @@ -2,6 +2,7 @@ import { | ||
| 2 | 2 | For, |
| 3 | 3 | Show, |
| 4 | 4 | createMemo, |
| 5 | + createEffect, | |
| 5 | 6 | createSignal, |
| 6 | 7 | Suspense, |
| 7 | 8 | useTransition, |
| @@ -13,13 +14,12 @@ import { Button } from "@/components/ui/button"; | ||
| 13 | 14 | import { |
| 14 | 15 | IconArchive, |
| 15 | 16 | IconMessage, |
| 16 | - IconSearch, | |
| 17 | 17 | IconSend, |
| 18 | 18 | IconTrash, |
| 19 | 19 | IconPlus, |
| 20 | 20 | IconRefresh, |
| 21 | 21 | } from "@/components/ui/icons"; |
| 22 | -import { Input } from "@/components/ui/input"; | |
| 22 | +import { DataTableSearch } from "@/components/ui/data-table-search"; | |
| 23 | 23 | import { GmailMailRow } from "@/components/messages/gmail-mail-row"; |
| 24 | 24 | import { GmailMailDetail } from "@/components/messages/gmail-mail-detail"; |
| 25 | 25 | import { GmailComposeBox } from "@/components/messages/gmail-compose-box"; |
| @@ -67,6 +67,12 @@ export default function MessagesPage() { | ||
| 67 | 67 | ...(args.q ? { q: args.q } : {}), |
| 68 | 68 | }) |
| 69 | 69 | ); |
| 70 | + createEffect(() => { | |
| 71 | + const total = messagePage()?.total; | |
| 72 | + if (total === undefined) return; | |
| 73 | + const lastPage = Math.max(1, Math.ceil(total / limit)); | |
| 74 | + if (page() > lastPage) setPage(lastPage); | |
| 75 | + }); | |
| 70 | 76 | |
| 71 | 77 | const [unreadCount, { refetch: refetchUnread }] = createResource( |
| 72 | 78 | async () => (await getMessages("inbox", { read: false, limit: 1 })).total |
| @@ -162,7 +168,7 @@ export default function MessagesPage() { | ||
| 162 | 168 | await Promise.all(trashItems.map((m) => deleteMessageById(m.id))); |
| 163 | 169 | setFlash(t("messages.trashEmptiedToast")); |
| 164 | 170 | setSelectedId(""); |
| 165 | - refetch(); | |
| 171 | + await refetch(); | |
| 166 | 172 | } catch (err: any) { |
| 167 | 173 | console.error("Empty trash error:", err); |
| 168 | 174 | setFlash(formatApiError(err)); |
| @@ -265,19 +271,16 @@ export default function MessagesPage() { | ||
| 265 | 271 | {t("common.refresh")} |
| 266 | 272 | </Button> |
| 267 | 273 | |
| 268 | - <div class="relative w-full"> | |
| 269 | - <IconSearch class="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-subtle" /> | |
| 270 | - <Input | |
| 271 | - class="h-8 rounded-lg bg-surface-tint pl-9 pr-4 text-[13px] border-none focus-visible:ring-1" | |
| 272 | - placeholder={t("messages.search")} | |
| 273 | - value={query()} | |
| 274 | - onInput={(event) => { | |
| 275 | - setQuery(event.currentTarget.value); | |
| 276 | - // The server filters from the first row; offset restarts with each search. | |
| 277 | - setPage(1); | |
| 278 | - }} | |
| 279 | - /> | |
| 280 | - </div> | |
| 274 | + <DataTableSearch | |
| 275 | + class="max-w-none" | |
| 276 | + placeholder={t("messages.search")} | |
| 277 | + value={query()} | |
| 278 | + onChange={(value) => { | |
| 279 | + setQuery(value); | |
| 280 | + // The server filters from the first row; offset restarts with each search. | |
| 281 | + setPage(1); | |
| 282 | + }} | |
| 283 | + /> | |
| 281 | 284 | </div> |
| 282 | 285 | |
| 283 | 286 | <div class="flex items-center justify-end gap-3"> |
| @@ -327,7 +330,7 @@ export default function MessagesPage() { | ||
| 327 | 330 | when={messages().length > 0} |
| 328 | 331 | fallback={ |
| 329 | 332 | <div class="p-12 text-center text-xs text-muted-foreground"> |
| 330 | - {t("messages.noMessages")} | |
| 333 | + {query().trim() ? t("common.noResults") : t("messages.noMessages")} | |
| 331 | 334 | </div> |
| 332 | 335 | } |
| 333 | 336 | > |
src/pages/settings-page.test.tsxadded+49 -0
| @@ -0,0 +1,49 @@ | ||
| 1 | +import { cleanup, fireEvent, render, screen, waitFor } from "@solidjs/testing-library"; | |
| 2 | +import SettingsPage from "@/pages/settings-page"; | |
| 3 | +import { PreferencesProvider } from "@/stores/preferences-context"; | |
| 4 | + | |
| 5 | +const { getSettings, patchSettings } = vi.hoisted(() => ({ getSettings: vi.fn(), patchSettings: vi.fn() })); | |
| 6 | + | |
| 7 | +vi.mock("@tanstack/solid-router", () => ({ | |
| 8 | + useBlocker: () => () => ({ status: "idle" }), | |
| 9 | + Navigate: () => null, | |
| 10 | +})); | |
| 11 | +vi.mock("@/stores/auth-context", () => ({ | |
| 12 | + useAuth: () => ({ user: () => ({ id: "manager-1", role: "manager" }), loading: () => false, error: () => null }), | |
| 13 | +})); | |
| 14 | +vi.mock("@/api/settings", () => ({ getSettings, patchSettings })); | |
| 15 | +vi.mock("@/api/limits", () => ({ | |
| 16 | + getLimits: vi.fn(async () => ({ file: {}, meal: {}, settings: {}, chatbot: {} })), | |
| 17 | +})); | |
| 18 | +vi.mock("@/api/modules", () => ({ | |
| 19 | + getModules: vi.fn(async () => ({ enabled: [] })), | |
| 20 | + getModulesCatalog: vi.fn(async () => ({ packages: [] })), | |
| 21 | +})); | |
| 22 | + | |
| 23 | +const settings = { | |
| 24 | + exam_kinds: [], attendance_statuses: [], grade_bands: [], max_file_bytes: 5 * 1024 * 1024, | |
| 25 | + chatbot_history_turns: 10, max_chatbot_threads: 50, max_chatbot_message_len: 4000, | |
| 26 | + meal_slots: [], dietary_tags: [], meal_cancel_cutoff_minutes: null, | |
| 27 | + branches: [], excuse_kinds: [], max_excused_absent_days: null, | |
| 28 | + max_unexcused_absent_days: null, timezone: null, | |
| 29 | +}; | |
| 30 | + | |
| 31 | +afterEach(() => { | |
| 32 | + cleanup(); | |
| 33 | + vi.clearAllMocks(); | |
| 34 | +}); | |
| 35 | + | |
| 36 | +test("comma-separated school vocabularies remain editable and save as lists", async () => { | |
| 37 | + getSettings.mockResolvedValue(settings); | |
| 38 | + patchSettings.mockImplementation(async (patch) => ({ ...settings, ...patch })); | |
| 39 | + render(() => <PreferencesProvider><SettingsPage /></PreferencesProvider>); | |
| 40 | + | |
| 41 | + fireEvent.click(await screen.findByRole("tab", { name: /System|Sistem/ })); | |
| 42 | + const branches = await screen.findByLabelText(/Teaching subjects|Branşlar/); | |
| 43 | + fireEvent.input(branches, { target: { value: "Math," } }); | |
| 44 | + expect((branches as HTMLInputElement).value).toBe("Math,"); | |
| 45 | + fireEvent.input(branches, { target: { value: "Math, Science" } }); | |
| 46 | + fireEvent.click(screen.getAllByRole("button", { name: /Save|Kaydet/ })[0]); | |
| 47 | + | |
| 48 | + await waitFor(() => expect(patchSettings).toHaveBeenCalledWith({ branches: ["Math", "Science"] })); | |
| 49 | +}); |
src/pages/settings-page.tsxmodified+32 -14
| @@ -48,6 +48,10 @@ function isCoreAttendance(status: string): status is keyof typeof CORE_ATTENDANC | ||
| 48 | 48 | return status in CORE_ATTENDANCE_LABELS; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | +function parseCommaList(value: string): string[] { | |
| 52 | + return value.split(",").map((part) => part.trim()).filter(Boolean); | |
| 53 | +} | |
| 54 | + | |
| 51 | 55 | export default function SettingsPage() { |
| 52 | 56 | return ( |
| 53 | 57 | <RouteGuard minRole="manager"> |
| @@ -74,8 +78,8 @@ function SettingsContent() { | ||
| 74 | 78 | const [dietaryTags, setDietaryTags] = createSignal<string[]>([]); |
| 75 | 79 | const [mealCutoff, setMealCutoff] = createSignal(""); |
| 76 | 80 | // Devamsızlık policy and the branş vocabulary, both school-varying. |
| 77 | - const [excuseKinds, setExcuseKinds] = createSignal<string[]>([]); | |
| 78 | - const [branches, setBranches] = createSignal<string[]>([]); | |
| 81 | + const [excuseKindsText, setExcuseKindsText] = createSignal(""); | |
| 82 | + const [branchesText, setBranchesText] = createSignal(""); | |
| 79 | 83 | const [maxExcusedDays, setMaxExcusedDays] = createSignal(""); |
| 80 | 84 | const [maxUnexcusedDays, setMaxUnexcusedDays] = createSignal(""); |
| 81 | 85 | const [timezone, setTimezone] = createSignal(""); |
| @@ -98,8 +102,8 @@ function SettingsContent() { | ||
| 98 | 102 | meal_slots: mealSlots(), |
| 99 | 103 | dietary_tags: dietaryTags(), |
| 100 | 104 | meal_cancel_cutoff_minutes: mealCutoff() === "" ? null : Number(mealCutoff()), |
| 101 | - excuse_kinds: excuseKinds(), | |
| 102 | - branches: branches(), | |
| 105 | + excuse_kinds: parseCommaList(excuseKindsText()), | |
| 106 | + branches: parseCommaList(branchesText()), | |
| 103 | 107 | max_excused_absent_days: maxExcusedDays() === "" ? null : Number(maxExcusedDays()), |
| 104 | 108 | max_unexcused_absent_days: maxUnexcusedDays() === "" ? null : Number(maxUnexcusedDays()), |
| 105 | 109 | timezone: timezone().trim() === "" ? null : timezone().trim(), |
| @@ -119,8 +123,8 @@ function SettingsContent() { | ||
| 119 | 123 | setMealSlots(next.meal_slots.map((slot) => ({ ...slot }))); |
| 120 | 124 | setDietaryTags([...next.dietary_tags]); |
| 121 | 125 | setMealCutoff(next.meal_cancel_cutoff_minutes == null ? "" : String(next.meal_cancel_cutoff_minutes)); |
| 122 | - setExcuseKinds([...(next.excuse_kinds ?? [])]); | |
| 123 | - setBranches([...(next.branches ?? [])]); | |
| 126 | + setExcuseKindsText((next.excuse_kinds ?? []).join(", ")); | |
| 127 | + setBranchesText((next.branches ?? []).join(", ")); | |
| 124 | 128 | setMaxExcusedDays(next.max_excused_absent_days == null ? "" : String(next.max_excused_absent_days)); |
| 125 | 129 | setMaxUnexcusedDays(next.max_unexcused_absent_days == null ? "" : String(next.max_unexcused_absent_days)); |
| 126 | 130 | setTimezone(next.timezone ?? ""); |
| @@ -144,8 +148,8 @@ function SettingsContent() { | ||
| 144 | 148 | max_file_bytes: fileBytes, |
| 145 | 149 | meal_slots: mealSlots().map((slot) => ({ name: slot.name.trim(), serving_minute: slot.serving_minute })), |
| 146 | 150 | dietary_tags: dietaryTags().map((tag) => tag.trim()), |
| 147 | - excuse_kinds: excuseKinds().map((kind) => kind.trim()).filter(Boolean), | |
| 148 | - branches: branches().map((branch) => branch.trim()).filter(Boolean), | |
| 151 | + excuse_kinds: parseCommaList(excuseKindsText()), | |
| 152 | + branches: parseCommaList(branchesText()), | |
| 149 | 153 | }; |
| 150 | 154 | }; |
| 151 | 155 | |
| @@ -203,7 +207,7 @@ function SettingsContent() { | ||
| 203 | 207 | }; |
| 204 | 208 | |
| 205 | 209 | return ( |
| 206 | - <div class="space-y-6"> | |
| 210 | + <div class={dirty() ? "space-y-6 pb-28 md:pb-20" : "space-y-6"}> | |
| 207 | 211 | <PageHeader |
| 208 | 212 | title={t("settings.title")} |
| 209 | 213 | description={t("settings.subtitle")} |
| @@ -249,7 +253,7 @@ function SettingsContent() { | ||
| 249 | 253 | |
| 250 | 254 | <TabsContent value="assessment" class={TAB_PANEL}> |
| 251 | 255 | <Show when={settings()}> |
| 252 | - <div class="grid gap-4 xl:grid-cols-3"> | |
| 256 | + <div class="grid gap-4 xl:grid-cols-2"> | |
| 253 | 257 | <section class="data-shell flex flex-col overflow-hidden"> |
| 254 | 258 | <header class="border-b border-border/70 px-4 py-3"> |
| 255 | 259 | <div class="flex items-start justify-between gap-3"> |
| @@ -665,18 +669,18 @@ function SettingsContent() { | ||
| 665 | 669 | <Label for="excuse-kinds">{t("settings.excuseKinds")}</Label> |
| 666 | 670 | <Input |
| 667 | 671 | id="excuse-kinds" |
| 668 | - value={excuseKinds().join(", ")} | |
| 672 | + value={excuseKindsText()} | |
| 669 | 673 | placeholder="raporlu, izinli" |
| 670 | - onInput={(e) => setExcuseKinds(e.currentTarget.value.split(",").map((part) => part.trim()).filter(Boolean))} | |
| 674 | + onInput={(e) => setExcuseKindsText(e.currentTarget.value)} | |
| 671 | 675 | /> |
| 672 | 676 | </div> |
| 673 | 677 | <div class="space-y-1.5"> |
| 674 | 678 | <Label for="branches">{t("settings.branches")}</Label> |
| 675 | 679 | <Input |
| 676 | 680 | id="branches" |
| 677 | - value={branches().join(", ")} | |
| 681 | + value={branchesText()} | |
| 678 | 682 | placeholder="Matematik, Fizik" |
| 679 | - onInput={(e) => setBranches(e.currentTarget.value.split(",").map((part) => part.trim()).filter(Boolean))} | |
| 683 | + onInput={(e) => setBranchesText(e.currentTarget.value)} | |
| 680 | 684 | /> |
| 681 | 685 | </div> |
| 682 | 686 | </div> |
| @@ -740,6 +744,20 @@ function SettingsContent() { | ||
| 740 | 744 | </Suspense> |
| 741 | 745 | </Tabs> |
| 742 | 746 | |
| 747 | + <Show when={dirty()}> | |
| 748 | + <div class="fixed inset-x-4 bottom-20 z-40 flex items-center justify-between gap-3 rounded-xl border border-border-line bg-surface-base px-4 py-3 shadow-lg md:inset-x-auto md:bottom-4 md:left-1/2 md:min-w-80 md:-translate-x-1/2"> | |
| 749 | + <div class="min-w-0"> | |
| 750 | + <p class="text-sm font-medium">{t("settings.unsaved")}</p> | |
| 751 | + <Show when={error()}> | |
| 752 | + <p class="mt-1 max-w-64 text-xs text-destructive-text" role="alert">{error()}</p> | |
| 753 | + </Show> | |
| 754 | + </div> | |
| 755 | + <Button type="button" size="sm" class="shrink-0 rounded-lg" disabled={pending()} onClick={() => void save()}> | |
| 756 | + {t("common.save")} | |
| 757 | + </Button> | |
| 758 | + </div> | |
| 759 | + </Show> | |
| 760 | + | |
| 743 | 761 | <ConfirmDialog |
| 744 | 762 | open={blocker().status === "blocked"} |
| 745 | 763 | onOpenChange={(open) => { |
src/pages/staff-work-page.tsxmodified+9 -1
| @@ -328,7 +328,15 @@ function StaffWorkContent() { | ||
| 328 | 328 | )} |
| 329 | 329 | </For> |
| 330 | 330 | </div> |
| 331 | - <TablePagination pageIndex={staffPage()} pageCount={staffPageCount()} onPageChange={setStaffPage} /> | |
| 331 | + <div class="mt-5 border-t border-border-hairline pt-4"> | |
| 332 | + <TablePagination | |
| 333 | + pageIndex={staffPage()} | |
| 334 | + pageCount={staffPageCount()} | |
| 335 | + pageSize={peoplePageSize()} | |
| 336 | + total={filteredPeople().length} | |
| 337 | + onPageChange={setStaffPage} | |
| 338 | + /> | |
| 339 | + </div> | |
| 332 | 340 | </Show> |
| 333 | 341 | </Show> |
| 334 | 342 | </div> |
src/pages/whiteboards-page.tsxmodified+3 -0
| @@ -54,6 +54,9 @@ function WhiteboardsContent() { | ||
| 54 | 54 | ); |
| 55 | 55 | const [createOpen, setCreateOpen] = createSignal(false); |
| 56 | 56 | const pageCount = createMemo(() => Math.max(1, Math.ceil((boards.latest?.total ?? 0) / pageSize()))); |
| 57 | + createEffect(() => { | |
| 58 | + if (boards.latest && page() >= pageCount()) setPage(pageCount() - 1); | |
| 59 | + }); | |
| 57 | 60 | // The server narrows by title via `q`; the page holds whatever the current |
| 58 | 61 | // query matched, so totals and pagination already reflect the search. |
| 59 | 62 | const visibleBoards = createMemo(() => boards()?.items ?? []); |