Add PWA support with manifest, service worker, and icons
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
15
frontend/src/components/sw-registrar.tsx
Normal file
15
frontend/src/components/sw-registrar.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect } from "react";
|
||||
|
||||
export function ServiceWorkerRegistrar() {
|
||||
useEffect(() => {
|
||||
if ("serviceWorker" in navigator && process.env.NODE_ENV === "production") {
|
||||
navigator.serviceWorker.register("/sw.js").catch((err) => {
|
||||
console.warn("SW registration failed:", err);
|
||||
});
|
||||
}
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user