Make the frontend an installable PWA

Add a web app manifest and an install-only service worker (no offline
caching: live state always comes from the server and hashed asset names
change every build), registered from the WASM bundle. The worker must
live at the site root for its scope to cover the app, and Granian only
serves /static and /assets, so tavolo/static.py answers
/manifest.webmanifest and /sw.js from STATIC_DIR with the content types
browsers require; index.html gains the manifest link, icons, theme-color
and Apple standalone meta tags.

Icons are committed under web/assets/icons/ with vector sources and a
make-icons.sh regeneration script, mirroring the card art workflow.
This commit is contained in:
2026-10-14 22:14:43 +00:00
parent 532cb16f94
commit 8c6ad10bf6
17 changed files with 271 additions and 19 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

+14
View File
@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
<!-- Maskable variant: the felt background bleeds to the edges and the
spade shrinks inside the 80% safe zone, so platform masks (circles,
squircles, rounded squares) never clip the glyph. Also rasterized
into the 180x180 apple-touch-icon, where iOS applies its own mask. -->
<defs>
<radialGradient id="felt" cx="50%" cy="35%" r="80%">
<stop offset="0" stop-color="#1d5c38"/>
<stop offset="1" stop-color="#14341f"/>
</radialGradient>
</defs>
<rect width="512" height="512" fill="url(#felt)"/>
<path fill="#e8c547" transform="translate(128 134) scale(16)" d="M7.184 11.246A3.5 3.5 0 0 1 1 9c0-1.602 1.14-2.633 2.66-4.008C4.986 3.792 6.184 2.602 8 0c1.818 2.602 3.016 3.793 4.34 4.992C13.86 6.367 15 7.398 15 9a3.5 3.5 0 0 1-6.184 2.246 20 20 0 0 0 1.06 3.09c.42.897-.155 1.664-1.876 1.664s-2.296-.767-1.876-1.664a20 20 0 0 0 1.06-3.09Z"/>
</svg>

After

Width:  |  Height:  |  Size: 984 B

+15
View File
@@ -0,0 +1,15 @@
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512">
<!-- Tavolo app icon: the gold spade from the navbar on dark felt.
The spade glyph is Bootstrap Icons' "suit-spade-fill" (MIT), the
same license as the vendored Bootstrap CSS. Rasterized into the
PNG sizes by make-icons.sh (rsvg-convert); not used directly at
runtime except as the SVG favicon. -->
<defs>
<radialGradient id="felt" cx="50%" cy="35%" r="80%">
<stop offset="0" stop-color="#1d5c38"/>
<stop offset="1" stop-color="#14341f"/>
</radialGradient>
</defs>
<rect width="512" height="512" rx="112" fill="url(#felt)"/>
<path fill="#e8c547" transform="translate(96 104) scale(20)" d="M7.184 11.246A3.5 3.5 0 0 1 1 9c0-1.602 1.14-2.633 2.66-4.008C4.986 3.792 6.184 2.602 8 0c1.818 2.602 3.016 3.793 4.34 4.992C13.86 6.367 15 7.398 15 9a3.5 3.5 0 0 1-6.184 2.246 20 20 0 0 0 1.06 3.09c.42.897-.155 1.664-1.876 1.664s-2.296-.767-1.876-1.664a20 20 0 0 0 1.06-3.09Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1022 B