Commit 7c935b3
feat(pwa): rebuild offline support with Workbox and modernize install UX (#88)
The hand-written public/sw.js precached CRA-era paths (/static/js/bundle.js,
/static/css/main.css) that 404 in the Vite build, so cache.addAll rejected and
the service worker never finished installing — offline was broken entirely.
Replace it with vite-plugin-pwa (injectManifest): Workbox injects the real
hashed-asset precache manifest, and a custom src/sw.ts adds a NetworkFirst
navigation handler with an app-shell offline fallback, StaleWhileRevalidate for
Supabase REST reads (now covering family prayers too), and a bounded CacheFirst
for storage images. Navigations stay network-first so online visitors and
crawlers always get the freshly prerendered HTML — the Pages deploy/prerender
pipeline is unchanged (SW is bypassed during snapshotting).
Make the installed app more useful and cross-platform:
- maskable icons (192/512) with Android safe-zone padding
- apple-touch-icon (180), Apple meta tags, and iOS splash screens
- wired favicons and light/dark theme-color
- manifest id/scope/lang/categories, app shortcuts, and install screenshots
- in-app "update available" toast and an Install button (beforeinstallprompt)
Assets are generated by scripts/generate-pwa-assets.mjs (reuses the existing
puppeteer + cached Chromium; not part of CI).
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 93ef484 commit 7c935b3
31 files changed
Lines changed: 9262 additions & 4318 deletions
File tree
- public
- icons
- splash
- screenshots
- scripts
- src
- components
- hooks
- i18n/locales
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
27 | 113 | | |
28 | 114 | | |
29 | 115 | | |
| |||
0 commit comments