feat/themes#526
Conversation
…admin and user pages
There was a problem hiding this comment.
Pull request overview
Adds client-side theme persistence and a global theme initializer so the selected theme is applied across the app, alongside a new user-admin “Tema” entry, several SVG logo assets for seeding, and multiple small accessibility/semantic improvements.
Changes:
- Persist selected theme to
localStorageand apply it on app load via a newThemeEnablerclient component. - Refactor theme definitions into a shared module and add a user-admin navigation entry for theme selection.
- Add new seeded SVG assets and make a set of small accessibility/semantic tweaks (aria-labels,
<main>).
Reviewed changes
Copilot reviewed 14 out of 20 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/prisma/seeder/standard_store/images/vevcom_logo.svg | Adds seeded SVG logo asset. |
| src/prisma/seeder/standard_store/images/pwa.svg | Adds seeded SVG logo asset. |
| src/prisma/seeder/standard_store/images/omega_logo_white.svg | Adds seeded SVG logo asset. |
| src/prisma/seeder/standard_store/images/magisk_hatt.svg | Adds seeded SVG logo asset. |
| src/prisma/seeder/standard_store/images/logo_white.svg | Adds seeded SVG logo asset. |
| src/prisma/seeder/standard_store/images/logo_simple.svg | Adds seeded SVG logo asset. |
| src/app/users/[username]/(user-admin)/theme/theme.ts | Introduces theme enum, theme color map, and applyTheme() with localStorage persistence. |
| src/app/users/[username]/(user-admin)/theme/ThemeForm.tsx | Refactors theme picker UI to use shared theme module. |
| src/app/users/[username]/(user-admin)/layout.tsx | Adds “Tema” item to the user-admin sub-nav. |
| src/app/news/page.tsx | Adds aria-label to archive link (but keeps relative href). |
| src/app/layout.tsx | Mounts ThemeEnabler globally and switches content wrapper to <main>. |
| src/app/admin/schools/SchoolAdminList.tsx | Adds aria-label to row link (but keeps invalid Link/table structure). |
| src/app/admin/product/page.tsx | Adds aria-label to product link. |
| src/app/admin/lockers/page.tsx | Adds aria-labels to admin locker links. |
| src/app/admin/groups/[id]/page.tsx | Adds aria-labels and fixes class admin link text. |
| src/app/admin/dots/DotList.tsx | Adds aria-label to the “only active” toggle link. |
| src/app/admin/BackButton.tsx | Adds aria-label to back button link. |
| src/app/_components/UI/ThemeEnabler.tsx | New client component to apply saved theme on hydration. |
| src/app/_components/NavBar/NavBar.tsx | Adds aria-label to home link. |
| src/app/_components/NavBar/Menu.module.scss | Adjusts menu background styling for theme/light-mode compatibility. |
| package-lock.json | Lockfile changes (removes some libc metadata entries). |
Comments suppressed due to low confidence (1)
src/app/users/[username]/(user-admin)/theme/ThemeForm.tsx:12
- These theme cards are rendered as
<a>elements without anhref, so they are not keyboard-focusable and don't have correct button semantics for assistive tech. Use a<button type="button">(or addhref+ properrole/keyboard handlers) for accessible theme selection.
{Object.entries(themes).map(([name, colors]) => (
<a key={name} className={styles.Theme} onClick={() => applyTheme(name as ThemeName)}>
<div className={styles.ThemeHeader}>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
JohanHjelsethStorstad
left a comment
There was a problem hiding this comment.
Looks good. I think in the future it should be saved on session rather than localS.
| return ( | ||
| <html lang="en"> | ||
| <body className={`${inter.className} ${styles.body}`}> | ||
| <ThemeEnabler></ThemeEnabler> |
There was a problem hiding this comment.
autoclose this one maybe
| <NavBar profile={profile} canEditSpecialCmsImage={canEditSpecialCmsImage} /> | ||
| </div> | ||
| <div className={styles.content}> | ||
| <main className={styles.content}> |
There was a problem hiding this comment.
probably a good idea as long as no pages use main internally
| return ( | ||
| <div className={styles.wrapper}> | ||
| <h3>Skapreservasjoner</h3> | ||
| <Link href={'/admin/lockers/location'}>Oppret ny skaplokasjon</Link> |
There was a problem hiding this comment.
Hmmmm I see we have added aria-labels many places. Good ideas (should probably be a lint rule). But why are they written in english?
|
|
||
| return ( | ||
| <div className={styles.ThemeWrapper}> | ||
| {Object.entries(themes).map(([name, colors]) => ( |
There was a problem hiding this comment.
I think you can avoid type cast by looping over enum values
This PR improves the theme system and addresses #514.
Changes
Closes #333
Nice to have