diff --git a/README.md b/README.md index 35dd0b9..e5f8ec4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ SolidJS + TypeScript frontend for the Hezarfen REST API. - **SolidJS** + Vite - **TanStack Router** (code-based route tree, lazy pages) -- **Kobalte + Tailwind CSS** UI primitives (shadcn-solid style) +- **shadcn-solid style** UI primitives under `src/components/ui/` - Session cookie auth via Vite dev proxy (same-origin) - **bun** package manager - i18n with EN/TR locale switching @@ -25,7 +25,7 @@ bun run dev Open [http://localhost:5173](http://localhost:5173). -The Vite server proxies `/api/auth`, `/api/users`, `/api/notes`, `/api/events`, `/api/exams`, `/api/courses`, `/api/marks`, `/api/time`, and `/api/health` to the backend so the HttpOnly session cookie stays same-origin while page URLs like `/notes` remain frontend routes on refresh. +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. ## Scripts @@ -40,20 +40,29 @@ The Vite server proxies `/api/auth`, `/api/users`, `/api/notes`, `/api/events`, `student < teacher < manager < admin` — higher roles inherit lower capabilities. Registration always creates a `student`. +Role-based UI rules: + +- `student`: own/enrolled/related courses, exams, marks, attendance, and notes. +- `teacher`: teaching, grading, session, attendance, event, and work-log controls where allowed. +- `manager`: management pages such as settings, terms, reports, and broader school operations. +- `admin`: global management scope for courses, exams, users, settings, and terms. + +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. + ## Pages | Path | Access | Description | |---|---|---| | `/login`, `/register` | Guests | Authentication | -| `/` | Authenticated | Dashboard with widgets | +| `/` | Authenticated | Role-scoped, observation-only dashboard | | `/profile` | Authenticated | Edit personal info (name, email, phone, birth date) | | `/notes` | Student+ | Personal notes CRUD | | `/events`, `/events/:id` | Student+ | Event list & detail (create/edit: teacher+) | -| `/exams` | Student+ | Exam list grouped by course (accordion) | +| `/exams` | Student+ | Exam table with role-scoped course filtering | | `/exams/:id` | Student+ | Exam detail, questions, grading, statistics (teacher+) | | `/exams/:id/live` | Teacher+ | Live monitor / final state roster with pagination & sorting | | `/exam-room/:id` | Student+ | WebSocket-based real-time exam room (auto-save, timer, expiry) | -| `/courses` | Student+ | Course list & exam creation (teacher+) | +| `/courses` | Student+ | Course table; create/edit flows for teacher+ | | `/guide` | Authenticated | App usage guide | | `/admin/users` | Admin | User management | @@ -64,8 +73,27 @@ The Vite server proxies `/api/auth`, `/api/users`, `/api/notes`, `/api/events`, - **Statistics**: graded count, average/min/max marks on exam detail - **Answer sheet**: teacher review of student answers with correct/wrong highlighting - **Profile editing**: update display name, email, phone, birth date +- **Dense tables**: toolbar search/filter, subtle column separators, narrow centered three-dot row actions +- **Side panels**: quick create/edit workflows without losing list context +- **Role-scoped dashboard**: read-only summaries and KPIs by current role - **i18n**: full Turkish / English interface +## UI Patterns + +- Durable resources use full detail pages with breadcrumbs. +- Short create/edit/filter work uses `SidePanel`. +- Destructive actions use confirm dialogs. +- Data-heavy views use `DataToolbar`, `DataTableFrame`, `.data-table`, and `TableRowActions`. +- Date fields use the shared `DatePicker`; date-time flows pair it with an `HH:mm` input. +- Closed disclosure sections should not mount or fetch hidden content. + +## Docs + +- `docs/frontend-next-steps.md` — active backlog and role-based UI audit plan. +- `docs/navigation-patterns.md` — interaction, dashboard, role scope, and table action rules. +- `docs/ui-redesign-tokens.md` — visual density, table, typography, and component conventions. +- `docs/backend-ui-alignment-plan.md` — completed backend alignment archive. + ## Project Structure ``` @@ -74,7 +102,7 @@ src/ ├── components/ # Reusable UI components │ ├── exams/ # Exam card, form, questions panel, answer sheet, WS room │ ├── layout/ # Side nav, page header, role guards -│ ├── ui/ # Design system (Button, Badge, Table, Input, etc.) +│ ├── ui/ # Design system (Button, Badge, Table, SidePanel, row actions, etc.) │ └── users/ # Profile form, user table ├── i18n/ # Message keys + EN/TR dictionaries ├── lib/ # Utilities (format, cn, roles, exam-labels) diff --git a/docs/frontend-next-steps.md b/docs/frontend-next-steps.md index 8e957a9..2f3638d 100644 --- a/docs/frontend-next-steps.md +++ b/docs/frontend-next-steps.md @@ -1,20 +1,63 @@ # Frontend Next Steps -This document tracks the remaining frontend work after the backend contract alignment, -dense table redesign, side-panel rollout, collapsible detail sections, and request-load +This document tracks the active frontend backlog after backend alignment, dense +tables, side panels, collapsible detail sections, dashboard work, and table action cleanup. ## Current State -- Backend alignment work is complete for settings, terms, course sessions, attendance reports, work logs, exam attempts, and grade bands. -- Navigation rules are documented in `docs/navigation-patterns.md`. -- Shared UI primitives now cover dense tables, data toolbars, side panels, confirm dialogs, date picking, and animated disclosures. -- Course detail and exam detail use animated disclosures for large sections. +- Backend alignment is complete for settings, terms, course sessions, attendance reports, work logs, exam attempts, and grade bands. +- Shared UI primitives cover dense tables, data toolbars, row action menus, side panels, confirm dialogs, date picking, and animated disclosures. +- Dashboard is role-aware and read-only. Admin sees global course/exam scope; other roles use own/enrolled/related scope where the backend supports it. +- Table actions use a narrow centered three-dot menu through `TableRowActions`. +- Dense tables have subtle column separators, fixed action columns, and stable date/number alignment. +- Course creator display uses a username/display label when available; raw ids are fallback only. - Closed disclosure sections do not mount their content, so hidden panels do not fetch data. - Settings requests are cached and refreshed after settings patches. -- The Tabler icon dependency was removed after it caused excessive Vite module requests; sidebar icons now use local SVG wrappers. +- Sidebar icons use local SVG wrappers to avoid large icon package module graphs. -## Remaining Work +## Priority 1: Role-Based UI Audit + +Audit every route and major page for role-specific UI behavior. + +- Student: + - sees enrolled courses, related exams, own marks, own attendance, and personal notes. + - must not see teacher/manager/admin create, edit, delete, settings, or user-management controls. +- Teacher: + - sees course/exam/event authoring controls where allowed. + - sees grading, live monitor, attendance/session tools, and work log where allowed. +- Manager: + - sees management pages such as settings, terms, reports, and broader course/event/exam management. + - should not rely on student enrollment scope unless the feature is explicitly personal. +- Admin: + - sees global management scope: all courses, exams, users, settings, terms, and admin-only pages. + - dashboard KPIs and timelines should use global data where available. + +Audit checklist: + +- Sidebar items match role capability. +- Route guards match backend permission expectations. +- Header actions and row actions hide unavailable create/edit/delete operations. +- Dashboard scope matches the current role. +- Tables show user-facing labels, not raw ids, whenever lookup data is available. +- Empty states explain real absence of data, not loading or scope mismatch. + +## Priority 2: README Update + +- Update stack, scripts, and local setup notes. +- Document role hierarchy and UI scope rules. +- Document dashboard behavior and table action standards. +- Link the active docs under `docs/`. +- Keep build verification as `bun run build`. + +## Priority 3: Docs Cleanup + +- Keep `docs/navigation-patterns.md` as the active interaction rulebook. +- Keep `docs/ui-redesign-tokens.md` as the visual system reference. +- Keep `docs/backend-ui-alignment-plan.md` as a completed archive unless backend scope changes. +- Update docs whenever a rule changes; completed implementation plans must not look like active work. + +## Remaining UX Work ### Notes UX @@ -45,77 +88,23 @@ cleanup. - Decide how far to extend the table/toolbar pattern to `events-page`, `notes-page`, `terms-page`, and `settings-page`. - Preserve non-table layouts only where cards communicate the domain better than rows. -## Dashboard Redesign Plan - -The homepage should become a richer, more useful dashboard while staying observation-only. -It must not contain create, edit, delete, or mutation actions. - -### Goals - -- Provide a high-signal overview of the school workspace. -- Make the first screen useful for students, teachers, managers, and admins. -- Keep all cards as links or read-only summaries. -- Reduce unnecessary initial API calls by fetching role-specific data only. - -### Role-Aware Sections - -- Student: - - today and upcoming events - - active/upcoming exams - - report-card snapshot - - enrolled courses - - recent notebook items -- Teacher: - - courses taught - - exams needing questions, monitoring, or grading - - recent attendance/session activity - - upcoming events -- Manager: - - term status - - active courses/events/exams - - settings/terms health links -- Admin: - - user role directory summary - - management links as read-only status cards - -### Layout Direction - -- Use a larger hero/status strip at the top with user context and date. -- Use a dense KPI row below it. -- Add a “Needs attention” panel for items requiring review. -- Add an “Upcoming timeline” panel for events/exams/sessions. -- Add compact linked lists for courses, exams, notes, and attendance summaries. -- Keep one page-level suspense boundary where practical and avoid spinner cascades. - -### Request Budget - -- Dashboard should not blindly fetch notes, events, exams, courses, and marks for every role. -- Target initial request counts: - - Student: at most 3-4 requests. - - Teacher: at most 3-4 requests. - - Manager/admin: at most 2-4 requests. -- If backend later adds a `/dashboard` endpoint, prefer it over multiple list fetches. - ## Request Budget Targets -- `/courses`: max 2-3 initial API calls. +- `/courses`: max 2-4 initial API calls depending on role and lookup needs. - `/courses/:id`: initial detail data only; closed sections should make zero extra requests. - `/exams/:id`: initial exam data only plus role-required summary data; closed sections should make zero extra requests. - `/events/:id`: consider lazy-loading attendance if the route feels heavy. +- Dashboard should avoid broad role-specific requests unless that role actually needs global scope. - Settings-dependent controls should share the cached settings request. -## Docs Cleanup - -- Keep `docs/navigation-patterns.md` as the active interaction rulebook. -- Keep `docs/ui-redesign-tokens.md` as the visual system reference. -- Keep `docs/backend-ui-alignment-plan.md` as a completed archive unless backend scope changes. -- Update docs when a rule changes; do not let completed implementation plans look like active work. - ## Acceptance Checklist - `bun run build` passes. +- Role-based UI audit is complete for sidebar, routes, dashboard, and actions. +- README is current with stack, scripts, roles, UI patterns, and docs links. +- Docs reflect active rules and do not contradict current implementation. - No native `date` or `datetime-local` inputs remain where the shared `DatePicker` should be used. - Closed disclosure sections do not trigger network requests. -- Dashboard remains observation-only. -- Header create buttons use a consistent icon + label style. +- Dashboard remains observation-only and role-scoped. +- Table action columns use centered three-dot menus. - Detail routes do not show stale resource content after navigating between ids. diff --git a/docs/navigation-patterns.md b/docs/navigation-patterns.md index 4d90b84..48c902d 100644 --- a/docs/navigation-patterns.md +++ b/docs/navigation-patterns.md @@ -5,10 +5,26 @@ Use one of two patterns for every new interaction: - Full page: resources with a durable detail view, such as a course, exam, event, user, exam room, or live monitor. Full pages must include breadcrumbs when nested. - Side panel: short contained work that should return the user to the same list context, such as create, quick edit, and filters. -Dashboard pages are observation-only. They may link to resource pages, but they must not contain create, edit, delete, or other mutation actions. A richer dashboard is allowed and encouraged, but every card or CTA must remain read-only navigation. +Dashboard pages are observation-only. They must not contain create, edit, delete, or other mutation actions. A richer dashboard is allowed, but every section must remain informational and role-scoped. + +Role scope rules: + +- Admin sees global management data where the backend allows it. +- Manager sees management-level data and controls, but not admin-only user administration unless explicitly allowed. +- Teacher sees teaching, grading, session, attendance, event, and work-log controls where allowed. +- Student sees own/enrolled/related data only. +- If lookup data is available, show usernames or display names instead of raw ids. Raw ids are fallback only. Admin pages are action-oriented. Lists should use shared toolbar and table primitives, compact rows, sticky headers, fixed status/action columns, and pagination. +Table action rules: + +- Row actions use `TableRowActions` with a centered three-dot trigger. +- Action columns stay narrow and fixed (`3.5rem` on main tables, about `w-14` on compact detail tables). +- Destructive row actions stay in the menu but still open a confirm dialog before mutation. +- Date and numeric columns use stable alignment and tabular/mono text where useful. +- Dense tables use subtle column separators so column boundaries stay visible. + Delete or destructive confirmation stays in a confirm dialog, not a side panel. Header create actions should use a consistent compact button shape: icon plus label, `size="sm"`, and `rounded-sm`. diff --git a/docs/ui-redesign-tokens.md b/docs/ui-redesign-tokens.md index 127bc4b..4b06e42 100644 --- a/docs/ui-redesign-tokens.md +++ b/docs/ui-redesign-tokens.md @@ -62,6 +62,8 @@ Density defaults: - card padding: 16px - radius: 6px - table numerals/IDs use tabular mono +- table action column: narrow, centered, three-dot trigger +- table column separators: subtle border between cells, no heavy gridlines ## Proof Of Concept @@ -72,6 +74,7 @@ Implemented: - grouped accordion sidebar with active category auto-open - compact stat row on top of users page - dense sticky data table styling via `.data-table` +- centered row action dropdowns via `TableRowActions` - role pills with semantic tints - mono IDs and tabular metrics - neutral surfaces, subtle borders, no gradients or decorative cards @@ -79,11 +82,13 @@ Implemented: ## Current Implementation Notes - Data-heavy admin and management views should prefer `DataToolbar`, `DataTableFrame`, and `.data-table`. +- Row-level table actions should use `TableRowActions`; avoid inline action button clusters in table rows. - Quick create/edit flows should use `SidePanel`; destructive actions stay in confirm dialogs. - Durable resources keep full detail pages with breadcrumbs. - Large detail sections can use `SectionDisclosure`, but closed sections must not mount children or fetch data. - Product date inputs should use the shared `DatePicker`; date-time flows should pair it with a compact `HH:mm` input. - Sidebar icons are local SVG wrappers to keep development builds small and avoid large icon package module graphs. +- User-facing tables should prefer usernames/display names over raw ids; show raw ids only as fallback or in explicit id columns. Static wireframe: