docs: record 3-tab UI build-out (admin dashboard + date filter, personal dashboard, training difficulty, settings)
This commit is contained in:
@@ -38,3 +38,4 @@ Informed by MiroFish (CrowdSight engine) + the hermes-brain-and-tools CrowdSight
|
|||||||
- `2026-08-07-docker-final.md` — Docker build fix: ship prebuilt frontend/dist, no npm in image (resolves repeated `vite: not found`).
|
- `2026-08-07-docker-final.md` — Docker build fix: ship prebuilt frontend/dist, no npm in image (resolves repeated `vite: not found`).
|
||||||
- `2026-08-07-login-after-setup.md` — can't-login-after-setup = deployment data non-persistence, not login logic (verified).
|
- `2026-08-07-login-after-setup.md` — can't-login-after-setup = deployment data non-persistence, not login logic (verified).
|
||||||
- `2026-08-07-login-email-fix.md` — REAL fix: verify() resolves username OR email; "wrong password" after logout→login was email-login not resolving a user.
|
- `2026-08-07-login-email-fix.md` — REAL fix: verify() resolves username OR email; "wrong password" after logout→login was email-login not resolving a user.
|
||||||
|
- `2026-08-07-ui-tablayout.md` — 3-tab UI per spec: admin dashboard + date filter, personal dashboard, training w/ difficulty, settings profile.
|
||||||
|
|||||||
38
docs/engineering-log/2026-08-07-ui-tablayout.md
Normal file
38
docs/engineering-log/2026-08-07-ui-tablayout.md
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# 2026-08-07 — UI: 3-tab layout per spec (admin overview w/ date filter, personal dashboard, training, settings)
|
||||||
|
|
||||||
|
## Spec (from user)
|
||||||
|
1. Settings page: user/profile settings + change password.
|
||||||
|
2. 3-tab UI:
|
||||||
|
- 2.1 Dashboard ภาพรวม (admin only): overall user stats + DATE FILTER.
|
||||||
|
- 2.2 Personal dashboard: per-user results (admin also has it — admins train too).
|
||||||
|
- 2.3 Training: product list -> persona list w/ difficulty; admin sees full persona
|
||||||
|
data + edit + "add product" button (generate new personas).
|
||||||
|
|
||||||
|
## Implemented (commit `b05907a`)
|
||||||
|
- **Tab 1 Admin overview (`/`)** = Analytics.vue: headline stats (sessions/wins/losses/close
|
||||||
|
rate/avg score/trainees) + **date filter** (`?from=YYYY-MM-DD&to=YYYY-MM-DD` on session
|
||||||
|
`created_at`) + hardest personas + admin quick actions (Users / + Add product).
|
||||||
|
- **Tab 2 My dashboard (`/my/board`)** = MyBoard.vue: win/lose/not-tried summary + recent
|
||||||
|
sessions. Backend `/api/me/board` + `/api/chat/sessions` now allow ANY authenticated user
|
||||||
|
(so admins can view their personal dashboard too), not just role=user.
|
||||||
|
- **Tab 3 Training (`/training`)** = Training.vue: product list w/ status badge + persona count;
|
||||||
|
admins see ALL groups (draft -> analyze/edit, ready -> manage), trainees see ready only;
|
||||||
|
on product click -> personas list showing **difficulty** (1-5 stars); admins get the
|
||||||
|
Manage-personas route (`/admin/groups/:gid/edit`).
|
||||||
|
- **Settings (`/settings`)** = Settings.vue: profile (name/email) + change password + language.
|
||||||
|
Added self-service `PATCH /api/auth/profile` (updates name/email for any authed user) +
|
||||||
|
`UserStore.set_name`.
|
||||||
|
|
||||||
|
## Backend changes
|
||||||
|
- analytics_routes: date-range filter (`from`/`to`) on session created_at.
|
||||||
|
- auth_routes: `PATCH /api/auth/profile`.
|
||||||
|
- users.py: `set_name`.
|
||||||
|
- me_routes / chat_routes: removed strict `require_roles("user")` on /api/me/board and
|
||||||
|
/api/chat/sessions (still auth-gated + self-scoped).
|
||||||
|
|
||||||
|
## Verification
|
||||||
|
- Frontend `npm run build` ok (fixed a duplicate `style` attr in Analytics.vue that broke parse).
|
||||||
|
- Backend tests m0 / setup / e2e all pass.
|
||||||
|
- Live server: `/api/analytics?from&to` returns filtered results; `PATCH /api/auth/profile`
|
||||||
|
updates name (200); served SPA references the fresh chunk.
|
||||||
|
- Pushed to `git.moreminimore.com/kunthawat/sales-trainer` (`b05907a`).
|
||||||
Reference in New Issue
Block a user