Cards you can see through, a splash that waits, and iOS launch screens
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

**The transparency was there and invisible.** `--glass` was a near-black at 55% alpha, and a
dark film over a dark background reads as solid no matter what the alpha says — so the cards
looked exactly as opaque as before. It is 34% now, the family tint weighs a little more
(14%) and the blur is 10px instead of 16: heavy blur flattens the backdrop into one colour,
which hides the very thing that is supposed to show through.

The opaque `@supports` fallback is gone as well. It was copied from the tab bar, where it is
right — the bar floats over scrolling text — and it is wrong here: a card sits in the page
flow and the only thing behind it is the aura. On any device that took that branch, the
cards were solid by construction.

**The splash now waits, which is what a launch screen does.** It stays until the boot is
finished, with a floor of 1.1s so it can actually be read (a warm boot takes milliseconds,
and a splash that lasts that long is a flicker) and a ceiling of 6s so a request that never
answers cannot hold anybody behind a photograph — their workouts are already local. The mark
pulses slowly while it waits, so it looks like a screen that is loading rather than a
photograph that is stuck.

**The long white is iOS, before any of our code runs.** The deployed HTML already carries
the aura's base colour inline, so what is left is the installed web app's own launch screen:
iOS paints it before the page exists, and without an `apple-touch-startup-image` that
matches the device it paints nothing. Fourteen entries now cover the phone and tablet sizes
the app is opened on, cropped from the same photograph (each device fetches only its own).
build-app-icons.mjs fails when the sizes it generates and the sizes index.html links
disagree, because a missing entry is the blank screen this exists to remove.
This commit is contained in:
dsantillan committed 2026-09-23 11:47:52 -04:00
1 parent 3908dc524a
commit 9e580c4794
20 files changed
+150 -41

No files matched your search

+22 -15
View File
@@ -40,6 +40,13 @@ import CoachIntake from './views/CoachIntake.jsx'
import CoachSetup from './views/CoachSetup.jsx'
import TouchDebug from './components/TouchDebug.jsx'
/* How long the launch screen stays, at minimum and at most. Both are about the same screen: the
floor makes it something you can see (a warm boot finishes in milliseconds, and a splash that
lasts that long is a flicker), the ceiling makes it something that can never hold you — the boot
is a network round trip, and a request that never answers must not trap you behind a photo. */
const SPLASH_MIN_MS = 1100
const SPLASH_MAX_MS = 6000
// last known scrollY per route, so back-navigation can put the page where it was
const scrollPositions = new Map()
@@ -133,26 +140,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.
// The launch screen is a launch screen: it stays while the app is loading, and it is never a
// frame that comes and goes.
//
// 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.
// Three bounds, for three different failures. The MINIMUM is why it can be read at all — boot on
// a warm device finishes in a few milliseconds, and a splash that lasts that long is a flicker.
// `ready` is the behaviour asked for: loading, then the app. The MAXIMUM is the safety net: boot
// pulls from the server, and a request that never comes back must not leave anybody staring at a
// photograph, least of all somebody whose workouts are already in local storage.
//
// 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)
// It used to be `!ready && !authed`, which meant only a brand-new device ever saw it: `authed` is
// true from the saved profile, so a signed-in person went straight past it and never saw the photo.
const [waitedMin, setWaitedMin] = useState(false)
const [waitedMax, setWaitedMax] = useState(false)
useEffect(() => {
const id = setTimeout(() => setBootFloor(true), 500)
return () => clearTimeout(id)
const min = setTimeout(() => setWaitedMin(true), SPLASH_MIN_MS)
const max = setTimeout(() => setWaitedMax(true), SPLASH_MAX_MS)
return () => { clearTimeout(min); clearTimeout(max) }
}, [])
const authed = user || isGuest
if (!bootFloor || (!ready && !authed)) return (
if (!waitedMax && (!ready || !waitedMin)) 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. */}
+27 -10
View File
@@ -22,11 +22,16 @@ vi.mock('./lib/back.js', () => ({ initBackButton: async () => () => {} }))
vi.mock('./lib/push.js', () => ({ syncPushSubscription: async () => {} }))
const { default: App } = await import('./App.jsx')
const { useStore } = await import('./store/useStore.js')
let host, root
beforeEach(() => {
globalThis.IS_REACT_ACT_ENVIRONMENT = true
localStorage.clear()
// The store is a module singleton, so it carries state from one test into the next: `ready` is
// left true by whichever test booted first, and a test about a boot that never finishes has to
// start from a boot that has not finished. `user` goes too, or "signed in" means nothing here.
useStore.setState({ ready: false, user: null })
host = document.createElement('div')
document.body.appendChild(host)
root = createRoot(host)
@@ -42,24 +47,36 @@ describe('the app shell', () => {
expect(host.querySelector('img.boot-logo')?.getAttribute('src')).toBe('logo.png')
})
it('gets past the launch screen and paints a screen', async () => {
it('stays long enough to be seen, then gets out of the way', async () => {
await act(async () => { root.render(<App />) })
// Wait out the 500ms floor, then let boot() settle.
// Past a warm boot, which finishes in milliseconds — and past the 500ms a flicker would have
// ended at. The floor is the whole point: this screen has to be readable, not a flash.
await act(async () => { await new Promise(r => setTimeout(r, 600)) })
expect(host.querySelector('.boot-splash')).toBeTruthy()
// Once the floor is up and boot has finished, the app takes over.
await act(async () => { await new Promise(r => setTimeout(r, 700)) })
expect(host.querySelector('.boot-splash')).toBeNull()
// Something real is on screen — the login door for a device with no profile. The assertion is
// deliberately loose: the point is that the tree rendered, not which screen it chose.
expect(host.textContent.trim().length).toBeGreaterThan(0)
})
it('keeps local data visible when boot is slow, instead of holding the splash', async () => {
// A signed-in device whose boot never finishes (bad network): the splash covers the first half
// second and then gets out of the way, because the local copy is the whole point of offline.
localStorage.setItem('gym_user', JSON.stringify({ id: 'u1', name: 'Test' }))
it('keeps local data behind a boot that never finishes, but not forever', async () => {
// A signed-in device on a network that answers nothing. The splash holds while the app is
// loading — that is what a launch screen does — and the ceiling is what stops it becoming a
// screen you cannot get past: the workouts are already in local storage.
useStore.setState({ user: { id: 'u1', name: 'Test' }, ready: false })
const api = (await import('./lib/api.js')).api
api.mockImplementation(() => new Promise(() => {})) // never resolves
api.mockImplementation(() => new Promise(() => {}))
// Fake timers from BEFORE the render: the component's two timeouts are scheduled on mount, and
// installing them afterwards leaves those on the real clock, so advancing the fake one moves
// nothing. (Learned by watching this test fail with the splash still up.)
vi.useFakeTimers()
await act(async () => { root.render(<App />) })
await act(async () => { await new Promise(r => setTimeout(r, 600)) })
await act(async () => { vi.advanceTimersByTime(1300) })
expect(host.querySelector('.boot-splash')).toBeTruthy() // still loading, still showing it
// ...and the ceiling releases it, six seconds in. Driving that with fake timers is why this
// test takes milliseconds instead of six seconds.
await act(async () => { vi.advanceTimersByTime(6000) })
expect(host.querySelector('.boot-splash')).toBeNull()
vi.useRealTimers()
})
})
+23 -15
View File
@@ -26,7 +26,10 @@
--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);
/* 34%, not 55%: at 55 the fill was technically translucent and visually identical to opaque —
a dark film over a dark background reads as solid, and that is what people saw. This is the one
number to turn if the cards should show more or less of the aura behind them. */
--glass: rgba(20,18,16,.34);
/* text */
--label: #ffffff;
@@ -70,7 +73,7 @@
--surface: #ffffff;
--surface-2: #ececef;
--surface-3: #e3e3e8;
--glass: rgba(255,255,255,.62);
--glass: rgba(255,255,255,.44);
--label: #000000;
--label-2: rgba(60,60,67,.60);
@@ -218,7 +221,14 @@ button,.chip,.tile,.item,.wday,.cal-d,.swatch,.hm-c,.lrow,.seg button,.stp butto
.boot-splash{position:fixed;inset:0;z-index:1;display:grid;place-items:center;overflow:hidden}
.boot-splash img.boot-photo{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.boot-splash::after{content:'';position:absolute;inset:0;background:radial-gradient(circle at 50% 45%,transparent 30%,rgba(16,14,11,.55) 100%)}
.boot-splash img.boot-logo{position:relative;width:104px;height:auto;filter:drop-shadow(0 8px 24px rgba(0,0,0,.45))}
.boot-splash img.boot-logo{
position:relative;width:104px;height:auto;filter:drop-shadow(0 8px 24px rgba(0,0,0,.45));
/* A slow pulse so a screen that is waiting looks like it is waiting. `prefers-reduced-motion`
already switches every animation in this file off (see the top), which is the right answer for
anybody who asked for less movement. */
animation:splash-breathe 1.9s var(--ease) infinite;
}
@keyframes splash-breathe{0%,100%{opacity:.82;transform:scale(1)}50%{opacity:1;transform:scale(1.035)}}
/* Keep the last workout controls clear of the mobile overlays without adding a second
screenful of blank scroll space. The stacked rest timer needs the larger reserve. */
body.resting #app{padding-bottom:calc(206px + var(--sab))}
@@ -1331,9 +1341,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) 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%)}
background:color-mix(in srgb,var(--tint) 14%,var(--glass));
border:var(--hair) solid color-mix(in srgb,var(--tint) 26%,transparent);
-webkit-backdrop-filter:blur(10px) saturate(140%);backdrop-filter:blur(10px) saturate(140%)}
.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}
@@ -1356,16 +1366,14 @@ 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) 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%)}
padding:12px 10px 6px;background:color-mix(in srgb,var(--tint) 9%,var(--glass));
border:var(--hair) solid color-mix(in srgb,var(--tint) 20%,transparent);
-webkit-backdrop-filter:blur(10px) saturate(140%);backdrop-filter:blur(10px) saturate(140%)}
.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))}
}
/* Deliberately NO opaque fallback where backdrop-filter is missing, unlike the tab bar. The bar
floats over scrolling content, where a see-through panel would put text on text; a card sits in
the page flow, and the only thing behind it is the aura. Losing the blur there costs nothing, and
the opaque fallback is exactly what made these cards look solid on a device that took it. */
.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)}