π update README.md with latest features, UI/UX design tokens, and route specifications
Browse files at this commitefe7cc0d6ff2fa31d7dc53063693a0d73a70a708Parent: 61fa710- docs
- π update README.md with latest features, UI/UX design tokens, and route specifications
1 changed file +103 -107
- README.md +103 -107
README.mdmodified+103 -107
| @@ -1,134 +1,130 @@ | |||
| 1 | # Hezarfen Frontend | 1 | # Hezarfen Frontend |
| 2 | 2 | ||
| 3 | -SolidJS + TypeScript frontend for the Hezarfen REST API. | 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. |
| 4 | 4 | ||
| 5 | -## Stack | 5 | +--- |
| 6 | 6 | ||
| 7 | -- **SolidJS** + Vite | 7 | +## π Key Highlights & UI/UX Experience |
| 8 | -- **TanStack Router** (code-based route tree, lazy pages) | ||
| 9 | -- **shadcn-solid style** UI primitives under `src/components/ui/` | ||
| 10 | -- Session cookie auth via Vite dev proxy (same-origin) | ||
| 11 | -- **bun** package manager | ||
| 12 | -- i18n with EN/TR locale switching | ||
| 13 | 8 | ||
| 14 | -## Prerequisites | 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. | ||
| 15 | 17 | ||
| 16 | -- Node.js 20+ (or bun) | 18 | +--- |
| 17 | -- Hezarfen backend running at `http://127.0.0.1:8080` | ||
| 18 | 19 | ||
| 19 | -## Setup | 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 | +- Hezarfen backend running at `http://127.0.0.1:8080` (or proxied via Vite) | ||
| 35 | + | ||
| 36 | +### Installation & Development | ||
| 20 | 37 | ||
| 21 | ```bash | 38 | ```bash |
| 39 | +# Install dependencies | ||
| 22 | bun install | 40 | bun install |
| 41 | + | ||
| 42 | +# Start Vite development server | ||
| 23 | bun run dev | 43 | bun run dev |
| 24 | -``` | ||
| 25 | 44 | ||
| 26 | -Open [http://localhost:5173](http://localhost:5173). | 45 | +# Run unit tests |
| 46 | +bun run test | ||
| 27 | 47 | ||
| 28 | -The Vite server proxies `/api/*` to the backend so the HttpOnly session cookie stays same-origin while page URLs like `/notes` remain frontend routes on refresh. | 48 | +# Typecheck and build production bundle |
| 49 | +bun run build | ||
| 50 | +``` | ||
| 29 | 51 | ||
| 30 | -## Scripts | 52 | +Open [http://localhost:5173](http://localhost:5173) in your browser. |
| 31 | 53 | ||
| 32 | -| Command | Description | | 54 | +> **Proxy Note**: Vite server automatically proxies `/api/*` and WebSocket connections (`/ws/*`) to `http://127.0.0.1:8080`, preserving HttpOnly session cookies across same-origin calls. |
| 33 | -|---|---| | ||
| 34 | -| `bun run dev` | Start Vite dev server | | ||
| 35 | -| `bun run build` | Typecheck + production build | | ||
| 36 | -| `bun run preview` | Preview production build | | ||
| 37 | -| `bun run check` | Typecheck only | | ||
| 38 | 55 | ||
| 39 | -## Roles | 56 | +--- |
| 40 | 57 | ||
| 41 | -`student < teacher < manager < admin` β higher roles inherit lower capabilities. Registration always creates a `student`. | 58 | +## π₯ Role Scope Matrix |
| 42 | 59 | ||
| 43 | -Role-based UI rules: | 60 | +`student < teacher < manager < admin` β Higher roles inherit lower capabilities. Public registration creates a `student`. |
| 44 | 61 | ||
| 45 | -- `student`: own/enrolled/related courses, exams, marks, attendance, and notes. | 62 | +| Role | Access & Capabilities | |
| 46 | -- `teacher`: teaching, grading, session, attendance, event, and work-log controls where allowed. | 63 | +|---|---| |
| 47 | -- `manager`: management pages such as settings, terms, reports, and broader school operations. | 64 | +| **Student (`student`)** | Personal notebook, PDF import, drawing canvas, enrolled courses, live exam room, question bank, pomodoro focus log, personal report card & attendance history. | |
| 48 | -- `admin`: global management scope for courses, exams, users, settings, and terms. | 65 | +| **Teacher (`teacher`)** | Course/study creation, student enrollment, lesson session roll call, exam question authoring, live exam monitoring, answer sheet grading, and solution verification. | |
| 66 | +| **Manager (`manager`)** | Academic settings, term definitions, attendance reports, global course/exam oversight, and staff work logs. | | ||
| 67 | +| **Admin (`admin`)** | Global management scope across all users, role assignments, system policies, settings, and terms. | | ||
| 49 | 68 | ||
| 50 | -Dashboard and table summaries must use the same role scope as the related page. Admin views global data; non-admin roles should not accidentally see global course/exam scope. | 69 | +--- |
| 51 | 70 | ||
| 52 | -## Pages | 71 | +## πΊοΈ Page Routes & System Navigation |
| 53 | 72 | ||
| 54 | -| Path | Access | Description | | 73 | +| Path | Access Scope | Description | |
| 55 | |---|---|---| | 74 | |---|---|---| |
| 56 | -| `/login`, `/register` | Guests | Authentication | | 75 | +| `/login`, `/register` | Guests | Authentication with same-origin cookie management. | |
| 57 | -| `/` | Authenticated | Role-scoped observation dashboard (portal cards + attention/upcoming) | | 76 | +| `/` | Authenticated | Read-only observation dashboard with role-scoped portal cards, attention items, and upcoming events. | |
| 58 | -| `/profile` | Authenticated | Edit personal info (name, email, phone, birth date) | | 77 | +| `/guide` | Authenticated | Redesigned product guide featuring role scope matrix, 6 core feature cards, and pro tips. | |
| 59 | -| `/notes` | Student+ | Personal notebook CRUD with paper-style cards, side-panel create, reader panel, file attachments | | 78 | +| `/profile` | Authenticated | User profile management (display name, email, phone, birth date). | |
| 60 | -| `/events`, `/events/:id` | Student+ | Event list & detail with search, time filters, and lazy attendance roster | | 79 | +| `/notes` | Student+ | Personal notebook with paper-style cards, Note Import Assistant (PDF/TXT), reader drawer, file attachments, and `.hzdraw` live canvas. | |
| 61 | -| `/exams` | Student+ | Exam table with role-scoped course filtering | | 80 | +| `/questions`, `/questions/:id` | Student+ | Community Question Bank with solution authoring and teacher verification. | |
| 62 | -| `/exams/:id` | Student+ | Exam detail, draft/publish state, subject-tagged questions, grading, statistics (teacher+) | | 81 | +| `/courses`, `/courses/:id` | Student+ | Course catalog, student enrollment, curriculum subjects, homework assignments, and lesson session roll call. | |
| 63 | -| `/exams/:id/live` | Teacher+ | Live monitor / final state roster with pagination & sorting | | 82 | +| `/exams`, `/exams/:id` | Student+ | Exam list and details, subject-tagged questions, draft/publish controls, and grading statistics. | |
| 64 | -| `/exam-room/:id` | Student+ | WebSocket-based real-time exam room (auto-save, timer, local expiry close) | | 83 | +| `/exam-room/:id` | Student+ | WebSocket real-time exam room with autosave, server timer (`/time`), and automatic turn-in on expiry. | |
| 65 | -| `/courses` | Student+ | Course table with search and term filters; create/edit flows for teacher+ | | 84 | +| `/exams/:id/live` | Teacher+ | Live exam monitor over SSE/polling with answer sheets, auto-score suggestions, and inline grading. | |
| 66 | -| `/courses/:id` | Student+ | Course/study/club detail, capacity, subjects, exams, roster, lesson sessions, and roll call tools | | 85 | +| `/events`, `/events/:id` | Student+ | Campus event list and detail views with search filters and attendance roster. | |
| 67 | -| `/pomodoro` | Student | Server-stamped student focus log | | 86 | +| `/calendar` | Student+ | Full calendar view with sky-blue container, event & exam markers, and day detail inspection. | |
| 68 | -| `/guide` | Authenticated | App usage guide | | 87 | +| `/marks` | Student+ | Report card with weighted exam average calculations and course breakdown. | |
| 69 | -| `/admin/users` | Admin | User management | | 88 | +| `/messages` | Student+ | Messaging portal with folder navigation, unread badges, and micro-animations. | |
| 70 | - | 89 | +| `/pomodoro` | Student | Student focus log with server-stamped session tracking. | |
| 71 | -## Features | 90 | +| `/admin/users` | Admin | User account administration and role assignment. | |
| 72 | - | 91 | + |
| 73 | -- **Exam lifecycle**: create (scheduled/async/unscheduled), automatic async duration from start/end, subject-tagged questions (multiple-choice / text), real-time WebSocket exam room, auto-close on expiry, teacher grading | 92 | +--- |
| 74 | -- **Live monitor**: 2-second polling during active exams, static final state view after exam ends, pagination (10/page), column sorting | 93 | + |
| 75 | -- **Statistics**: graded count, average/min/max marks on exam detail | 94 | +## π¨ UI/UX Design System Tokens |
| 76 | -- **Answer sheet**: teacher review of student answers with correct/wrong highlighting | 95 | + |
| 77 | -- **Profile editing**: update display name, email, phone, birth date | 96 | +- **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. |
| 78 | -- **Dense tables**: toolbar search/filter, subtle column separators, narrow centered three-dot row actions | 97 | +- **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). |
| 79 | -- **Side panels**: quick create/edit workflows without losing list context | 98 | +- **Tab Indicators**: Recessed list tracks, stationary pill triggers, halo ring glow outlines, and alternating accent lines. |
| 80 | -- **Course sessions**: right-panel session creation and paginated roll call panels | 99 | +- **Button Styling**: Γelebi-themed translucent fill (`bg-primary/15`), hairline borders, and subtle rings (`ring-1 ring-primary/25`). |
| 81 | -- **Course subjects**: course/study curriculum topics managed on the detail page; every exam question must pick one | 100 | +- **Invisible Scrollbars**: Functional scrolling without visible scrollbar clutter across all browsers (`scrollbar-width: none`). |
| 82 | -- **Course capacity**: optional roster cap on course/study/club enrollment | 101 | + |
| 83 | -- **Pomodoro**: student-only server-stamped focus sessions with total focus history | 102 | +--- |
| 84 | -- **Schedule validation**: event, exam, and lesson-session forms use `GET /time` for server-clock-aware past-date warnings before submit | 103 | + |
| 85 | -- **Notebook**: paper-style note cards; create in `SidePanel`; read in reader panel with attachments; three-dot card actions for edit/delete | 104 | +## π Project Directory Structure |
| 86 | -- **Note Import Assistant**: convert uploaded PDF, TXT, or Markdown files into clean, structured notes ready for the notebook. Automatically strips page numbers and header noise, joins split PDF sentences, formats Markdown headings and bullet points, and flags OCR extraction issues | ||
| 87 | -- **Freehand Drawing Canvas (`DrawCanvas`)**: unbounded pannable/zoomable drawing canvas with pen, eraser, grid paper ruling, and PNG metadata JSON embedding (`.hzdraw.png`) | ||
| 88 | -- **Note files**: per-note upload/list/download/delete via native `FormData`; school `max_file_bytes` from settings | ||
| 89 | -- **Events and courses**: event cards with schedule status chips + toolbar search/time filters; courses table with search and term filters | ||
| 90 | -- **Attendance UI**: localized status labels with explanatory detail text and semantic colors | ||
| 91 | -- **Role-scoped dashboard**: monochrome observation board β portal cards (`Title | count`), drag-and-drop & delta move reordering in edit mode, needs-attention and upcoming lists only | ||
| 92 | -- **Empty states**: shared `EmptyState` with optional create CTA where the role can mutate | ||
| 93 | -- **Mutation feedback**: short auto-clear success flash (`createFlash` + success `Alert`) after create/save/delete; not used for exam-room autosave | ||
| 94 | -- **i18n**: full Turkish / English interface | ||
| 95 | - | ||
| 96 | -## UI Patterns | ||
| 97 | - | ||
| 98 | -- Durable resources use full detail pages with breadcrumbs. | ||
| 99 | -- Short create/edit/filter work uses `SidePanel`. | ||
| 100 | -- Destructive actions use confirm dialogs. | ||
| 101 | -- Form dialogs dismiss with the header close control (outside click / ESC disabled to avoid click-through races). | ||
| 102 | -- Data-heavy views use `DataToolbar`, `DataTableFrame`, `.data-table`, and `TableRowActions`. | ||
| 103 | -- Large list pages should use server-side pagination/search/filtering when the backend supports it; client-side slicing is only acceptable for small or temporary datasets. | ||
| 104 | -- Date fields use the shared `DatePicker`; date-time flows pair it with an `HH:mm` input. | ||
| 105 | -- Start/end date-time rows use equal-width date and time controls. | ||
| 106 | -- Disclosure sections either defer hidden content for request savings or preserve mounted content when local state should not reset. | ||
| 107 | -- Event detail attendance roster is teacher-only and lazy-loaded when its disclosure opens. | ||
| 108 | -- Schedule status chips share `src/lib/schedule-status.ts` tones (active / upcoming / finished / muted). | ||
| 109 | -- Note attachments live in the note reader panel. Upload uses native `FormData`; downloads are same-origin links to `/api/notes/{id}/files/{file_id}`. Backend remains authoritative for the 10-file cap and payload validation. | ||
| 110 | -- App providers (`PreferencesProvider`, `AuthProvider`) wrap `RouterProvider` so every route and pending shell can use auth/preferences context. | ||
| 111 | - | ||
| 112 | -## Docs | ||
| 113 | - | ||
| 114 | -- `docs/frontend-next-steps.md` β completed frontend audit summary and backend-dependent follow-ups. | ||
| 115 | -- `docs/navigation-patterns.md` β interaction, dashboard, role scope, and table action rules. | ||
| 116 | -- `docs/ui-redesign-tokens.md` β visual density, table, typography, and component conventions. | ||
| 117 | -- `docs/backend-ui-alignment-plan.md` β completed backend alignment archive. | ||
| 118 | - | ||
| 119 | -## Project Structure | ||
| 120 | 105 | ||
| 121 | ``` | 106 | ``` |
| 122 | src/ | 107 | src/ |
| 123 | -βββ api/ # API client, types, endpoint functions | 108 | +βββ api/ # Endpoint functions organized by domain (notes, exams, courses, etc.) |
| 124 | -βββ components/ # Reusable UI components | 109 | +β βββ __tests__/ # Vitest endpoint tests (100% API coverage) |
| 125 | -β βββ exams/ # Exam card, form, questions panel, answer sheet, WS room | 110 | +βββ components/ # Domain & UI components |
| 126 | -β βββ layout/ # Side nav, page header, role guards | 111 | +β βββ exams/ # Exam cards, forms, live monitor, WS room |
| 127 | -β βββ ui/ # Design system (Button, Badge, Table, SidePanel, row actions, etc.) | 112 | +β βββ layout/ # AppShell, PageHeader, Sidebar, RouteGuard |
| 128 | -β βββ users/ # Profile form, user table | 113 | +β βββ notes/ # Note cards, reader panel, file attachment manager |
| 129 | -βββ i18n/ # Message keys + EN/TR dictionaries | 114 | +β βββ ui/ # Design system (Button, Badge, DataTable, SidePanel, Tabs, etc.) |
| 130 | -βββ lib/ # Utilities (format, cn, roles, exam-labels, flash, schedule-status) | 115 | +β βββ users/ # User search, profile form, admin user table |
| 131 | -βββ pages/ # Route-level page components | 116 | +βββ i18n/ # Localization dictionaries (TR / EN) and MessageKey types |
| 132 | -βββ routes/ # TanStack Router tree | 117 | +βββ lib/ # Shared utilities (domain-colors, note-importer, stroke-smoothing, etc.) |
| 133 | -βββ stores/ # Auth, preferences (locale, theme) contexts | 118 | +βββ pages/ # Lazy-loaded page components for TanStack Router |
| 119 | +βββ routes/ # TanStack Router route tree definition | ||
| 120 | +βββ stores/ # Cross-cutting contexts (AuthContext, PreferencesContext) | ||
| 134 | ``` | 121 | ``` |
| 122 | + | ||
| 123 | +--- | ||
| 124 | + | ||
| 125 | +## π Commit & Quality Workflow | ||
| 126 | + | ||
| 127 | +All contributions adhere to the strict repository rulebook (`AGENTS.md`): | ||
| 128 | + | ||
| 129 | +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. | ||
| 130 | +2. **Conventional Commits**: Format `type: emoji short summary` with technical bullet details written in English. | ||