Add timezone selector to Admin settings with full-stack support

- Add `timezone` column to User model (VARCHAR 64, default UTC) with
  idempotent startup migration
- Expose and persist timezone via PATCH /api/users/me
- Fix TimerEvent.occurred_at serialization to include UTC offset marker
  (+00:00) so JavaScript correctly parses timestamps as UTC
- Add frontend utility (src/utils/time.js) with timezone-aware
  formatTime, getHHMM, getDateInTZ, tzDateTimeToUTC helpers and a
  curated IANA timezone list
- Add Settings section to Admin page with timezone dropdown; saves to
  both the API and localStorage for the unauthenticated TV view
- Update Activity Log to display and edit times in the user's timezone
- Update TV dashboard clock to respect the saved timezone
- Update README: features, setup steps, usage table, WebSocket events

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 14:16:37 -08:00
parent fef03ec538
commit 823260cdd8
11 changed files with 230 additions and 24 deletions

View File

@@ -9,7 +9,9 @@ A self-hosted web app for managing homeschool schedules, tracking daily learning
- **TV Dashboard** — Full-screen display for the living room TV. Shows the current subject, countdown timer, day progress, and upcoming schedule blocks. Updates live without page refresh.
- **Schedule Builder** — Create named schedule templates with time blocks assigned to subjects. Assign templates per-child or share across all children.
- **Daily Sessions** — Start a school day against a schedule template. Track which blocks are active, paused, or complete.
- **Activity Log** — Manually log school activities with subject, duration, and notes. Browse and filter history by date.
- **Activity Log** — Automatically records every timer event (start, pause, resume, complete, skip) as a timeline. Supports manual notes with subject, duration, and free text. Browse and filter history by child and date.
- **Behavior Tracking (Strikes)** — Issue up to 3 strikes per child from the Dashboard. Strike count is shown on the TV dashboard and resets automatically when a new school day begins.
- **Timezone Support** — Set your local timezone in Admin → Settings. All activity log timestamps display in your timezone, including the TV dashboard clock.
- **Multi-Child Support** — Manage multiple students under one parent account, each with their own color, schedule, and history.
- **JWT Authentication** — Secure parent login with access tokens and httpOnly refresh cookies. TV dashboard is public (no login required).
@@ -123,9 +125,10 @@ Open **http://localhost:8054/login** and register. This creates your admin accou
1. **Admin** (`/admin`) → Add each child, pick a color
2. **Admin** → Add subjects (Math, Reading, Science, etc.) with emoji icons and colors
3. **Schedules** (`/schedules`) → Create a schedule template, add time blocks assigned to subjects
4. **Dashboard** (`/dashboard`) → Click "Start Day", choose a template
5. **TV** → Open `http://your-lan-ip:8054/tv/1` on the living room TV (replace `1` with the child's ID)
3. **Admin** → Scroll to **Settings** and select your local timezone — this ensures activity log times and the TV clock display correctly
4. **Schedules** (`/schedules`) → Create a schedule template, add time blocks assigned to subjects
5. **Dashboard** (`/dashboard`) → Click "Start Day", choose a template
6. **TV** → Open `http://your-lan-ip:8054/tv/1` on the living room TV (replace `1` with the child's ID)
---
@@ -135,10 +138,10 @@ Open **http://localhost:8054/login** and register. This creates your admin accou
| URL | Description |
|-----|-------------|
| `/dashboard` | Overview, start/stop sessions, timer controls, link to TV view |
| `/dashboard` | Overview, start/stop sessions, timer controls, issue behavior strikes |
| `/schedules` | Create and edit schedule templates and time blocks |
| `/logs` | Browse and add activity log entries |
| `/admin` | Manage children and subjects |
| `/logs` | Browse timer event history and manual activity notes; filter by child and date |
| `/admin` | Manage children, subjects, schedule templates, and account settings (timezone) |
### TV Dashboard (no login)
@@ -207,6 +210,7 @@ The TV dashboard connects to `ws://host/ws/{child_id}` and receives JSON events:
| `resume` | Timer resumed | `session_id`, `block_id` |
| `complete` | Block completed | `session_id`, `block_id` |
| `skip` | Block skipped | `session_id`, `block_id` |
| `strikes_update` | Strike issued/cleared | `child_id`, `strikes` |
---