Files
KomediruzeckiandGitHub f921f9a44e fix(ios): keep the status bar above the app, not on top of it (#495)
An iPhone home-screen install drew the app under the status bar and put white
clock/battery glyphs over it. On the light theme (--bg: #f7f9ff) that is white
on near-white; iOS 26 glasses the strip as well, which is the blur in the
report. Underneath it, the sidebar's logo and first nav item sat behind the
status bar, and the menu button was parked flush against it.

Cause: `apple-mobile-web-app-status-bar-style: black-translucent` with
`viewport-fit=cover`. It runs the web view full-bleed AND forces white glyphs
regardless of theme, while `theme-color` was hardcoded to the dark theme's
background and never updated on a switch. Apple lists the value as deprecated.

- status bar style -> `default`; every `calc(56px + env(safe-area-inset-top))`
  rule degrades to its pre-notch value because the inset is then 0
- theme-color follows the active theme: stamped pre-paint in theme-init.js,
  re-read from the live --bg on switch. setTheme now delegates to applyTheme
  rather than restating it, so one path touches the document
- body::before paints an opaque strip of exactly env(safe-area-inset-top) —
  zero-height under `default`, insurance for landscape Safari and any future
  iOS that goes full-bleed again; pointer-events:none so it cannot eat taps
- .mobile-toggle used max(12px, inset), which resolves to the inset itself and
  removes the gap entirely; .sidebar gained the top inset

New test pins theme-init.js's duplicated colour literals to the theme files
and guards the black-translucent regression; verified to fail on injected
drift. typecheck clean, lint clean, 1680/1680 unit tests pass, build verified
to emit content="default".
2026-08-29 12:50:40 +02:00

244 lines
10 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<!-- Kept in sync with the active theme's --bg by public/theme-init.js (pre-paint) and
core/theme.ts (on switch). The literal here is only the pre-script default. -->
<meta name="theme-color" content="#0a0e1c" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<!-- `default`, not `black-translucent`. The translucent value makes the web view fill the
screen UNDER the status bar and forces WHITE status-bar glyphs regardless of theme, so
on the light theme the clock and battery sat invisibly on a near-white page while iOS
glassed the strip over the top. Apple also lists it as deprecated. `default` keeps the
status bar out of the page and tints it from theme-color below. -->
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link rel="apple-touch-icon" href="/icon-192.png" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<!-- Pre-paint theme stamp (external, not inline: the self-hosted Express
deployment enforces script-src 'self', which blocks inline scripts). -->
<script src="/theme-init.js"></script>
<title>Token Circles — Personal Finance</title>
<meta
name="description"
content="Token Circles is an open-source, local-first personal finance app — budgets, analytics, calculators, and investments, right in your browser. Your data stays yours."
/>
<link rel="canonical" href="https://tokencircles.com/" />
<!-- Open Graph / Twitter -->
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Token Circles" />
<meta property="og:title" content="Token Circles — Personal Finance" />
<meta
property="og:description"
content="Open-source, local-first personal finance — budgets, analytics, calculators, and investments, right in your browser. Your data stays yours."
/>
<meta property="og:url" content="https://tokencircles.com/" />
<meta property="og:image" content="https://tokencircles.com/og-image.jpg" />
<meta property="og:image:width" content="1200" />
<meta property="og:image:height" content="630" />
<meta property="og:image:alt" content="Token Circles — personal finance in clear orbit" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Token Circles — Personal Finance" />
<meta
name="twitter:description"
content="Open-source, local-first personal finance — budgets, analytics, calculators, and investments, right in your browser."
/>
<meta name="twitter:image" content="https://tokencircles.com/og-image.jpg" />
<!-- Fonts are self-hosted (see src/styles/index.css) — no cross-origin Google Fonts,
so nothing here trips CSP and headings render offline. -->
<!-- Boot watchdog: the LAST-RESORT recovery for a bad deploy. When a hashed chunk from a
stale index.html is gone, the entry module fails to load and the app never mounts —
so the in-app crash screen (which lives *inside* that bundle) can't help. This inline
script runs with zero dependencies: if an app asset errors before boot, or the app
hasn't signaled boot in time, it clears the service worker + caches and reloads once
per cooldown window (a plain reload won't fix a stale SW), then falls back to a
manual recovery panel. -->
<script>
;(function () {
var booted = function () {
return window.__APP_BOOTED__ === true
}
var recovering = false
function isAppAsset(el) {
if (!el || !el.tagName) return false
var tag = el.tagName.toUpperCase()
if (tag !== 'SCRIPT' && tag !== 'LINK') return false
return /\/assets\//.test(el.src || el.href || '')
}
function clearCachesAndSW() {
var tasks = []
try {
if ('serviceWorker' in navigator) {
tasks.push(
navigator.serviceWorker
.getRegistrations()
.then(function (rs) {
return Promise.all(
rs.map(function (r) {
return r.unregister()
})
)
})
.catch(function () {})
)
}
if (window.caches && caches.keys) {
tasks.push(
caches
.keys()
.then(function (ks) {
return Promise.all(
ks.map(function (k) {
return caches.delete(k)
})
)
})
.catch(function () {})
)
}
} catch (e) {}
return Promise.all(tasks).catch(function () {})
}
function showPanel() {
if (document.getElementById('tc-recovery')) return
var wrap = document.createElement('div')
wrap.id = 'tc-recovery'
wrap.setAttribute(
'style',
'position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;' +
'justify-content:center;background:#0a0e1c;color:#f1f5f9;font-family:Inter,' +
'system-ui,-apple-system,sans-serif;padding:24px;text-align:center'
)
var box = document.createElement('div')
box.setAttribute('style', 'max-width:420px')
var h = document.createElement('h1')
h.textContent = 'Update needed'
h.setAttribute('style', 'font-size:1.4rem;font-weight:600;margin:0 0 10px')
var p = document.createElement('p')
p.textContent =
'A new version was released and this page could not finish loading. ' +
'Reload to get the latest, or reset the app cache if that does not help.'
p.setAttribute('style', 'color:#94a3b8;line-height:1.6;margin:0 0 20px')
var reload = document.createElement('button')
reload.textContent = 'Reload'
reload.setAttribute(
'style',
'display:block;width:100%;margin:0 0 10px;padding:12px;border:none;border-radius:8px;' +
'background:#3b82f6;color:#fff;font-size:1rem;font-weight:600;cursor:pointer'
)
reload.addEventListener('click', function () {
location.reload()
})
var reset = document.createElement('button')
reset.textContent = 'Reset app cache & reload'
reset.setAttribute(
'style',
'display:block;width:100%;padding:12px;border:1px solid #334155;border-radius:8px;' +
'background:transparent;color:#f1f5f9;font-size:1rem;cursor:pointer'
)
reset.addEventListener('click', function () {
reset.textContent = 'Resetting…'
clearCachesAndSW().then(function () {
location.reload()
})
})
box.appendChild(h)
box.appendChild(p)
box.appendChild(reload)
box.appendChild(reset)
wrap.appendChild(box)
;(document.body || document.documentElement).appendChild(wrap)
}
function recover() {
if (recovering || booted()) return
recovering = true
// One auto-recovery per cooldown window, not per session: back-to-back releases can
// legitimately need this twice in one long-lived tab (each deploy gets one clean
// clear+reload), while a genuinely broken build still can't loop — repeats inside
// the window hand off to the user panel. The legacy value '1' parses as an ancient
// timestamp, so pre-cooldown sessions are allowed to recover again.
var RECOVER_COOLDOWN_MS = 2 * 60 * 1000
var recentlyTried = false
try {
var last = Number(sessionStorage.getItem('tc-recovered') || 0)
recentlyTried = last > 0 && Date.now() - last < RECOVER_COOLDOWN_MS
} catch (e) {}
if (recentlyTried) {
showPanel()
return
}
try {
sessionStorage.setItem('tc-recovered', String(Date.now()))
} catch (e) {}
clearCachesAndSW().then(function () {
location.reload()
})
}
// Precise signal: an app asset (entry bundle, a chunk, or the stylesheet) failed to
// load before the app booted. Capture phase catches resource errors that don't bubble.
window.addEventListener(
'error',
function (e) {
if (!booted() && isAppAsset(e.target)) recover()
},
true
)
// Backstop: nothing errored loudly, but the app never mounted anything in time.
setTimeout(function () {
var root = document.getElementById('root')
if (
!booted() &&
root &&
root.childElementCount === 0 &&
document.visibilityState !== 'hidden'
) {
recover()
}
}, 12000)
})()
</script>
</head>
<body>
<noscript>
<div
style="
max-width: 640px;
margin: 16vh auto;
padding: 0 24px;
font-family:
Inter,
system-ui,
-apple-system,
sans-serif;
color: #f1f5f9;
text-align: center;
"
>
<h1 style="font-size: 1.6rem; font-weight: 600; margin: 0 0 12px">Token Circles</h1>
<p style="color: #94a3b8; line-height: 1.7; margin: 0 0 16px">
Token Circles is an open-source, local-first personal finance app — budgets, analytics,
calculators, and investments, right in your browser, with your data staying on your
device. The app needs JavaScript to run.
</p>
<p style="margin: 0">
<a href="https://about.tokencircles.com" style="color: #60a5fa; text-decoration: none"
>Learn more at about.tokencircles.com &rarr;</a
>
</p>
</div>
</noscript>
<div id="root"></div>
<script src="/src/index.tsx" type="module"></script>
</body>
</html>