feat(pwa): register service worker from Providers component

This commit is contained in:
Tyler
2026-06-17 14:33:56 -06:00
parent 5560727cd8
commit 487fafc828
+5
View File
@@ -1,5 +1,6 @@
"use client";
import { useEffect } from "react";
import { ThemeProvider } from "next-themes";
import { MotionConfig } from "framer-motion";
import { CartProvider } from "@/context/CartContext";
@@ -8,9 +9,13 @@ import SiteHeader from "@/components/layout/SiteHeader";
import SiteFooter from "@/components/layout/SiteFooter";
import CartToast from "@/components/storefront/CartToast";
import CartRestoredToast from "@/components/cart/CartRestoredToast";
import { registerServiceWorker } from "@/lib/pwa";
export function Providers({ children }: { children: React.ReactNode }) {
const pathname = usePathname();
useEffect(() => {
registerServiceWorker();
}, []);
const isBrandRoute = pathname?.startsWith("/tuxedo") || pathname?.startsWith("/indian-river-direct");
const isLandingPage = pathname === "/" || pathname === "/brands";
const isAuthPage = pathname === "/login" || pathname === "/admin/login";