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

+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">
<!-- iOS launch screens. An installed web app paints this before a line of our code runs, and
without it that screen is blank — the white flash on every open that no CSS can reach. Each
entry is one device's exact pixel size, generated from the same photograph as the in-app splash
by scripts/build-app-icons.mjs, which fails when this list and its own table drift apart.
iOS shows nothing at all when no entry matches, so the table matters more than the file count. -->
<link rel="apple-touch-startup-image" href="startup/750x1334@2.jpg" media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="startup/1242x2208@3.jpg" media="(device-width: 414px) and (device-height: 736px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/1125x2436@3.jpg" media="(device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/828x1792@2.jpg" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="startup/1242x2688@3.jpg" media="(device-width: 414px) and (device-height: 896px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/1170x2532@3.jpg" media="(device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/1179x2556@3.jpg" media="(device-width: 393px) and (device-height: 852px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/1206x2622@3.jpg" media="(device-width: 402px) and (device-height: 874px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/1284x2778@3.jpg" media="(device-width: 428px) and (device-height: 926px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/1290x2796@3.jpg" media="(device-width: 430px) and (device-height: 932px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/1320x2868@3.jpg" media="(device-width: 440px) and (device-height: 956px) and (-webkit-device-pixel-ratio: 3)">
<link rel="apple-touch-startup-image" href="startup/1536x2048@2.jpg" media="(device-width: 768px) and (device-height: 1024px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="startup/1668x2388@2.jpg" media="(device-width: 834px) and (device-height: 1194px) and (-webkit-device-pixel-ratio: 2)">
<link rel="apple-touch-startup-image" href="startup/2048x2732@2.jpg" media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2)">
<!-- 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
Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 191 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

+51 -1
View File
@@ -20,7 +20,7 @@
* and the icon reads as one piece at 180 px. Change ICON_BG to re-skin all of them at once.
*/
import sharp from 'sharp'
import { existsSync, readFileSync } from 'node:fs'
import { existsSync, mkdirSync, readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
// sharp takes paths, not file: URLs — hence fileURLToPath here and in icon() below.
@@ -116,4 +116,54 @@ if (splashMissing) {
.toFile(fileURLToPath(new URL('splash.jpg', RES)))
const nativeOut = readFileSync(fileURLToPath(new URL('splash.jpg', RES)))
console.log(` resources/splash.jpg native source 2732x2732 bg ${SPLASH_BG} ${(nativeOut.length / 1024 / 1024).toFixed(1)} MB`)
/* --------------------------------------------------- iOS launch screens --
*
* An installed iOS web app paints its OWN screen before any of this code runs, and without these it
* is a blank — the white flash on every open that no amount of CSS can touch. iOS picks the entry
* whose media query matches the device, so each one is a differently-cropped copy of the same
* photograph at that device's exact pixel size; a device that finds no match gets the blank back.
*
* Only one file is ever fetched per device, but all of them live in the repository, so this list is
* kept to the screens the app is realistically opened on. Add a line and re-run to cover another.
* The CSS pixels and the device-pixel-ratio here are exactly what the <link> in index.html states.
*/
const IOS_SIZES = [
[375, 667, 2], [414, 736, 3], [375, 812, 3], [414, 896, 2], [414, 896, 3],
[390, 844, 3], [393, 852, 3], [402, 874, 3], [428, 926, 3], [430, 932, 3], [440, 956, 3],
[768, 1024, 2], [834, 1194, 2], [1024, 1366, 2]
]
const STARTUP = new URL('../public/startup/', import.meta.url)
if (!splashMissing) {
mkdirSync(fileURLToPath(STARTUP), { recursive: true })
let bytes = 0
for (const [w, h, dpr] of IOS_SIZES) {
const px = { w: w * dpr, h: h * dpr }
const out = new URL(`${px.w}x${px.h}@${dpr}.jpg`, STARTUP)
// `cover` rather than `contain`: a launch screen fills the screen, and the composition is
// centred, so a crop keeps the middle of the frame and loses only sky and floor.
await sharp(SPLASH_SRC).resize(px.w, px.h, { fit: 'cover', position: 'centre' })
.jpeg({ quality: 72, chromaSubsampling: '4:2:0' })
.toFile(fileURLToPath(out))
bytes += readFileSync(fileURLToPath(out)).length
}
console.log(` public/startup/ iOS launch screens ${IOS_SIZES.length} sizes ${(bytes / 1024).toFixed(0)} KB total`)
// The <link> tags in index.html have to name the same sizes as the table above, and two lists in
// two files is exactly the kind of thing that drifts silently: iOS matches on the media query, so
// a size that is generated but not linked is fetched by nobody and a linked size that is not
// generated is a 404 — and iOS answers a missing launch image with the blank screen this whole
// section exists to remove. Cheap to check, so it is checked.
const head = readFileSync(fileURLToPath(new URL('../index.html', import.meta.url)), 'utf8')
const linked = [...head.matchAll(/\(device-width: (\d+)px\) and \(device-height: (\d+)px\) and \(-webkit-device-pixel-ratio: (\d+)\)/g)]
.map(m => [Number(m[1]), Number(m[2]), Number(m[3])])
const key = a => a.join('x')
const missing = IOS_SIZES.filter(s => !linked.some(l => key(l) === key(s)))
const extra = linked.filter(l => !IOS_SIZES.some(s => key(s) === key(l)))
if (missing.length || extra.length) {
console.error(` index.html and IOS_SIZES disagree — generated but not linked: ${missing.map(key).join(', ') || 'none'}; linked but not generated: ${extra.map(key).join(', ') || 'none'}`)
process.exitCode = 1
}
}
}
+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)}