diff --git a/.claude/skills/api-layer/SKILL.md b/.claude/skills/api-layer/SKILL.md new file mode 100644 index 0000000..5de3546 --- /dev/null +++ b/.claude/skills/api-layer/SKILL.md @@ -0,0 +1,24 @@ +--- +name: api-layer +description: Structure and mandatory-test rules for the src/api/ layer in hezarfen_frontend — domain folders, one verb-first file per endpoint, index re-exports, fetch only in client.ts, and required vitest tests per domain. Load before adding or changing any API endpoint file. +--- + +# API layer + +## Structure + +- Domain-based folders under `src/api/` (e.g. `src/api/notes/`, `src/api/exams/`). +- One file per request under its domain folder, camelCase and verb-first, mirroring the endpoint exactly: `src/api/notes/getNoteById.ts`, `src/api/exams/deleteExamResultByUserId.ts`. +- Each file exports exactly one function matching its filename. +- Each domain must have an `index.ts` re-exporting its endpoints. +- Only `src/api/client/client.ts` calls `fetch` directly. Pages/components never call `fetch` — they call `src/api/` functions inside `createResource`. + +## Tests — mandatory + +Every new or modified API endpoint file must have a corresponding test file at `src/api/__tests__//.test.ts` (one test file per domain, not per endpoint). + +- Use **vitest** (globals enabled) and shared helpers from `src/api/__tests__/helpers/mock-fetch.ts`: `mockFetchSuccess`, `mockFetch204`, `mockFetchError`, `lastFetchCall`. +- Each test asserts correct URL, HTTP method, and request body (when applicable). +- `afterEach` must call `vi.restoreAllMocks()`. +- Run `bun run test` before committing. +- Do not skip or defer API tests — they are part of the definition of done for every API change. diff --git a/.claude/skills/commit-workflow/SKILL.md b/.claude/skills/commit-workflow/SKILL.md new file mode 100644 index 0000000..d158dcf --- /dev/null +++ b/.claude/skills/commit-workflow/SKILL.md @@ -0,0 +1,38 @@ +--- +name: commit-workflow +description: This repo's git commit rules — Conventional-Commit + emoji format, mandatory explicit approval before `git commit`, and the mandatory `bun run build` pre-commit check. Load before proposing or running any commit in hezarfen_frontend. +--- + +# Commit workflow + +## Message format + +Conventional Commits + a short emoji + bullet detail: + +``` +: +- +- +``` + +Example: + +``` +feat: ✨ live exams, Turkish i18n, and mobile tab bar +- mirror the backend exam contract: schedule fields, attempts, + questions/answers, live monitor, /time clock sync, ws proxy +- exam scheduling UI in plain words with client-side window validation +- student exam room: server-judged countdown, WebSocket autosave with + REST fallback, two-step turn-in, review after submit or expiry +- full English/Turkish dictionaries, persisted toggle, localized dates +- bottom tab bar within thumb reach on small screens +``` + +## Rules + +- **Title:** `type: emoji short summary` — `type` ∈ `feat|fix|refactor|chore|docs|style|test|perf`. Short, plain, no marketing tone. +- **Body:** one concrete sub-change per line, technical but plain language. Continuation lines indented two spaces. +- **Language:** every commit message is in English, always — regardless of the conversation language. +- **When to commit:** one commit per significant/complete feature. Not for tiny one-line fixes alone; never commit half-finished or non-building code. +- **Approval is mandatory, no exceptions:** before running `git commit`, show the user the exact proposed message (title + all bullets) and get **explicit approval**. `git commit` never runs before approval — every commit, including small ones. +- **Mandatory pre-commit check:** once approved, right before committing, run `bun run build` (`tsc --noEmit && vite build`) unless a build already passed since the last code change. If the user explicitly waived the build for this action, skip it. On failure, remove unused imports/vars and re-run until green. Only commit once green (or explicitly waived). diff --git a/.claude/skills/dashboard-design/SKILL.md b/.claude/skills/dashboard-design/SKILL.md new file mode 100644 index 0000000..f0f8cc1 --- /dev/null +++ b/.claude/skills/dashboard-design/SKILL.md @@ -0,0 +1,20 @@ +--- +name: dashboard-design +description: Rules for the hezarfen_frontend dashboard/homepage — a read-only status board (no mutations), monochrome palette with semantic-only status color, portal-card layout, grid, and role scoping. Load before editing src/pages/dashboard-page.tsx or the homepage. +--- + +# Dashboard / homepage design + +Reference: `src/pages/dashboard-page.tsx`. The homepage is a **read-only status board**, not a marketing landing or action hub. + +- **No mutations:** no create/edit/delete buttons, no primary CTAs that open forms. Links only navigate to existing list/detail routes. +- **Palette:** monochrome / grayscale surfaces (border, card, muted). No decorative color accents, gradients, activity charts, or multi-tone portal cards. **Semantic color only** for status (active / today / soon / danger). +- **Layout order (top → bottom):** + 1. Compact header — greeting, role chip (neutral), date. + 2. Role-scoped **workspace portal cards** (section links with optional counts). + 3. **Needs attention** + **Upcoming** side by side on `lg+`, stacked on mobile. +- **Portal cards:** horizontal dense rows — icon | title + short desc | optional count. On desktop, title and count share one line as `Title | 12` (pipe separator, mono tabular count). No separate KPI strip repeating the same numbers. +- **Grid:** `1` col mobile → `2` sm → `3` lg → `4` xl. Equal-ish min height; avoid uneven multi-line stat stacks. +- **Role scoping:** card set matches nav/role matrix (student personal tools; teacher teaching tools; manager+ management; admin gets staff-work + users, not personal `/work`). Optional min-role badge is muted/neutral, not rainbow. +- **Attention list:** active / today / soon exams and events only; rows navigate to detail. Empty state is plain text, not a create CTA. +- Do not reintroduce guide marketing blocks, vanity charts, or redundant bottom KPI tiles. diff --git a/.claude/skills/solidjs-pitfalls/SKILL.md b/.claude/skills/solidjs-pitfalls/SKILL.md new file mode 100644 index 0000000..e739d7e --- /dev/null +++ b/.claude/skills/solidjs-pitfalls/SKILL.md @@ -0,0 +1,40 @@ +--- +name: solidjs-pitfalls +description: The two high-cost SolidJS resource pitfalls in hezarfen_frontend — using resource.latest for always-rendered/shell reads to avoid whole-page blanking on refetch, and using a local signal (not mutate/refetch) for live save-on-click toggles to avoid refetch cascades. Load when touching createResource reads outside , polling, or inline PATCH toggles. +--- + +# SolidJS resource pitfalls + +Baseline SolidJS rules (run-once, no destructure, signals, control-flow components) live in `AGENTS.md`. These two are the expensive, non-obvious ones. + +## 1. `resource.latest` for reads outside `` + +A bare `resource()` re-suspends on **every** `refetch()` — not just the first load, and `initialValue` does NOT stop it. If that read sits outside a `` (e.g. an always-rendered badge/count in a shell component mounted beside ``), the suspension bubbles up and **blanks the whole page** for the entire fetch duration, once per poll/refetch. Invisible on a fast local backend; a multi-second blank on a real one. + +Rule: +- Reads under a page's `` → use `resource()`. +- Always-rendered / shell / badge reads of a periodically-refetched resource → use `resource.latest` (last value, no suspend). +- Poll-driven revalidation belongs behind `.latest`. + +## 2. Live save-on-click toggles use a local signal, not `mutate`/`refetch` + +For an inline switch that PATCHes one field (e.g. the exam-review toggle in `exam-detail-page.tsx`): + +- Do NOT `refetch()` the shared resource → re-suspends → page spinner. +- Do NOT `mutate({...res, field})` either → mutating a shared resource changes its object identity, so every *other* `createResource` whose source reads it (directly or via a memo like `hasCourseManagementRights()`) re-runs and refetches, cascading the same spinner. + +Instead keep a local signal, sync from the resource in a `createEffect`, flip optimistically, revert on failure: + +```ts +const [on, setOn] = createSignal(false); +createEffect(() => { const e = res(); if (e) setOn(e.field); }); +const toggle = async (next: boolean) => { + if (saving()) return; + setOn(next); setSaving(true); + try { await patchX(id(), { field: next }); } + catch (err) { setOn(!next); setError(fmt(err)); } + finally { setSaving(false); } +}; +``` + +A correct toggle fires exactly one PATCH and zero GETs. No success toast — the switch position is the feedback. Pitfall #1's `resource.latest` is the read-side companion (survive a refetch without blanking); this is the write-side (don't trigger the refetch at all). `mutate()` (`settings-page.tsx`) is fine for a form that owns its whole resource, but still cascades for a shared one — the local signal is the safe default. diff --git a/.claude/skills/ui-conventions/SKILL.md b/.claude/skills/ui-conventions/SKILL.md new file mode 100644 index 0000000..94d1b62 --- /dev/null +++ b/.claude/skills/ui-conventions/SKILL.md @@ -0,0 +1,44 @@ +--- +name: ui-conventions +description: hezarfen_frontend UI conventions — SidePanel vs full-page, header button sizing/radius, DataTable-only tables, date/time forms, attendance/roll-call rules, Note Import Assistant, and DrawCanvas. Load before building or restyling pages, tables, headers, dialogs, forms, or the notes/draw features. +--- + +# UI conventions + +Active project reference docs (read the relevant one before changing that area): +- `docs/navigation-patterns.md` — interaction rules, role scope, side-panel/full-page decisions, dashboard structure. +- `docs/ui-redesign-tokens.md` — visual density, radius, table, side-panel, status UI, dashboard card conventions. +- `docs/role-scope-matrix.md` — role access matrix for pages/nav/dashboard cards. +- `docs/frontend-next-steps.md` — completed audit summary plus active follow-up notes. +- `docs/backend-ui-alignment-plan.md` — completed archive; not active work unless backend scope changes. + +## Layout & panels + +- Durable resources use full detail pages. Short create/edit/filter work uses `SidePanel`. Destructive actions use confirm dialogs. +- Disclosure sections may defer mounting (request savings) or stay mounted (state preservation) — choose deliberately; avoid hidden heavy requests unless needed. + +## Buttons + +- Header create actions: compact icon+label, consistent size and current radius. +- Page header primary create/add: `size="sm" class="min-w-[7.5rem] rounded-lg"`. Secondary/import: `variant="outline"` with the same size/class. +- Section/sub-panel header actions: `variant="outline" size="sm" class="rounded-lg"` unless matching a page header button. +- Actions inside sub-panels must not duplicate section headers — primary create/add/assign actions go in the header `actions` prop of the parent disclosure or page header. + +## Tables + +- Application tables must use `src/components/ui/data-table.tsx` `DataTable`. +- Actions columns use `w-28 min-w-[7rem] text-center whitespace-nowrap` to prevent truncation of localized headers like `"İŞLEMLER"`. +- Table-page headers fold into the `DataTable` title/description/actions area; do not render a separate `PageHeader` above table-primary pages. +- Search inputs, dropdown filters, filter buttons, and toolbar actions share the same height/radius (`h-9 rounded-lg` unless the shared component changes the standard globally). +- Pages/domain components must not import or render `Table` primitives directly; only the `DataTable` wrapper and table primitive files may. + +## Date/time & attendance + +- Date/time product forms use shared `DatePicker` plus a separate `HH:mm` input. Backend schedule fields are UTC unix-millisecond values; backend rejects newly set past event/exam/session schedules with `400`. Use `GET /time` for server-clock-aware checks when accuracy matters. +- Lesson session roll call is teacher/manager workflow only. Students never self-mark lesson sessions; the session teacher or course manager marks enrolled students, and the session teacher's own presence row is manager-only per backend rules. +- Attendance status UI uses shared localized metadata: label, short detail text, semantic colors. + +## Features + +- **Note Import Assistant:** Raw PDF/TXT/MD converted to structured Markdown via `src/lib/note-importer.ts`. Noise (page numbers, headers/footers, watermarks) removed, PDF mid-sentence line wraps re-joined, headings (`##`) and bullet lists formatted, OCR-unreadable artifacts flagged with `⚠️ Some content may be unreadable due to OCR/extraction issues`. Never invent content or add fluff preamble. Lives in a dedicated `SidePanel` triggered from the Notes page header, right of the "Yeni Not" button. +- **Drawing Canvas (`DrawCanvas`):** Freehand drawings saved as `.hzdraw.png` with embedded scene JSON metadata. Live drawing effects must guard `initialScene` against re-initializing during active strokes. diff --git a/AGENTS.md b/AGENTS.md index 9f89e22..6bfd4eb 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,221 +1,93 @@ # AGENTS.md — Hezarfen Frontend -This file is the persistent rulebook for any agent (OpenCode, Claude Code, etc.) -working in this repository. It applies to every session, not just one-off task -instructions. Always written and read in English. +Persistent rulebook for any agent (Claude Code, Codex, OpenCode, …) in this repo. +Applies to every session. Always written and read in English. + +Keep this file lightweight — hard constraints and repo gotchas only. Detailed +procedures live as loadable references (see **On-demand references** below); open +the relevant one when a task touches that area instead of inlining it here. ## Stack (hard constraints) - SolidJS + TypeScript, Vite scaffold. - Routing: **TanStack Router** (`@tanstack/solid-router`), hand-written code-based - route tree. Only add `@tanstack/router-plugin` (file-based routing) if - explicitly requested later. -- UI: **shadcn-solid** primitives (`src/components/ui/`) following - https://shadcn-solid.com/docs/installation and component docs, styled with - Tailwind CSS. Do not import Kobalte primitives directly from pages/domain - components. If a component is needed, add or update the matching - shadcn-solid-style wrapper under `src/components/ui/` first. Dialogs, - alert dialogs, dropdowns, popovers, and comboboxes must use the documented - shadcn-solid wrapper API. If shadcn-solid does not provide a suitable - component, ask before adding another library or hand-rolling one. -- Runtime dependencies: `solid-js`, `@tanstack/solid-router`, shadcn-solid/Kobalte - peer deps, and `clsx` + `tailwind-merge` + `class-variance-authority` (for - `cn()` and variant helpers, <2KB total). No axios (use `fetch`), no date libs - (`Intl.DateTimeFormat` only), no lodash, no separate state-management library. + route tree. Add `@tanstack/router-plugin` (file-based routing) only if explicitly + requested. +- UI: **shadcn-solid** primitives (`src/components/ui/`) styled with Tailwind. Do + not import Kobalte primitives directly in pages/domain components — add or update + the matching `src/components/ui/` wrapper first. Dialogs, alert dialogs, dropdowns, + popovers, and comboboxes use the documented shadcn-solid wrapper API. If + shadcn-solid lacks a suitable component, ask before adding a library or hand-rolling. +- Runtime deps: `solid-js`, `@tanstack/solid-router`, shadcn-solid/Kobalte peer deps, + `clsx` + `tailwind-merge` + `class-variance-authority` (for `cn()` and variants). + No axios (use `fetch`), no date libs (`Intl.DateTimeFormat` only), no lodash, no + separate state-management library. - Bundle target: under ~70KB gzipped. Justify any addition beyond that. ## Naming & file structure -- **One component per file.** Never two sibling components in the same file. - Exception: shadcn-solid primitive wrapper files under `src/components/ui/` - may export the documented compound component API from one file (for example - `Dialog`, `DialogContent`, `DialogHeader`, `DialogTitle`). -- File name = component name in kebab-case; the exported component is - PascalCase. Example: `note-card.tsx` → `NoteCard`. Colocated files (types, - tests) keep the same base name: `note-card.tsx`, `note-card.types.ts`, - `note-card.test.tsx`. -- Components in the same domain live in the same folder: `components/notes/`, - `components/events/`, `components/exams/`, `components/users/`, - `components/attendance/`, `components/courses/`, `components/marks/`, - `components/sessions/`, `components/messages/`, `components/homework/`, - `components/appointments/`, `components/layout/`, `components/ui/`. +- **One component per file.** Never two sibling components in one file. Exception: + shadcn-solid wrapper files under `src/components/ui/` may export the documented + compound API from one file (`Dialog`, `DialogContent`, `DialogHeader`, …). +- File name = component name in kebab-case; exported component is PascalCase + (`note-card.tsx` → `NoteCard`). Colocated files keep the base name + (`note-card.types.ts`, `note-card.test.tsx`). +- Same-domain components share a folder: `components/notes/`, `events/`, `exams/`, + `users/`, `attendance/`, `courses/`, `marks/`, `sessions/`, `messages/`, + `homework/`, `appointments/`, `layout/`, `ui/`. - Cross-cutting app state lives in `src/stores/` (`auth-context.tsx`, `preferences-context.tsx`) — context providers only, never domain components. School-policy lists (exam kinds, attendance statuses, grade bands) come from - `getSettings()` in a `createResource`, never hardcoded in components. -- **API layer:** Domain-based folders under `src/api/` (e.g., `src/api/notes/`, - `src/api/exams/`). One file per request under its domain folder, camelCase and verb-first, - mirroring the endpoint exactly (`src/api/notes/getNoteById.ts`, - `src/api/exams/deleteExamResultByUserId.ts`). Each file exports exactly one function - matching its filename. Each domain must have an `index.ts` re-exporting its endpoints. - Only `src/api/client/client.ts` calls `fetch` directly. Pages/ - components never call `fetch` — they call `src/api/` API functions inside - `createResource`. -- **API tests — mandatory:** Every new or modified API endpoint file must have a - corresponding test file under `src/api/__tests__//.test.ts` (one - test file per domain, not per endpoint). Tests use **vitest** (globals enabled) and - the shared helpers from `src/api/__tests__/helpers/mock-fetch.ts` (`mockFetchSuccess`, - `mockFetch204`, `mockFetchError`, `lastFetchCall`). Each test asserts the correct - URL, HTTP method, and request body (when applicable). The `afterEach` hook must call - `vi.restoreAllMocks()`. Run all tests with `bun run test` before committing. Do not - skip or defer API tests — they are part of the definition of done for every API - change. - -## SolidJS rules — do not write React patterns - -Solid components run **once**, there is no re-render: - -1. Never destructure props (`function Card({title})` ❌) — use `props.title` - or `splitProps`. -2. Signals are functions: read with `count()`, write with `setCount(v)`. -3. Use `createSignal`, `createMemo`, `createEffect`, `createResource` — never + `getSettings()` in a `createResource`, never hardcoded. +- **API layer** lives under `src/api/` — domain folders, one verb-first file per + endpoint, `fetch` only in `client.ts`, mandatory per-domain tests. Full rules and + the test contract: **api-layer** reference. + +## SolidJS — do not write React patterns + +Solid components run **once**; there is no re-render. + +1. Never destructure props — use `props.title` or `splitProps`. +2. Signals are functions: read `count()`, write `setCount(v)`. +3. Use `createSignal`/`createMemo`/`createEffect`/`createResource` — never `useState`/`useEffect`/`useMemo`, no dependency arrays. -4. Use ``, ``, `/` for conditional/list rendering; - `` + `createResource` for server data. -5. Use `class`, not `className`. Route components are `lazy()`-loaded and wired - into the TanStack Router route tree. -6. **`resource.latest` for reads outside ``.** A bare `resource()` - re-suspends on **every** `refetch()` (not just the first load, and - `initialValue` does NOT stop it). If that read sits outside a `` — - e.g. an always-rendered badge/count in a shell component mounted beside - `` — the suspension bubbles up and **blanks the whole page** for the - entire fetch duration, once per poll/refetch. Invisible on a fast local - backend, a multi-second blank on a real one. Rule: reads under a page's - `` use `resource()`; always-rendered/shell/badge reads of a - periodically-refetched resource use `resource.latest` (last value, no - suspend). Poll-driven revalidation belongs behind `.latest`. -7. **Live save-on-click toggles use a local signal, not `mutate`/`refetch`.** - For an inline switch that PATCHes one field (e.g. the exam-review toggle in - `exam-detail-page.tsx`), do NOT `refetch()` the shared resource (re-suspends - → page spinner) and do NOT `mutate({...res, field})` either — mutating a - shared resource changes its object identity, so every *other* `createResource` - whose source reads it (directly or via a memo like `hasCourseManagementRights()`) - re-runs and refetches, cascading the same spinner. Instead keep a local - signal, sync it from the resource in a `createEffect`, flip it optimistically - on toggle, and revert on failure: - ```ts - const [on, setOn] = createSignal(false); - createEffect(() => { const e = res(); if (e) setOn(e.field); }); - const toggle = async (next: boolean) => { - if (saving()) return; - setOn(next); setSaving(true); - try { await patchX(id(), { field: next }); } - catch (err) { setOn(!next); setError(fmt(err)); } - finally { setSaving(false); } - }; - ``` - A correct toggle fires exactly one PATCH and zero GETs. No success toast — the - switch position is the feedback. Rule #6's `resource.latest` is the read-side - companion (survive a refetch without blanking); this is the write-side (don't - trigger the refetch at all). `mutate()` (`settings-page.tsx`) is fine for a - form that owns its whole resource, but still cascades for a shared one — the - local signal is the safe default. +4. Conditional/list rendering: ``, ``, `/`; server data: + `` + `createResource`. +5. Use `class`, not `className`. Route components are `lazy()`-loaded into the + TanStack Router tree. +6. **Two expensive resource pitfalls** — use `resource.latest` for always-rendered/ + shell reads of a refetched resource (a bare `resource()` re-suspends on every + refetch and blanks the whole page), and drive live save-on-click toggles with a + local signal, not `mutate`/`refetch`. Full explanation + code: **solidjs-pitfalls** + reference. ## Performance - Every route component is `lazy()` (code-split per page). -- Server data always goes through `createResource` → `` (lightweight - fallback), `refetch()` after mutations. +- Server data goes through `createResource` → `` (lightweight fallback), + `refetch()` after mutations. - One `` boundary per page, no spinner-cascades, fixed-height list rows. -## Project docs and current UI rules - -- Treat these docs as active project context before changing related areas: - - `docs/frontend-next-steps.md` — completed audit summary plus active backend-dependent/frontend follow-up notes. - - `docs/navigation-patterns.md` — interaction rules, role scope, side-panel/full-page decisions, dashboard structure. - - `docs/ui-redesign-tokens.md` — visual density, radius, table, side-panel, status UI, and dashboard card conventions. - - `docs/role-scope-matrix.md` — role access matrix for pages/nav/dashboard cards. - - `docs/backend-ui-alignment-plan.md` — completed backend-alignment archive; do not treat it as active work unless backend scope changes. -- Durable resources use full detail pages. Short create/edit/filter work uses `SidePanel`. Destructive actions use confirm dialogs. -- Header create actions use compact icon+label buttons with consistent size and current radius. Page header primary create/add buttons use `size="sm" class="min-w-[7.5rem] rounded-lg"`; secondary/import buttons use `variant="outline"` with the same size/class. Section/sub-panel header actions use `variant="outline" size="sm" class="rounded-lg"` unless matching a page header button. Action buttons inside sub-panels must not duplicate section headers — primary create/add/assign actions must be placed in the header `actions` prop of the parent disclosure or page header. -- Application tables must use `src/components/ui/data-table.tsx` `DataTable`. Actions columns must use `w-28 min-w-[7rem] text-center whitespace-nowrap` to prevent truncation of localized headers like `"İŞLEMLER"`. -- Table-page headers are folded into the `DataTable` title/description/actions area; do not render a separate `PageHeader` above pages whose primary content is a table. Search inputs, dropdown filters, filter buttons, and table toolbar actions must always share the same height and radius (`h-9 rounded-lg` unless the shared component changes the standard globally). -- Pages/domain components must not import or render `Table` primitives directly; only the `DataTable` wrapper and table primitive files may do that. -- **Note Import Assistant**: Raw PDF/TXT/MD files are converted to structured Markdown notes using `src/lib/note-importer.ts`. Noise (page numbers, headers/footers, watermarks) is removed, PDF mid-sentence line wraps are re-joined, headings (`##`) and bullet lists are formatted, and OCR unreadable artifacts are flagged with `⚠️ Some content may be unreadable due to OCR/extraction issues`. Never invent content or fluff preamble. Note Import Assistant lives in a dedicated `SidePanel` triggered from the Notes page header to the right of the "Yeni Not" button. -- **Drawing Canvas (`DrawCanvas`)**: Freehand drawings are saved as `.hzdraw.png` files with embedded scene JSON metadata. Live drawing effects must guard `initialScene` against re-initializing during active strokes. -- Disclosure sections may either defer mounting for request savings or keep content mounted for state preservation; choose deliberately and avoid hidden heavy requests unless needed. -- Date/time product forms use shared `DatePicker` plus a separate `HH:mm` input. Backend schedule fields are UTC unix-millisecond values and the backend rejects newly set past event/exam/session schedules with `400`; use `GET /time` for server-clock-aware checks when accuracy matters. -- Lesson session roll call is teacher/manager workflow only. Students never self-mark lesson sessions; the session teacher or course manager marks enrolled students, and the session teacher's own presence row is manager-only per backend rules. -- Attendance status UI uses shared localized metadata: label, short detail text, and semantic colors. - -## Dashboard / homepage design - -Reference: `src/pages/dashboard-page.tsx`. Homepage is a **read-only status board**, not a marketing landing or action hub. - -- **No mutations** on the dashboard: no create/edit/delete buttons, no primary CTAs that open forms. Links only navigate to existing list/detail routes. -- **Palette:** monochrome / grayscale surfaces (border, card, muted). Decorative color accents, gradients, activity charts, and multi-tone portal cards are out. **Semantic color only** for status (active / today / soon / danger). -- **Layout order (top → bottom):** - 1. Compact header — greeting, role chip (neutral), date. - 2. Role-scoped **workspace portal cards** (section links with optional counts). - 3. **Needs attention** + **Upcoming** side by side on `lg+`, stacked on mobile. -- **Portal cards:** horizontal dense rows — icon | title + short desc | optional count. On desktop, title and count share one line as `Title | 12` (pipe separator, mono tabular count). No separate KPI strip that repeats the same numbers under the cards. -- **Grid:** `1` col mobile → `2` sm → `3` lg → `4` xl. Equal-ish min height; avoid uneven multi-line stat stacks. -- **Role scoping:** card set matches nav/role matrix (student personal tools; teacher teaching tools; manager+ management; admin gets staff-work + users, not personal `/work`). Optional min-role badge on a card is muted/neutral, not rainbow. -- **Attention list:** active / today / soon exams and events only; rows navigate to detail. Empty state is plain text, not a create CTA. -- Do not reintroduce guide marketing blocks, vanity charts, or redundant bottom KPI tiles. - ## Containers -- We use **Podman**, not Docker. Never suggest, generate, or run `docker` / - `docker-compose` commands or a `Dockerfile`-only workflow — use the Podman - equivalents instead: `podman build`, `podman run`, `podman compose` (or - `podman-compose` if that's what's installed), and `Containerfile` (Podman's - name for the same syntax as a Dockerfile; `Dockerfile` also works but prefer - `Containerfile` for new files). -- If a task or a copy-pasted snippet from elsewhere uses `docker ...`, translate - it to the matching `podman ...` command before running or proposing it. - -## Git commit workflow - -**Commit message format** (Conventional Commits + short emoji + bullet detail): - -``` -: -- -- -- ... -``` - -Example: - -``` -feat: ✨ live exams, Turkish i18n, and mobile tab bar -- mirror the backend exam contract: schedule fields, attempts, - questions/answers, live monitor, /time clock sync, ws proxy -- exam scheduling UI in plain words with client-side window validation -- teacher question authoring: choice/written, points, correct pick -- student exam room: server-judged countdown, WebSocket autosave with - REST fallback, two-step turn-in, review after submit or expiry -- teacher live monitor over SSE with answer sheets, auto-score - suggestion, and inline grading -- full English/Turkish dictionaries, persisted toggle, localized dates, - document lang so Turkish casing renders İ correctly -- weight badges speak plain words ("counts ×2" / "×2 sayılır") -- bottom tab bar within thumb reach on small screens -``` - -Rules: - -- **Title:** `type: emoji short summary` — `type` ∈ - `feat|fix|refactor|chore|docs|style|test|perf`. Keep the summary short, - plain, no marketing tone. -- **Body:** one concrete sub-change per line, technical but plain language (the - reader should understand what actually changed). Wrapped lines are indented - two spaces on the continuation, as in the example above. -- **Language:** every commit message is written in English, always — regardless - of what language the conversation with the user is in. -- **When to commit:** one commit per significant/complete feature. Not for tiny - one-line fixes on their own, and never commit half-finished or non-building - code. -- **Approval is mandatory, no exceptions:** before running `git commit`, the - agent shows the user the exact proposed commit message (title + all bullets) - and asks for **explicit approval**. `git commit` never runs before approval - is given. This applies to every commit, including small ones — no exceptions. -- **Mandatory pre-commit check:** once approved, right before running the commit, - run `bun run build` (`tsc --noEmit && vite build`) unless a build has already - passed since the last code change. If the user explicitly says not to run a - build for the current action, do not run it. If the build fails, remove the - unused imports/variables and re-run until it passes. Only commit once the build - is green or the user explicitly waived the build for that action. -- This workflow (format + approval + pre-commit check) applies always, without - exception, to every commit in this repo. +- We use **Podman**, not Docker. Never suggest/generate/run `docker` / + `docker-compose` or a `Dockerfile`-only workflow — use `podman build`, `podman run`, + `podman compose` (or `podman-compose`), and `Containerfile`. Translate any + copy-pasted `docker ...` snippet to the `podman ...` equivalent before running it. + +## On-demand references + +Detailed, area-specific procedures. These live under `.claude/skills//SKILL.md` +— Claude Code auto-loads them when relevant; other agents open the file by path when +a task touches that area. Load the one that matches, not all of them. + +- **commit-workflow** — commit message format, mandatory approval, pre-commit build. +- **api-layer** — `src/api/` structure and the mandatory per-domain vitest contract. +- **solidjs-pitfalls** — `resource.latest` and the save-on-click toggle pattern. +- **ui-conventions** — SidePanel vs page, header buttons, `DataTable`, date/time, + attendance, Note Import Assistant, `DrawCanvas`. +- **dashboard-design** — the read-only status-board homepage rules. + +Project docs under `docs/` remain the deeper reference (`navigation-patterns.md`, +`ui-redesign-tokens.md`, `role-scope-matrix.md`, `frontend-next-steps.md`, +`backend-ui-alignment-plan.md`). diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..dab4c12 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,16 @@ +# CLAUDE.md + +Hezarfen Frontend — SolidJS + TypeScript + TanStack Router + shadcn-solid, built +with Vite/Bun. Read-only status-board dashboard; Turkish/English i18n. + +**The rulebook is `AGENTS.md`** — one source of truth for every agent. Read it first. + +@AGENTS.md + +Detailed, area-specific procedures load on demand as Skills under `.claude/skills/` +(commit-workflow, api-layer, solidjs-pitfalls, ui-conventions, dashboard-design). +Claude Code surfaces them automatically when a task matches; you can also open any +`SKILL.md` directly. Deeper design docs live under `docs/`. + +Keep this file thin. Put durable rules in `AGENTS.md`, detailed procedures in a +Skill — not here.