import { BUILD } from './build-info.ts' import { pwaScript } from './pwa.ts' import { baseCss, COLORS, esc, headTags, type PageCtx } from './ui.ts' const aboutScript = String.raw` (() => { const $ = (id) => document.getElementById(id); const built = $('builtAt'), iso = built.getAttribute('datetime'); function age(ms) { const s = Math.max(0, (Date.now() - ms) / 1000); const u = [[86400 * 365, 'year'], [86400 * 30, 'month'], [86400, 'day'], [3600, 'hour'], [60, 'minute']]; for (const [n, w] of u) if (s >= n) { const v = Math.floor(s / n); return v + ' ' + w + (v === 1 ? '' : 's') + ' ago'; } return 'just now'; } const d = new Date(iso); if (!isNaN(d)) built.textContent = d.toLocaleString(undefined, { dateStyle: 'medium', timeStyle: 'short' }) + ' (' + age(d.getTime()) + ')'; const btn = $('checkBtn'), out = $('checkResult'); btn.addEventListener('click', async () => { btn.disabled = true; btn.textContent = 'CHECKING…'; out.textContent = ''; const r = window.__pwa ? await window.__pwa.check() : { ok: false, reason: 'unsupported' }; btn.disabled = false; btn.textContent = 'CHECK FOR UPDATES'; out.textContent = !r.ok ? (r.reason === 'offline' ? 'OFFLINE. TRY AGAIN WHEN CONNECTED.' : 'UPDATES NEED A BROWSER WITH SERVICE WORKERS.') : r.waiting ? 'NEW VERSION READY. TAP UPDATE BELOW.' : 'UP TO DATE.'; }); if (window.__pwa) window.__pwa.onChange((s) => { $('swState').textContent = s.registered ? 'READY FOR OFFLINE PLAY' : 'NOT INSTALLED YET'; }); })(); ` export function renderAbout(ctx: PageCtx) { const commit = BUILD.sourceCommit return ` About · Asteroids ${headTags(ctx, 'About · Asteroids')}
◀ PLAY

ASTEROIDS

VECTOR ARCADE · KEYBOARD OR TOUCH

VERSION

BUILD
${esc(BUILD.buildId)}
COMMIT
${commit ? `${esc(commit.slice(0, 7))} (the commit this build was made from)` : 'unknown'}
BUILT
OFFLINE
CHECKING…

UPDATES

Asteroids saves itself on your device so it loads instantly and plays offline. When a new version is published, it downloads in the background and an UPDATE AVAILABLE message appears. Tap UPDATE to switch now, or keep playing and it takes over next time you open the game. It checks when you open it, when you come back to the tab, and every 30 minutes.

CONTROLS

CREDITS

◀ BACK TO THE GAMEKODY PACKAGE ↗
` }