Files
lnet_tutor/docs/angular-frontend-spec.md
2025-10-22 20:14:31 +08:00

38 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Angular Frontend Specification (Minimal)
## Purpose
Render exams from JSON, preserve progress with autosave, support resume, and submit to produce bundled output.
## Routes
- `/` → list of available exams (published finished)
- `/exam/:examId` → exam player (start or resume)
- `/done/:attemptId` → submission confirmation with output file reference
## Data Loading
- On `/exam/:examId`, call `GET /api/exams/:examId` to load exam
- Start/resume via `POST /api/exams/:examId}/attempt` (idempotent: returns existing in-progress attempt if any)
## State & Autosave
- Local reactive form/state per question
- Autosave every N seconds and on blur/change via `PUT /api/attempts/:attemptId`
- Show "Saved just now" status with debounce
## Timer & Submit
- Countdown from `durationMinutes`
- Auto-submit on expiry
- Manual submit → POST submit → redirect to `/done/:attemptId`
## Resume Behavior
- On load, hydrate answers from attempt JSON
- Scroll to last answered question; restore timer based on `startedAt` and `durationMinutes`
## Edge Cases
- Version drift: if exam JSON `metadata.version` differs from attempts `examVersion`, show non-blocking warning
- Connectivity loss: queue autosaves and replay when online
- Double tabs: server enforces single active attempt; UI warns
## Accessibility & UX (minimal)
- Keyboard-first navigation, ARIA roles
- Clear focus states and error messages
- Save status and timer announced politely