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
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:
1 parent
c3c1c2836c
commit
a0f1f388bc
3 files changed
+56
-4
No files matched your search
@@ -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.
|
||||
|
||||
+19
-1
@@ -133,8 +133,26 @@ function Shell() {
|
||||
// bound to the workout, not to the route — checking Stats mid-session keeps the screen on
|
||||
useWakeLock(!!S.active && S.keepAwake !== false)
|
||||
|
||||
// The launch screen is the app's first frame, not a fallback for strangers.
|
||||
//
|
||||
// It used to be `!ready && !authed`, which meant only a brand-new device ever saw it: `authed`
|
||||
// is already true from the saved profile, so a signed-in person went straight past it and the
|
||||
// photo never appeared.
|
||||
//
|
||||
// Two conditions now, for two different jobs. The 500ms floor is what makes it a launch screen —
|
||||
// long enough to read, short enough not to be a delay. Past that, it only keeps covering the app
|
||||
// while there is nothing to show anyway (no profile yet and boot still running), which is the
|
||||
// original behaviour and stops the login screen from flashing before the server config lands.
|
||||
// A signed-in person therefore gets their own data as soon as boot is over, however slow that is:
|
||||
// waiting for `ready` would hide the local copy exactly when the network is bad, and working from
|
||||
// that copy is the whole point of the offline mode this app has.
|
||||
const [bootFloor, setBootFloor] = useState(false)
|
||||
useEffect(() => {
|
||||
const id = setTimeout(() => setBootFloor(true), 500)
|
||||
return () => clearTimeout(id)
|
||||
}, [])
|
||||
const authed = user || isGuest
|
||||
if (!ready && !authed) return (
|
||||
if (!bootFloor || (!ready && !authed)) return (
|
||||
<div id="app">
|
||||
{/* The launch screen: the photo, then the app's own mark on it (see .boot-splash in
|
||||
index.css). Fixed to the viewport, so #app's own padding does not matter here. */}
|
||||
|
||||
+17
-3
@@ -24,6 +24,9 @@
|
||||
--surface: #1c1c1e; /* card / grouped-list fill */
|
||||
--surface-2: #2c2c2e; /* pressed + nested fill */
|
||||
--surface-3: #3a3a3c; /* controls (segmented track, switch off) */
|
||||
/* The translucent card fill. Deliberately a warm near-black rather than the neutral --surface:
|
||||
these cards sit on the aura, and a cool grey over a warm background reads as a dirty edge. */
|
||||
--glass: rgba(26,23,20,.55);
|
||||
|
||||
/* text */
|
||||
--label: #ffffff;
|
||||
@@ -67,6 +70,7 @@
|
||||
--surface: #ffffff;
|
||||
--surface-2: #ececef;
|
||||
--surface-3: #e3e3e8;
|
||||
--glass: rgba(255,255,255,.62);
|
||||
|
||||
--label: #000000;
|
||||
--label-2: rgba(60,60,67,.60);
|
||||
@@ -1327,7 +1331,9 @@ body.chips-dragging *{cursor:inherit}
|
||||
behind the card. The wash is kept low (8%) on purpose — the colour is there to sort the grid at
|
||||
a glance, not to shout, and a saturated tile behind a 26px number would fight the number. */
|
||||
.vh-card{--tint:var(--grey);width:100%;text-align:left;display:block;font:inherit;color:inherit;padding-bottom:10px;
|
||||
background:color-mix(in srgb,var(--tint) 8%,var(--surface))}
|
||||
background:color-mix(in srgb,var(--tint) 10%,var(--glass));
|
||||
border:var(--hair) solid color-mix(in srgb,var(--tint) 22%,transparent);
|
||||
-webkit-backdrop-filter:blur(16px) saturate(150%);backdrop-filter:blur(16px) saturate(150%)}
|
||||
.vh-card .l .icn{color:var(--tint)}
|
||||
.vh-card .v{color:var(--tint)}
|
||||
.vh-unit{margin-left:4px;font-size:14px;font-weight:500;color:var(--label-2);letter-spacing:0}
|
||||
@@ -1350,8 +1356,16 @@ body.chips-dragging *{cursor:inherit}
|
||||
the tiles, so a panel and its card are recognisably the same metric. */
|
||||
.vh-charts{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}
|
||||
.vh-tchart{--tint:var(--grey);width:100%;text-align:left;display:block;font:inherit;color:inherit;
|
||||
padding:12px 10px 6px;background:color-mix(in srgb,var(--tint) 6%,var(--surface))}
|
||||
.vh-tchart:active{background:color-mix(in srgb,var(--tint) 12%,var(--surface-2))}
|
||||
padding:12px 10px 6px;background:color-mix(in srgb,var(--tint) 7%,var(--glass));
|
||||
border:var(--hair) solid color-mix(in srgb,var(--tint) 18%,transparent);
|
||||
-webkit-backdrop-filter:blur(16px) saturate(150%);backdrop-filter:blur(16px) saturate(150%)}
|
||||
.vh-tchart:active{background:color-mix(in srgb,var(--tint) 14%,var(--glass))}
|
||||
/* Same order rule as the tab bar's block: this has to come AFTER the rules above or the glass
|
||||
would win here too. Without a blur, a see-through card over a busy background is worse than an
|
||||
opaque one — the numbers would sit on whatever the aura happens to be doing behind them. */
|
||||
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
|
||||
.vh-card,.vh-tchart{background:color-mix(in srgb,var(--tint) 9%,var(--surface))}
|
||||
}
|
||||
.vh-tchart-hd{display:flex;align-items:baseline;justify-content:space-between;gap:10px;padding:0 2px;margin-bottom:2px}
|
||||
.vh-tchart-t{display:flex;align-items:center;gap:5px;font-size:14px;font-weight:500;color:var(--label-2)}
|
||||
.vh-tchart-t .icn{font-size:15px;color:var(--tint)}
|
||||
|
||||
Reference in new issue
Block a user