fix(pwa): follow the app's theme in the browser bar and toasts, lift toasts over the bottom bar

The theme-color tags followed the operating system's scheme, while the
app's theme is its own setting and defaults to dark: a phone in light
mode showed a light address bar or status bar over the dark app. The
client now rewrites both tags to the theme the page painted. The
toaster read Sonner's "system" for the same reason and now gets the
resolved theme as well.

Below 600 px Sonner stacks toasts 16 px above the bottom edge, which on
a phone is on top of the bottom bar: the "new version" hint covered the
tabs and the add button until dismissed. A mobile offset lifts toasts
above the bar and the home indicator.

pwa-mobile.spec.ts covers the hint's position and its Reload, a bottom
sheet standing on a stand-in keyboard, 16 px fields in portrait and held
sideways, and the sign-in card held sideways.
This commit is contained in:
Marc-André Bombeck committed 2026-10-08 17:24:30 +02:00
1 parent a4ad8ebe92
commit 2cd68779ec
6 files changed
+357 -7

No files matched your search

+5 -2
View File
@@ -9,6 +9,7 @@ import { MonitoringBootstrap } from "@/components/monitoring/bootstrap";
import { WebVitalsReporter } from "@/components/monitoring/web-vitals-reporter";
import { resolveInitialLocale } from "@/lib/i18n/resolve-initial-locale";
import { isKeyMismatch } from "@/lib/boot/key-mismatch-state";
import { THEME_COLOR } from "@/lib/pwa/theme-color";
import { KeyMismatchPage } from "./key-mismatch-page";
const inter = Inter({
@@ -71,9 +72,11 @@ export const viewport: Viewport = {
// the active palette. The hex values are the resolved background of
// `--background` from `app/globals.css` for each theme so the bar
// edge never seams against the page on cold paint.
// The client rewrites both to the app's own theme once it is known
// (`applyThemeColor`), since that need not be the operating system's.
themeColor: [
{ media: "(prefers-color-scheme: light)", color: "#f3f2f5" },
{ media: "(prefers-color-scheme: dark)", color: "#282a36" },
{ media: "(prefers-color-scheme: light)", color: THEME_COLOR.light },
{ media: "(prefers-color-scheme: dark)", color: THEME_COLOR.dark },
],
};