Skip to content

feat(lib-vuetify): system theme option and assorted small fixes#33

Draft
BatLeDev wants to merge 4 commits into
mainfrom
fix-small-fixes
Draft

feat(lib-vuetify): system theme option and assorted small fixes#33
BatLeDev wants to merge 4 commits into
mainfrom
fix-small-fixes

Conversation

@BatLeDev
Copy link
Copy Markdown
Member

Summary

A batch of unrelated small fixes plus one feature (system theme support).

  • feat(lib-vue, lib-vuetify): 'system' theme option — the OS theme preference (prefers-color-scheme, forced-colors) was previously consulted only on the very first visit, then locked into the theme cookie and never re-evaluated. Mobile devices that toggle light/dark over the day were stuck on the initial choice. 'system' is now an explicit value of the Theme union, resolved to the actual applied theme via a new resolveTheme() helper. A matchMedia listener re-applies the theme reactively (no reload) while the user is on 'system'. The theme-switcher exposes a new "Système" / "System" radio option. Verified that simple-directory does not read the theme cookie server-side and reuses lib-vuetify's theme-switcher directly, so this new cookie value is transparently handled there too.
  • fix(lib-vuetify): root-of-org switch fallback in layout-fetch-error — the 403 "switch account" affordance only matched user memberships when their department exactly equalled the resource's x-owner.department. A user with access only at the root of the organization was never offered a switch, even though root access generally grants visibility over department-scoped resources. The matcher now prefers an exact-department membership and falls back to a root membership of the same org; the current account is excluded from candidates to avoid no-op switches.
  • fix(lib-vuetify): capitalize i18n labels — the "Admin mode" toggle and the four theme-switcher options (Default / Par défaut, Dark / Sombre, High contrast / Contraste élevé, Dark and high contrast / Sombre et contraste élevé) now start with a capital letter. The dead darkMode key (never referenced via t()) is dropped from personal-menu.
  • fix(types-builder): log compiledLayout options before attaching schemas — the compiledLayout {locale} options: ... log was huge because it ran after schemaVjsfOpts.ajvOptions = { schemas: otherSchemas }, which serialized the entire schema collection. The log is now emitted right after delete schemaVjsfOpts.compName, matching the pattern already used in the vjsf section above it.

BatLeDev added 4 commits May 11, 2026 09:58
The `compiledLayout {locale} options: ...` log was huge because it ran
after `schemaVjsfOpts.ajvOptions = { schemas: otherSchemas }`, which
serialized the entire schema collection. Move the log right after the
`delete schemaVjsfOpts.compName` line, before any mutation of
`schemaVjsfOpts`, matching the pattern used in the `vjsf` section.
…witcher

- Admin mode toggle label (fr/en) now starts with a capital letter.
- Theme switcher options (default, dark, high contrast, dark and high contrast)
  now start with a capital letter in both locales.
- Drop the dead `darkMode` i18n key from personal-menu (never referenced via t()).
Previously the OS theme preference (prefers-color-scheme, forced-colors) was
only consulted once on the very first visit; after that the resolved value was
locked in the `theme` cookie and never re-evaluated. On mobile devices that
toggle light/dark over the day, the chosen theme could not follow the OS.

- Add `'system'` to the `Theme` union and store it explicitly in the cookie.
- New `resolveTheme()` helper derives the effective theme via `getDefaultTheme`
  when the user is on 'system' (or when the cookie is absent, which is now
  treated as an implicit 'system' choice).
- Listen to `prefers-color-scheme` and `forced-colors` matchMedia changes and
  re-apply the theme reactively while the user is on 'system' — no reload.
- Expose a 'system' radio option in the theme-switcher (i18n: Système / System).

simple-directory does not read the theme cookie server-side (verified across
its api/ and ui/ sources) and reuses lib-vuetify's theme-switcher directly, so
the new cookie value is transparently handled there too.
…s forbidden

The 403 "switch account" affordance in layout-fetch-error only matched user
memberships when their department exactly equalled the resource's
`x-owner.department`. A user who only had access at the root of the
organization was therefore never offered a switch, even though root access
generally grants visibility over department-scoped resources in
simple-directory's authz model.

- Match the exact department first, then fall back to a root membership of
  the same organization when the resource lives in a department.
- Exclude the current account from candidates so the button is not offered
  when switching would be a no-op.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant