forge
Explore
Log in

Don't you dare go Hollow

🛠 improve list filters and page usability

Browse files at this commit

23e3aaab80cd6b151c5827bde0f077fecb8ccd9fBurak BoduroğluParent: 76f3534
  • fix
    • 🛠 improve list filters and page usability
Show full message
fix: 🛠 improve list filters and page usability

- handle ignored backend filters for courses and homework
- fix homework loading crash and add regression coverage
- refine settings, staff work, meals, calendar, and side panels
- refresh guide, README, and live API drift documentation
README.mdmodified+48 -130
@@ -1,164 +1,82 @@
11 # Hezarfen Frontend
22
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.
44
5----
5+## Local development
66
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:
378
389 ```bash
39-# Install dependencies
4010 bun install
41-
42-# Start Vite development server
4311 bun run dev
44-
45-# Run unit tests
46-bun run test
47-
48-# Typecheck and build production bundle
49-bun run build
5012 ```
5113
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:
6315
6416 ```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
6818 ```
6919
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.
7321
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
7723
7824 ```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
8130 ```
8231
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.
8833
89----
34+## Application map
9035
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. |
9245
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.
9447
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.
10149
102----
50+## Code layout
10351
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. |
10561
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).
12563
126----
64+## Container and deployment
12765
128-## 🎨 UI/UX Design System Tokens
66+Use Podman:
12967
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
15572 ```
15673
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.
15877
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.
16079
161-All contributions adhere to the strict repository rulebook (`AGENTS.md`):
80+## Contributing
16281
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:
6666 - Main lists use real server paging (`limit`/`offset` + `total`) when no client-only filter is active:
6767 - exams and events (hybrid: full fetch only while client-only filters need it)
6868 - 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.
7176 - Nested/deferred lists unwrap full `.items` (sessions, enrollments, attendance, exam results/questions).
7277 - `/exams/:id/live`: client-paginated roster over snapshot/SSE (not the list envelope).
7378 - Progress Report card and Attendance tabs: not paged; aggregate report shapes.
@@ -111,6 +116,14 @@ Active backend/class/meals alignment is tracked in:
111116 linked and included in deadlines for every role.
112117 - Terms page: SidePanel create/edit + dense table row actions; header create buttons use shared min-width/radius.
113118 - 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.
114127 - Nested breadcrumbs on exam room and live monitor.
115128
116129 ### UX batch (2026-07, observation UI + feedback)
src/components/appointments/publish-slots-form.tsxmodified+2 -2
@@ -93,7 +93,7 @@ export function PublishSlotsForm(props: {
9393 placeholder="09:00"
9494 pattern="[0-2][0-9]:[0-5][0-9]"
9595 value={startsTime()}
96- aria-label={t("appointments.starts")}
96+ aria-label={t("appointments.startTime")}
9797 onInput={(e) => setStartsTime(e.currentTarget.value)}
9898 />
9999 </div>
@@ -109,7 +109,7 @@ export function PublishSlotsForm(props: {
109109 placeholder="10:00"
110110 pattern="[0-2][0-9]:[0-5][0-9]"
111111 value={endsTime()}
112- aria-label={t("appointments.ends")}
112+ aria-label={t("appointments.endTime")}
113113 onInput={(e) => setEndsTime(e.currentTarget.value)}
114114 />
115115 </div>
src/components/appointments/reschedule-form.tsxmodified+2 -2
@@ -61,7 +61,7 @@ export function RescheduleForm(props: {
6161 placeholder="09:00"
6262 pattern="[0-2][0-9]:[0-5][0-9]"
6363 value={startsTime()}
64- aria-label={t("appointments.starts")}
64+ aria-label={t("appointments.startTime")}
6565 onInput={(e) => setStartsTime(e.currentTarget.value)}
6666 />
6767 </div>
@@ -77,7 +77,7 @@ export function RescheduleForm(props: {
7777 placeholder="10:00"
7878 pattern="[0-2][0-9]:[0-5][0-9]"
7979 value={endsTime()}
80- aria-label={t("appointments.ends")}
80+ aria-label={t("appointments.endTime")}
8181 onInput={(e) => setEndsTime(e.currentTarget.value)}
8282 />
8383 </div>
src/components/meals/meal-day-group.tsxmodified+11 -5
@@ -1,6 +1,7 @@
11 import { For, Show } from "solid-js";
22 import type { MealMenu } from "@/api/client";
33 import { Badge } from "@/components/ui/badge";
4+import { EmptyInline } from "@/components/ui/empty-inline";
45 import { MealMenuRow } from "@/components/meals/meal-menu-row";
56 import { formatMealDay } from "@/lib/meals";
67 import { useT } from "@/stores/preferences-context";
@@ -19,11 +20,16 @@ export function MealDayGroup(props: {
1920 <span class="first-letter:uppercase">{formatMealDay(props.date, props.locale)}</span>
2021 <Show when={props.isToday}><Badge variant="info">{t("meals.today")}</Badge></Show>
2122 </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>
2733 </section>
2834 );
2935 }
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 }) {
2020 <Link
2121 to="/meals/$id"
2222 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"
2424 >
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>
2728 <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(", ")}
3032 </span>
3133 </Show>
32- <span class="truncate">{dishes() || t("meals.noDishes")}</span>
3334 </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">
3536 {t("meals.capacity")} {capacity()}
3637 </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" />
3940 </Link>
4041 );
4142 }
src/components/meals/meal-week-nav.tsxmodified+2 -2
@@ -15,7 +15,7 @@ export function MealWeekNav(props: {
1515 locale: string;
1616 slot: string;
1717 slots: MealSlot[];
18- onWeekChange: (weekStart: string) => void;
18+ onWeekChange: (weekStart: string, selectedDate?: string) => void;
1919 onSlotChange: (slot: string) => void;
2020 }) {
2121 const t = useT();
@@ -39,7 +39,7 @@ export function MealWeekNav(props: {
3939 class="h-8 w-40"
4040 placeholder={t("meals.goToDate")}
4141 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); }}
4343 />
4444 <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)}>
4545 <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) {
6868 <Show when={props.hint && focused()}>
6969 <p
7070 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)}
7272 >
7373 {props.hint}
7474 </p>
src/i18n/locales/en.tsmodified+19 -12
@@ -1341,6 +1341,7 @@ export const en: Dict = {
13411341 "calendar.title": "Calendar",
13421342 "calendar.feedsFailed": "Could not load: {feeds}. The calendar is missing those items.",
13431343 "calendar.today": "Today",
1344+ "calendar.weekScrollHint": "Swipe sideways to see the other days.",
13441345 "calendar.month": "Month",
13451346 "calendar.year": "Year",
13461347 "calendar.noEvents": "Nothing scheduled on this day.",
@@ -1382,6 +1383,8 @@ export const en: Dict = {
13821383 "appointments.until": "Repeat until",
13831384 "appointments.starts": "Start",
13841385 "appointments.ends": "End",
1386+ "appointments.startTime": "Start time",
1387+ "appointments.endTime": "End time",
13851388 "appointments.teacher": "Teacher",
13861389 "appointments.student": "Requested by",
13871390 "appointments.proposedTime": "Proposed time",
@@ -1723,19 +1726,19 @@ export const en: Dict = {
17231726 "guide.modules.title": "Core flows and features",
17241727 "guide.modules.subtitle": "The platform's main modules and how each one is used.",
17251728 "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",
17321735 "guide.step.notes.badge": "Notes and drawing",
17331736 "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.",
17351738 "guide.step.notes.cta": "Go to notes",
17361739 "guide.step.notes.f1": "Automatic PDF and TXT converter",
17371740 "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",
17391742 "guide.step.questions.badge": "Question pool",
17401743 "guide.step.questions.title": "Question pool and solutions",
17411744 "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 = {
17531756 "guide.step.exams.badge": "Exam room",
17541757 "guide.step.exams.title": "Exam room and live monitoring",
17551758 "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",
17571760 "guide.step.exams.f1": "Countdown synced to the server clock",
17581761 "guide.step.exams.f2": "WebSocket and REST autosave",
17591762 "guide.step.exams.f3": "Live teacher monitoring and marking",
@@ -1771,7 +1774,7 @@ export const en: Dict = {
17711774 "guide.tips.sync.title": "Automatic saving",
17721775 "guide.tips.sync.body": "Your exam-room answers and canvas drafts are saved in the background against the server clock.",
17731776 "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.",
17751778 "guide.tips.weights.title": "Weighted marking",
17761779 "guide.tips.weights.body": "Exam results feed your report-card average using the exam-kind weights the school office defines.",
17771780 "guide.rolesTitle": "Who can do what?",
@@ -2032,7 +2035,7 @@ export const en: Dict = {
20322035 "course.removeStudentConfirm": "Are you sure you want to remove",
20332036 "events.userIdRequired": "Please select a student first.",
20342037 "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.",
20362039 "settings.saved": "Settings saved.",
20372040 "settings.examKinds": "Exam kinds",
20382041 "settings.examKindsHelp": "Kinds and weights used in course averages.",
@@ -2147,6 +2150,10 @@ export const en: Dict = {
21472150 "meals.nextWeek": "Next week",
21482151 "meals.goToDate": "Go to date",
21492152 "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.",
21502157 "meals.emptyWeek": "No menus published for this week.",
21512158 "meals.emptyWeekHint": "Switch to another week or clear the meal filter.",
21522159 "meals.unlimited": "Unlimited",
@@ -2371,7 +2378,7 @@ export const en: Dict = {
23712378 "search.hint.users": "Matches username, phone, name, e-mail, user id and role.",
23722379 "search.hint.exams": "Matches exam title, description, course, exam kind and status.",
23732380 "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.",
23752382 "search.hint.courseNotes": "Matches note title and content.",
23762383 "search.hint.classes": "Matches class name, grade and homeroom teacher.",
23772384 "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 = {
13371337 "calendar.title": "Takvim",
13381338 "calendar.feedsFailed": "Yüklenemedi: {feeds}. Takvimde bu kayıtlar eksik.",
13391339 "calendar.today": "Bugün",
1340+ "calendar.weekScrollHint": "Diğer günleri görmek için yatay kaydırın.",
13401341 "calendar.month": "Ay",
13411342 "calendar.year": "Yıl",
13421343 "calendar.noEvents": "Bu güne ait bir şey yok.",
@@ -1378,6 +1379,8 @@ export const tr: Dict = {
13781379 "appointments.until": "Şu tarihe kadar tekrarla",
13791380 "appointments.starts": "Başlangıç",
13801381 "appointments.ends": "Bitiş",
1382+ "appointments.startTime": "Başlangıç saati",
1383+ "appointments.endTime": "Bitiş saati",
13811384 "appointments.teacher": "Öğretmen",
13821385 "appointments.student": "Talep eden",
13831386 "appointments.proposedTime": "Önerilen saat",
@@ -1719,19 +1722,19 @@ export const tr: Dict = {
17191722 "guide.modules.title": "Temel akışlar ve özellikler",
17201723 "guide.modules.subtitle": "Hezarfen platformundaki ana modülleri ve kullanım adımlarını inceleyin.",
17211724 "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ş",
17281731 "guide.step.notes.badge": "Notlar ve çizim",
17291732 "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.",
17311734 "guide.step.notes.cta": "Notlara git",
17321735 "guide.step.notes.f1": "PDF ve TXT otomatik dönüştürücü",
17331736 "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ı",
17351738 "guide.step.questions.badge": "Soru havuzu",
17361739 "guide.step.questions.title": "Soru havuzu ve çözümler",
17371740 "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 = {
17491752 "guide.step.exams.badge": "Sınav odası",
17501753 "guide.step.exams.title": "Sınav odası ve canlı takip",
17511754 "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",
17531756 "guide.step.exams.f1": "Sunucu saati senkronize geri sayım",
17541757 "guide.step.exams.f2": "WebSocket ve REST otomatik kaydetme",
17551758 "guide.step.exams.f3": "Canlı öğretmen izleme ve puanlama",
@@ -1767,7 +1770,7 @@ export const tr: Dict = {
17671770 "guide.tips.sync.title": "Otomatik senkronizasyon",
17681771 "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.",
17691772 "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.",
17711774 "guide.tips.weights.title": "Ağırlıklı not hesaplaması",
17721775 "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.",
17731776 "guide.rolesTitle": "Kim ne yapabilir?",
@@ -2028,7 +2031,7 @@ export const tr: Dict = {
20282031 "course.removeStudentConfirm": "Bu öğrenciyi çıkarmak istediğine emin misin?",
20292032 "events.userIdRequired": "Önce bir öğrenci seçmelisin.",
20302033 "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.",
20322035 "settings.saved": "Ayarlar kaydedildi.",
20332036 "settings.examKinds": "Sınav türleri",
20342037 "settings.examKindsHelp": "Ders ortalamalarında kullanılan tür ve ağırlıklar.",
@@ -2143,6 +2146,10 @@ export const tr: Dict = {
21432146 "meals.nextWeek": "Sonraki hafta",
21442147 "meals.goToDate": "Tarihe git",
21452148 "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.",
21462153 "meals.emptyWeek": "Bu hafta için yayınlanmış menü yok.",
21472154 "meals.emptyWeekHint": "Başka bir haftaya geçin veya öğün filtresini kaldırın.",
21482155 "meals.unlimited": "Sınırsız",
@@ -2367,7 +2374,7 @@ export const tr: Dict = {
23672374 "search.hint.users": "Kullan\u0131c\u0131 ad\u0131, telefon, ad, e-posta, kullan\u0131c\u0131 ID'si ve rolde arar.",
23682375 "search.hint.exams": "S\u0131nav ad\u0131, a\u00e7\u0131klama, ders, s\u0131nav t\u00fcr\u00fc ve durumda arar.",
23692376 "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.",
23712378 "search.hint.courseNotes": "Not ba\u015fl\u0131\u011f\u0131 ve i\u00e7eri\u011finde arar.",
23722379 "search.hint.classes": "\u015eube ad\u0131, s\u0131n\u0131f d\u00fczeyi ve dan\u0131\u015fman \u00f6\u011fretmende arar.",
23732380 "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 =
20362036 | "meals.nextWeek"
20372037 | "meals.goToDate"
20382038 | "meals.today"
2039+ | "meals.weekDays"
2040+ | "meals.menuCount"
2041+ | "meals.emptyDay"
2042+ | "meals.emptyDayHint"
20392043 | "meals.emptyWeek"
20402044 | "meals.emptyWeekHint"
20412045 | "meals.unlimited"
@@ -2316,6 +2320,7 @@ export type MessageKey =
23162320 | "calendar.title"
23172321 | "calendar.feedsFailed"
23182322 | "calendar.today"
2323+ | "calendar.weekScrollHint"
23192324 | "calendar.month"
23202325 | "calendar.year"
23212326 | "calendar.noEvents"
@@ -2357,6 +2362,8 @@ export type MessageKey =
23572362 | "appointments.until"
23582363 | "appointments.starts"
23592364 | "appointments.ends"
2365+ | "appointments.startTime"
2366+ | "appointments.endTime"
23602367 | "appointments.teacher"
23612368 | "appointments.student"
23622369 | "appointments.proposedTime"
src/pages/calendar-page.tsxmodified+4 -1
@@ -502,7 +502,9 @@ function CalendarContent() {
502502 block — the closest real-data equivalent of a school's
503503 printed weekly schedule, built from the same session/exam/
504504 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">
506508 <For each={weekDays()}>
507509 {(day) => {
508510 const key = dateKey(day);
@@ -545,6 +547,7 @@ function CalendarContent() {
545547 );
546548 }}
547549 </For>
550+ </div>
548551 </div>
549552 </Show>
550553
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 (
123123 await waitFor(() => expect(screen.queryByRole("button", { name: /^Algebra/ })).toBeNull());
124124 expect(screen.queryByRole("button", { name: /^Robotics/ })).toBeNull();
125125 });
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 @@
11 import { Show, Suspense, createEffect, createMemo, createSignal, on } from "solid-js";
22 import { createResponsivePageSize } from "@/lib/create-page-size";
3+import { loadAllPages } from "@/lib/capped-list";
34 import { createResource } from "@/lib/create-resource";
45 import { useNavigate, useSearch } from "@tanstack/solid-router";
56 import type { ColumnDef } from "@tanstack/solid-table";
@@ -27,6 +28,7 @@ import { createDebouncedSignal } from "@/lib/create-debounced-signal";
2728 import { createFlash } from "@/lib/flash";
2829 import { personLabel } from "@/lib/person";
2930 import { hasMinRole } from "@/lib/roles";
31+import { matchesSearch } from "@/lib/search-text";
3032 import { createUrlEnum, readPageIndex, readString } from "@/lib/url-state";
3133 import { useAuth } from "@/stores/auth-context";
3234 import { usePreferences, useT } from "@/stores/preferences-context";
@@ -53,11 +55,9 @@ function CoursesContent() {
5355 const [showForm, setShowForm] = createSignal(routeSearch().action === "new");
5456 const [title, setTitle] = createSignal("");
5557 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.
6161 const [taughtFilter, setTaughtFilter] = createUrlEnum("taught", ["all", "taught", "untaught"] as const, "all");
6262 const taughtParam = () => (taughtFilter() === "taught" ? true : taughtFilter() === "untaught" ? false : undefined);
6363 const pageSize = createResponsivePageSize(PAGE_SIZE);
@@ -76,28 +76,44 @@ function CoursesContent() {
7676 });
7777
7878 const [limits, { refetch: refetchLimits }] = createResource(() => canCreate() ? getLimits() : null);
79+ const filtersActive = () => pageKind() != null || debouncedSearch().trim() !== "" || taughtParam() != null;
7980 // 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.
8184 const [list, { refetch }] = createResource(
8285 () => ({
8386 role: auth.user()?.role ?? null,
8487 kind: pageKind(),
8588 q: debouncedSearch().trim(),
8689 taught: taughtParam(),
87- page: page(),
90+ page: filtersActive() ? 0 : page(),
8891 size: pageSize(),
8992 }),
90- (filters) =>
91- getCourses({
92- limit: filters.size,
93- offset: filters.page * filters.size,
93+ async (filters) => {
94+ const requested = {
9495 ...(filters.kind ? { kind: filters.kind } : {}),
9596 ...(filters.q ? { q: filters.q } : {}),
9697 ...(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+ },
98110 );
99111 const listData = () => list.latest ?? list();
100112 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+ };
101117 // Deleting the last row of the last page shrinks the page count under the
102118 // current page; clamp instead of stranding the user off the end.
103119 const pageCount = () => Math.max(1, Math.ceil(total() / pageSize()));
@@ -300,7 +316,7 @@ function CoursesContent() {
300316 </Show>
301317 <DataTable
302318 columns={columns()}
303- data={listData()?.items ?? []}
319+ data={visibleItems()}
304320 tableClass="table-fixed min-w-[44rem]"
305321 filterPlaceholder={t("common.searchPlaceholder")}
306322 filterHint={t("search.hint.courses")}
src/pages/exams-page.tsxmodified+4 -2
@@ -419,8 +419,10 @@ function ExamsContent() {
419419 onRowClick={(exam) => void navigate({ to: "/exams/$id", params: { id: exam.id } })}
420420 filters={
421421 <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]"
424426 value={courseFilter()}
425427 onChange={(val) => setCourseFilter(val)}
426428 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";
22 import { Link } from "@tanstack/solid-router";
33 import { RouteGuard } from "@/components/layout/route-guard";
44 import { PageHeader } from "@/components/layout/page-header";
5-import { Button } from "@/components/ui/button";
65 import { Tabs, TabsList, TabsTrigger, TabsContent } from "@/components/ui/tabs";
76 import {
87 IconSparkles,
@@ -23,6 +22,7 @@ import {
2322 } from "@/components/ui/icons";
2423 import type { MessageKey } from "@/i18n/messages";
2524 import { useT } from "@/stores/preferences-context";
25+import { useAuth } from "@/stores/auth-context";
2626 import { cn } from "@/lib/cn";
2727
2828 // Everything on this page is copy, so the arrays below carry message keys and
@@ -34,18 +34,19 @@ type GuideStep = {
3434 icon: Component<{ class?: string }>;
3535 iconColor: string;
3636 to: string;
37+ studentOnly?: boolean;
3738 };
3839
3940 const CARD_TONE = "border-sky-500/40 dark:border-sky-500/30 hover:border-sky-500/70 ring-1 ring-sky-500/20";
4041 const BADGE_TONE = "border-sky-500/40 text-foreground bg-card";
4142
4243 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" },
4445 { id: "notes", stepNumber: "02", borderTone: CARD_TONE, icon: IconNote, iconColor: "text-sky-400", to: "/notes" },
4546 { id: "questions", stepNumber: "03", borderTone: CARD_TONE, icon: IconBook, iconColor: "text-sky-400", to: "/questions" },
4647 { id: "courses", stepNumber: "04", borderTone: CARD_TONE, icon: IconCalendarDays, iconColor: "text-sky-400", to: "/courses" },
4748 { 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 },
4950 ];
5051
5152 type RoleTab = {
@@ -81,7 +82,12 @@ export default function GuidePage() {
8182
8283 function GuideContent() {
8384 const t = useT();
85+ const auth = useAuth();
8486 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()));
8591
8692 return (
8793 <div class="space-y-6">
@@ -93,7 +99,7 @@ function GuideContent() {
9399 <p class="mt-1 text-xs text-muted-foreground">{t("guide.roles.subtitle")}</p>
94100 </div>
95101
96- <Tabs defaultValue="student" class="w-full">
102+ <Tabs value={selectedRole()} onChange={setSelectedRole} class="w-full">
97103 <TabsList class="w-full justify-start">
98104 <For each={ROLE_TABS}>
99105 {(role) => (
@@ -136,11 +142,11 @@ function GuideContent() {
136142 </div>
137143
138144 <div class="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
139- <For each={STEPS}>
145+ <For each={visibleSteps()}>
140146 {(step) => (
141147 <article
142148 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",
144150 step.borderTone,
145151 )}
146152 >
@@ -174,11 +180,9 @@ function GuideContent() {
174180 </div>
175181
176182 <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>
182186 </Link>
183187 </div>
184188 </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";
1919 import { Input } from "@/components/ui/input";
2020 import { Label } from "@/components/ui/label";
2121 import { SearchableSelect } from "@/components/ui/searchable-select";
22-import { DropdownSelect } from "@/components/ui/select";
2322 import { SidePanel } from "@/components/ui/side-panel";
2423 import { TableRowActions } from "@/components/ui/table-row-actions";
2524
@@ -89,16 +88,6 @@ function HomeworkContent() {
8988 // The şube filter, as on /exams; it lives in the URL beside the table's own
9089 // search and page.
9190 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- });
10291 // A homework subject must sit in the chosen section's resolved subject set.
10392 const [subjects] = createResource(
10493 () => selectedCourseId() || null,
@@ -110,12 +99,9 @@ function HomeworkContent() {
11099 const pageTitle = () => auth.user()?.role === "student" ? t("homework.mineTitle") : t("homework.title");
111100 type DueTab = "all" | "open" | "past";
112101 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.
119105 const [list, { refetch }] = createResource(
120106 () => `${dueTab()}|${courseFilter()}`,
121107 async (key) => {
@@ -125,15 +111,35 @@ function HomeworkContent() {
125111 if (tab === "past") params.due_before = Date.now();
126112 if (course !== "all") params.class_course = course;
127113 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);
129122 setCourseNames(Object.fromEntries([...labels].map(([id, entry]) => [id, entry.label])));
130- return page;
123+ return { items, total: items.length };
131124 },
132125 );
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 ?? "";
133139
134140 createEffect(() => {
135141 if (!createOpen()) return;
136- if (!selectedCourseId()) setSelectedCourseId(manageableCourses()[0]?.id ?? "");
142+ if (!selectedCourseId()) setSelectedCourseId(preferredCourseId());
137143 });
138144
139145 createEffect(() => {
@@ -143,7 +149,7 @@ function HomeworkContent() {
143149 const resetForm = () => {
144150 setTitle("");
145151 setDescription("");
146- setSelectedCourseId(manageableCourses()[0]?.id ?? "");
152+ setSelectedCourseId(preferredCourseId());
147153 setSubjectId("");
148154 setDueDate("");
149155 setDueTime("");
@@ -295,8 +301,10 @@ function HomeworkContent() {
295301 onClearFilters={() => setCourseFilter("all")}
296302 filters={
297303 <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]"
300308 value={courseFilter()}
301309 onChange={(val) => setCourseFilter(val)}
302310 options={courseFilterOptions()}
@@ -317,7 +325,7 @@ function HomeworkContent() {
317325 }
318326 actions={
319327 <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); }}>
321329 <IconPlus class="h-4 w-4" />
322330 {t("homework.add")}
323331 </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";
22 import { createResource } from "@/lib/create-resource";
33 import { getLimits } from "@/api/limits";
44 import { getMealMenus, postMealMenu } from "@/api/meals";
55 import { getSettings } from "@/api/settings";
66 import { formatApiError } from "@/api/client";
77 import { MealDayGroup } from "@/components/meals/meal-day-group";
8+import { MealDayPicker } from "@/components/meals/meal-day-picker";
89 import { MealPublishPanel, type MealPublishInput } from "@/components/meals/meal-publish-panel";
910 import { MealWeekNav } from "@/components/meals/meal-week-nav";
1011 import { DataSection } from "@/components/ui/data-section";
@@ -38,6 +39,7 @@ function MealsContent() {
3839 const today = localIsoDate();
3940 const thisWeek = weekStartIso(today);
4041 const [weekStart, setWeekStart] = createSignal(thisWeek);
42+ const [selectedDate, setSelectedDate] = createSignal(today);
4143 const [slot, setSlot] = createSignal("all");
4244 const [showCreate, setShowCreate] = createSignal(false);
4345 const [flash, setFlash] = createFlash();
@@ -61,6 +63,12 @@ function MealsContent() {
6163 );
6264 return groupMenusByDay(items, slots().map((item) => item.name));
6365 });
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+ };
6472
6573 const publish = async (input: MealPublishInput) => {
6674 await postMealMenu(input);
@@ -100,19 +108,26 @@ function MealsContent() {
100108 locale={intlLocale()}
101109 slot={slot()}
102110 slots={slots()}
103- onWeekChange={setWeekStart}
111+ onWeekChange={changeWeek}
104112 onSlotChange={setSlot}
105113 />
106114 <Suspense fallback={<PageSpinner />}>
107115 <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}>
112117 <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>
116131 </div>
117132 </Show>
118133 </Suspense>
src/pages/messages-page.tsxmodified+20 -17
@@ -2,6 +2,7 @@ import {
22 For,
33 Show,
44 createMemo,
5+ createEffect,
56 createSignal,
67 Suspense,
78 useTransition,
@@ -13,13 +14,12 @@ import { Button } from "@/components/ui/button";
1314 import {
1415 IconArchive,
1516 IconMessage,
16- IconSearch,
1717 IconSend,
1818 IconTrash,
1919 IconPlus,
2020 IconRefresh,
2121 } from "@/components/ui/icons";
22-import { Input } from "@/components/ui/input";
22+import { DataTableSearch } from "@/components/ui/data-table-search";
2323 import { GmailMailRow } from "@/components/messages/gmail-mail-row";
2424 import { GmailMailDetail } from "@/components/messages/gmail-mail-detail";
2525 import { GmailComposeBox } from "@/components/messages/gmail-compose-box";
@@ -67,6 +67,12 @@ export default function MessagesPage() {
6767 ...(args.q ? { q: args.q } : {}),
6868 })
6969 );
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+ });
7076
7177 const [unreadCount, { refetch: refetchUnread }] = createResource(
7278 async () => (await getMessages("inbox", { read: false, limit: 1 })).total
@@ -162,7 +168,7 @@ export default function MessagesPage() {
162168 await Promise.all(trashItems.map((m) => deleteMessageById(m.id)));
163169 setFlash(t("messages.trashEmptiedToast"));
164170 setSelectedId("");
165- refetch();
171+ await refetch();
166172 } catch (err: any) {
167173 console.error("Empty trash error:", err);
168174 setFlash(formatApiError(err));
@@ -265,19 +271,16 @@ export default function MessagesPage() {
265271 {t("common.refresh")}
266272 </Button>
267273
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+ />
281284 </div>
282285
283286 <div class="flex items-center justify-end gap-3">
@@ -327,7 +330,7 @@ export default function MessagesPage() {
327330 when={messages().length > 0}
328331 fallback={
329332 <div class="p-12 text-center text-xs text-muted-foreground">
330- {t("messages.noMessages")}
333+ {query().trim() ? t("common.noResults") : t("messages.noMessages")}
331334 </div>
332335 }
333336 >
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
4848 return status in CORE_ATTENDANCE_LABELS;
4949 }
5050
51+function parseCommaList(value: string): string[] {
52+ return value.split(",").map((part) => part.trim()).filter(Boolean);
53+}
54+
5155 export default function SettingsPage() {
5256 return (
5357 <RouteGuard minRole="manager">
@@ -74,8 +78,8 @@ function SettingsContent() {
7478 const [dietaryTags, setDietaryTags] = createSignal<string[]>([]);
7579 const [mealCutoff, setMealCutoff] = createSignal("");
7680 // 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("");
7983 const [maxExcusedDays, setMaxExcusedDays] = createSignal("");
8084 const [maxUnexcusedDays, setMaxUnexcusedDays] = createSignal("");
8185 const [timezone, setTimezone] = createSignal("");
@@ -98,8 +102,8 @@ function SettingsContent() {
98102 meal_slots: mealSlots(),
99103 dietary_tags: dietaryTags(),
100104 meal_cancel_cutoff_minutes: mealCutoff() === "" ? null : Number(mealCutoff()),
101- excuse_kinds: excuseKinds(),
102- branches: branches(),
105+ excuse_kinds: parseCommaList(excuseKindsText()),
106+ branches: parseCommaList(branchesText()),
103107 max_excused_absent_days: maxExcusedDays() === "" ? null : Number(maxExcusedDays()),
104108 max_unexcused_absent_days: maxUnexcusedDays() === "" ? null : Number(maxUnexcusedDays()),
105109 timezone: timezone().trim() === "" ? null : timezone().trim(),
@@ -119,8 +123,8 @@ function SettingsContent() {
119123 setMealSlots(next.meal_slots.map((slot) => ({ ...slot })));
120124 setDietaryTags([...next.dietary_tags]);
121125 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(", "));
124128 setMaxExcusedDays(next.max_excused_absent_days == null ? "" : String(next.max_excused_absent_days));
125129 setMaxUnexcusedDays(next.max_unexcused_absent_days == null ? "" : String(next.max_unexcused_absent_days));
126130 setTimezone(next.timezone ?? "");
@@ -144,8 +148,8 @@ function SettingsContent() {
144148 max_file_bytes: fileBytes,
145149 meal_slots: mealSlots().map((slot) => ({ name: slot.name.trim(), serving_minute: slot.serving_minute })),
146150 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()),
149153 };
150154 };
151155
@@ -203,7 +207,7 @@ function SettingsContent() {
203207 };
204208
205209 return (
206- <div class="space-y-6">
210+ <div class={dirty() ? "space-y-6 pb-28 md:pb-20" : "space-y-6"}>
207211 <PageHeader
208212 title={t("settings.title")}
209213 description={t("settings.subtitle")}
@@ -249,7 +253,7 @@ function SettingsContent() {
249253
250254 <TabsContent value="assessment" class={TAB_PANEL}>
251255 <Show when={settings()}>
252- <div class="grid gap-4 xl:grid-cols-3">
256+ <div class="grid gap-4 xl:grid-cols-2">
253257 <section class="data-shell flex flex-col overflow-hidden">
254258 <header class="border-b border-border/70 px-4 py-3">
255259 <div class="flex items-start justify-between gap-3">
@@ -665,18 +669,18 @@ function SettingsContent() {
665669 <Label for="excuse-kinds">{t("settings.excuseKinds")}</Label>
666670 <Input
667671 id="excuse-kinds"
668- value={excuseKinds().join(", ")}
672+ value={excuseKindsText()}
669673 placeholder="raporlu, izinli"
670- onInput={(e) => setExcuseKinds(e.currentTarget.value.split(",").map((part) => part.trim()).filter(Boolean))}
674+ onInput={(e) => setExcuseKindsText(e.currentTarget.value)}
671675 />
672676 </div>
673677 <div class="space-y-1.5">
674678 <Label for="branches">{t("settings.branches")}</Label>
675679 <Input
676680 id="branches"
677- value={branches().join(", ")}
681+ value={branchesText()}
678682 placeholder="Matematik, Fizik"
679- onInput={(e) => setBranches(e.currentTarget.value.split(",").map((part) => part.trim()).filter(Boolean))}
683+ onInput={(e) => setBranchesText(e.currentTarget.value)}
680684 />
681685 </div>
682686 </div>
@@ -740,6 +744,20 @@ function SettingsContent() {
740744 </Suspense>
741745 </Tabs>
742746
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+
743761 <ConfirmDialog
744762 open={blocker().status === "blocked"}
745763 onOpenChange={(open) => {
src/pages/staff-work-page.tsxmodified+9 -1
@@ -328,7 +328,15 @@ function StaffWorkContent() {
328328 )}
329329 </For>
330330 </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>
332340 </Show>
333341 </Show>
334342 </div>
src/pages/whiteboards-page.tsxmodified+3 -0
@@ -54,6 +54,9 @@ function WhiteboardsContent() {
5454 );
5555 const [createOpen, setCreateOpen] = createSignal(false);
5656 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+ });
5760 // The server narrows by title via `q`; the page holds whatever the current
5861 // query matched, so totals and pagination already reflect the search.
5962 const visibleBoards = createMemo(() => boards()?.items ?? []);