Implemented guest-only PWA using vite-plugin-pwa (the actual published package; @vite-pwa/plugin isn’t on npm) with
injectManifest, a new typed SW source, runtime caching, and a non‑blocking update toast with an action button. The
guest shell now links a dedicated manifest and theme color, and background upload sync is managed in a single
PwaManager component.
Key changes (where/why)
- vite.config.ts: added VitePWA injectManifest config, guest manifest, and output to /public so the SW can control /
scope.
- resources/js/guest/guest-sw.ts: new Workbox SW (precache + runtime caching for guest navigation, GET /api/v1/*,
images, fonts) and preserves push/sync/notification logic.
- resources/js/guest/components/PwaManager.tsx: registers SW, shows update/offline toasts, and processes the upload
queue on sync/online.
- resources/js/guest/components/ToastHost.tsx: action-capable toasts so update prompts can include a CTA.
- resources/js/guest/i18n/messages.ts: added common.updateAvailable, common.updateAction, common.offlineReady.
- resources/views/guest.blade.php: manifest + theme color + apple touch icon.
- .gitignore: ignore generated public/guest-sw.js and public/guest.webmanifest; public/guest-sw.js removed since it’s
now build output.
This commit is contained in:
@@ -16,6 +16,13 @@ export const messages: Record<LocaleCode, NestedMessages> = {
|
||||
de: {
|
||||
common: {
|
||||
hi: 'Hi',
|
||||
refresh: 'Aktualisieren',
|
||||
pullToRefresh: 'Zum Aktualisieren ziehen',
|
||||
releaseToRefresh: 'Zum Aktualisieren loslassen',
|
||||
refreshing: 'Aktualisiere...',
|
||||
updateAvailable: 'Neue Version verfügbar.',
|
||||
updateAction: 'Aktualisieren',
|
||||
offlineReady: 'Offline bereit.',
|
||||
actions: {
|
||||
close: 'Schließen',
|
||||
loading: 'Lädt...',
|
||||
@@ -137,6 +144,7 @@ export const messages: Record<LocaleCode, NestedMessages> = {
|
||||
home: {
|
||||
fallbackGuestName: 'Gast',
|
||||
welcomeLine: 'Willkommen {name}!',
|
||||
swipeHint: 'Wische für mehr Aufgaben',
|
||||
introRotating: {
|
||||
0: 'Hilf uns, diesen besonderen Tag mit deinen schönsten Momenten festzuhalten.',
|
||||
1: 'Fang die Stimmung des Events ein und teile sie mit allen Gästen.',
|
||||
@@ -703,6 +711,13 @@ export const messages: Record<LocaleCode, NestedMessages> = {
|
||||
en: {
|
||||
common: {
|
||||
hi: 'Hi',
|
||||
refresh: 'Refresh',
|
||||
pullToRefresh: 'Pull to refresh',
|
||||
releaseToRefresh: 'Release to refresh',
|
||||
refreshing: 'Refreshing...',
|
||||
updateAvailable: 'A new version is available.',
|
||||
updateAction: 'Update',
|
||||
offlineReady: 'Offline ready.',
|
||||
actions: {
|
||||
close: 'Close',
|
||||
loading: 'Loading...',
|
||||
@@ -824,6 +839,7 @@ export const messages: Record<LocaleCode, NestedMessages> = {
|
||||
home: {
|
||||
fallbackGuestName: 'Guest',
|
||||
welcomeLine: 'Welcome {name}!',
|
||||
swipeHint: 'Swipe for more missions',
|
||||
introRotating: {
|
||||
0: 'Help us capture this special day with your favourite moments.',
|
||||
1: 'Capture the mood of the event and share it with everyone.',
|
||||
|
||||
Reference in New Issue
Block a user