Skip to content

Commit dde31b1

Browse files
jmckibleclaude
andcommitted
Add PWA support with pizza emoji icon
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3103fac commit dde31b1

7 files changed

Lines changed: 49 additions & 3 deletions

File tree

app/views/layouts/application.html.haml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,18 @@
88
= turbo_refreshes_with method: :morph, scroll: :preserve
99
= stylesheet_link_tag 'application', 'data-turbolinks-track': 'reload'
1010
= javascript_importmap_tags
11-
/= favicon_link_tag "favicons/#{Time.zone.now.mday}.png"
11+
%link{ rel: 'icon', href: '/icon.svg', type: 'image/svg+xml' }
1212
%meta{ charset: 'utf8' }
1313
%meta{ name: 'viewport', content: 'width=device-width, initial-scale=1, shrink-to-fit=no' }
14+
%meta{ name: 'theme-color', content: '#61afef' }
15+
%meta{ name: 'apple-mobile-web-app-capable', content: 'yes' }
16+
%meta{ name: 'apple-mobile-web-app-status-bar-style', content: 'default' }
17+
%link{ rel: 'manifest', href: '/manifest.json' }
18+
%link{ rel: 'apple-touch-icon', href: '/icon.png' }
19+
:javascript
20+
if ("serviceWorker" in navigator) {
21+
navigator.serviceWorker.register("/service-worker.js")
22+
}
1423
1524
1625
%body
18.4 KB
Loading

public/apple-touch-icon.png

18.4 KB
Loading

public/icon.png

103 KB
Loading

public/icon.svg

Lines changed: 2 additions & 2 deletions
Loading

public/manifest.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "Esophagus",
3+
"short_name": "Esophagus",
4+
"start_url": "/",
5+
"display": "standalone",
6+
"background_color": "#fafafa",
7+
"theme_color": "#61afef",
8+
"icons": [
9+
{
10+
"src": "/icon.svg",
11+
"sizes": "any",
12+
"type": "image/svg+xml",
13+
"purpose": "any"
14+
},
15+
{
16+
"src": "/icon.png",
17+
"sizes": "512x512",
18+
"type": "image/png"
19+
}
20+
]
21+
}

public/service-worker.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Minimal service worker to enable PWA install prompt.
2+
// Network-first strategy — the app relies on Turbo for navigation.
3+
self.addEventListener("install", (event) => {
4+
self.skipWaiting()
5+
})
6+
7+
self.addEventListener("activate", (event) => {
8+
event.waitUntil(clients.claim())
9+
})
10+
11+
self.addEventListener("fetch", (event) => {
12+
// Let the browser handle all fetches normally (network-first).
13+
// This satisfies the PWA installability requirement without
14+
// introducing caching complexity.
15+
return
16+
})

0 commit comments

Comments
 (0)