Make cashup installable as a PWA

vite-plugin-pwa with manifest scoped to /cashup/, purple £ icons matching
portal style, auto install prompt when opened with ?install=1 from the
portal dashboard, nginx no-cache rules for sw.js and manifest.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-11 10:54:50 +00:00
parent dec7ac2f3e
commit 4a46bcf45f
7 changed files with 6327 additions and 2 deletions

View file

@ -3,6 +3,15 @@ import { createRoot } from 'react-dom/client'
import App from './App'
import './index.css'
// When opened from the portal's install button (?install=1), trigger the
// PWA install prompt as soon as the browser offers it (Chrome/Edge only).
if (new URLSearchParams(window.location.search).has('install')) {
window.addEventListener('beforeinstallprompt', e => {
e.preventDefault()
;(e as Event & { prompt: () => Promise<void> }).prompt()
}, { once: true })
}
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />