The splash nobody could see, the white flash, and cards that let the aura through
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s

Three things, and the first two were bugs rather than taste.

**The launch screen never appeared.** Its condition was `!ready && !authed`, and `authed` is
true from the saved profile — so a signed-in person (everybody who has ever opened the app)
went straight past it and only a brand-new device ever saw the photo. It now shows for the
first half second on every launch, and beyond that only while there is genuinely nothing to
show yet (no profile and boot still running, the original behaviour, which stops the login
screen flashing before the server config lands). Deliberately not "until ready": boot pulls
from the server, and waiting for it would hide the local copy exactly when the network is
bad — working from that copy is what the offline mode is for.

**The white screen.** Until the app's stylesheet arrives the browser paints its own default,
and the aura's dark base only existed in that stylesheet — so a cold load, or a service
worker swapping in a new bundle, started white. index.html now carries the base colour
inline, and, next to it, a few lines that apply the saved theme and accent before the first
paint: the app reads those after boot, which meant everybody who had chosen anything saw the
defaults flash first. Same storage key the store writes, same resolution of 'system'.

**The cards.** They were solid --surface, which sat on top of the aura and hid it. Salud's
tiles and chart panels are glass now — the family tint over a translucent fill, a hairline
border in the same tint, and a 16px blur with a saturation lift so what shows through stays
readable. The fill is a warm near-black rather than the neutral grey: a cool card over a warm
gradient reads as a dirty edge. The token (`--glass`) is defined per theme, and where
backdrop-filter is unsupported the cards go back to solid, which is the trade the tab bar
already documents — the fallback block sits AFTER the glass rules, or the cascade would have
handed it the blur it cannot render.

Only Salud's cards are glass so far; the rest of the app is still opaque, which is a bigger
decision than this change should make on its own.
This commit is contained in:
dsantillan committed 2026-09-23 11:37:17 -04:00
1 parent c3c1c2836c
commit a0f1f388bc
3 files changed
+56 -4

No files matched your search

+20
View File
@@ -16,6 +16,26 @@
<link rel="manifest" href="manifest.json" crossorigin="use-credentials">
<link rel="apple-touch-icon" href="icon-180.png">
<link rel="icon" type="image/png" href="icon-180.png">
<!-- The first paint must not be white. Until the app's stylesheet arrives the browser paints its
own default, which on a cold load — or while a service worker swaps in a new bundle — is a
white flash before the aura's dark base appears. This one rule is that base colour (index.css
keeps the real one, and overrides this the moment it loads, being later in the document).
The script below it does the same job for the two settings that change the look: the app reads
them after boot, which would otherwise flash the default theme at anybody who chose another.
It reads the same localStorage key the store writes (see store/useStore.js) and resolves
'system' exactly the way App.jsx does. Anything unexpected leaves the defaults in place. -->
<style>html,body{background:#100e0b}</style>
<script>
try {
var saved = JSON.parse(localStorage.getItem('gym_state_v1') || '{}')
var de = document.documentElement
var dark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches
var theme = saved.theme === 'light' || saved.theme === 'dark' ? saved.theme : (dark ? 'dark' : 'light')
de.dataset.theme = theme
if (theme === 'light') document.head.insertAdjacentHTML('beforeend', '<style>html,body{background:#f2f2f7}</style>')
if (saved.accent) de.dataset.accent = saved.accent
} catch (e) { /* a browser with storage blocked still gets the app, just not the no-flash head start */ }
</script>
</head>
<body>
<!-- "Diamond Weave" aura — the atmosphere behind every screen.