feat(profile): Bunyip identity strip + local Preferences (theme, time format, week start) #82

Merged
YousifShkara merged 1 commit from feat/profile-bunyip-identity-preferences into main 2026-06-06 03:43:49 +02:00
Owner

PR #82 introduced /profile, but the identity card on it was sourced from mokosh-server's /auth/me payload, and the only customisable thing on the page was the editable mokosh user row. The user reasonably expects (a) identity to be visibly owned by Bunyip and (b) more knobs to customise their local experience.

Three sections now, layered by ownership:

Identity strip (top). Pulls full name, email, and role from AuthContext instead of mokosh-server's /auth/me. AuthContext is hydrated from the OIDC id_token at sign-in and then refreshed periodically against bunyip's /v1/auth/me (hooks::auth::refresh_user_from_me), so Bunyip is the authoritative source. Renders an initials disc, the name, email, role, and a prominent "Account Settings (Bunyip)" link with a short caption explaining which fields live where.

Personal info (middle). The existing mokosh users-row editable form (first / last name, title, phone, mobile, timezone). Kept editable because a user can go by different names per tenant.

Preferences (bottom). Local-only settings persisted to localStorage via utils::prefs. First cut:

  • Theme: System / Light / Dark. New hooks::theme module wires the choice to the <html class="dark"> Tailwind variant the SPA already uses everywhere. Theme::System watches prefers-color-scheme: dark and re-applies on OS-level changes. Theme application is mounted at the App root via use_apply_theme().
  • Time format: 12h / 24h.
  • First day of week: Sunday / Monday.

Both new prefs read back via prefs::get_str/set_str (added in this PR) and are designed to be consumed by date / time renderers in the rest of the SPA in follow-up changes. The values land in localStorage immediately so a future date formatter just reads the key; no wiring blocks shipping the controls today.

web-sys features: added Element, DomTokenList, MediaQueryList for the theme module's <html> class toggle and prefers-color-scheme listener.

PR #82 introduced `/profile`, but the identity card on it was sourced from mokosh-server's `/auth/me` payload, and the only customisable thing on the page was the editable mokosh user row. The user reasonably expects (a) identity to be visibly owned by Bunyip and (b) more knobs to customise their local experience. Three sections now, layered by ownership: **Identity strip** (top). Pulls full name, email, and role from `AuthContext` instead of mokosh-server's `/auth/me`. `AuthContext` is hydrated from the OIDC id_token at sign-in and then refreshed periodically against bunyip's `/v1/auth/me` (`hooks::auth::refresh_user_from_me`), so Bunyip is the authoritative source. Renders an initials disc, the name, email, role, and a prominent "Account Settings (Bunyip)" link with a short caption explaining which fields live where. **Personal info** (middle). The existing mokosh `users`-row editable form (first / last name, title, phone, mobile, timezone). Kept editable because a user can go by different names per tenant. **Preferences** (bottom). Local-only settings persisted to `localStorage` via `utils::prefs`. First cut: - Theme: System / Light / Dark. New `hooks::theme` module wires the choice to the `<html class="dark">` Tailwind variant the SPA already uses everywhere. `Theme::System` watches `prefers-color-scheme: dark` and re-applies on OS-level changes. Theme application is mounted at the App root via `use_apply_theme()`. - Time format: 12h / 24h. - First day of week: Sunday / Monday. Both new prefs read back via `prefs::get_str/set_str` (added in this PR) and are designed to be consumed by date / time renderers in the rest of the SPA in follow-up changes. The values land in `localStorage` immediately so a future date formatter just reads the key; no wiring blocks shipping the controls today. web-sys features: added `Element`, `DomTokenList`, `MediaQueryList` for the theme module's `<html>` class toggle and `prefers-color-scheme` listener.
feat(profile): Bunyip identity strip + local Preferences (theme, time format, week start)
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
Check / clippy + fmt + tests (pull_request) Successful in 1m2s
83075c4aad
PR #82 introduced `/profile`, but the identity card on it was sourced from mokosh-server's `/auth/me` payload, and the only customisable thing on the page was the editable mokosh user row. The user reasonably expects (a) identity to be visibly owned by Bunyip and (b) more knobs to customise their local experience.

Three sections now, layered by ownership:

**Identity strip** (top). Pulls full name, email, and role from `AuthContext` instead of mokosh-server's `/auth/me`. `AuthContext` is hydrated from the OIDC id_token at sign-in and then refreshed periodically against bunyip's `/v1/auth/me` (`hooks::auth::refresh_user_from_me`), so Bunyip is the authoritative source. Renders an initials disc, the name, email, role, and a prominent "Account Settings (Bunyip)" link with a short caption explaining which fields live where.

**Personal info** (middle). The existing mokosh `users`-row editable form (first / last name, title, phone, mobile, timezone). Kept editable because a user can go by different names per tenant.

**Preferences** (bottom). Local-only settings persisted to `localStorage` via `utils::prefs`. First cut:
- Theme: System / Light / Dark. New `hooks::theme` module wires the choice to the `<html class="dark">` Tailwind variant the SPA already uses everywhere. `Theme::System` watches `prefers-color-scheme: dark` and re-applies on OS-level changes. Theme application is mounted at the App root via `use_apply_theme()`.
- Time format: 12h / 24h.
- First day of week: Sunday / Monday.

Both new prefs read back via `prefs::get_str/set_str` (added in this PR) and are designed to be consumed by date / time renderers in the rest of the SPA in follow-up changes. The values land in `localStorage` immediately so a future date formatter just reads the key; no wiring blocks shipping the controls today.

web-sys features: added `Element`, `DomTokenList`, `MediaQueryList` for the theme module's `<html>` class toggle and `prefers-color-scheme` listener.
YousifShkara deleted branch feat/profile-bunyip-identity-preferences 2026-06-06 03:43:49 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
psa-systems/mokosh-apps!82
No description provided.