diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6f4b97d..b9696ad 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -13,7 +13,7 @@ export default function RootLayout({ children }: LayoutProps<"/">) { - + {children} diff --git a/src/app/serwist/[path]/route.ts b/src/app/serwist/[path]/route.ts index 031e88f..af49bec 100644 --- a/src/app/serwist/[path]/route.ts +++ b/src/app/serwist/[path]/route.ts @@ -1,5 +1,7 @@ import { spawnSync } from "node:child_process"; import { createSerwistRoute } from "@serwist/turbopack"; +import fs from "node:fs"; +import path from "node:path"; // If you are using Next.js versions older than 15.0.0, add the // `nextConfig` option so that Serwist can configure the service // worker according to your options. Serwist 10 and newer will diff --git a/src/app/sw.ts b/src/app/sw.ts index fd6fe08..187b26d 100644 --- a/src/app/sw.ts +++ b/src/app/sw.ts @@ -20,7 +20,7 @@ const serwist = new Serwist({ precacheEntries: self.__SW_MANIFEST, precacheOptions: { cleanupOutdatedCaches: true, - concurrency: 20, + concurrency: 5, directoryIndex: "index.html", fallbackToNetwork: true, }, @@ -49,35 +49,4 @@ const serwist = new Serwist({ }, }); -serwist.addEventListeners(); - -/** From Gemini */ -/* -import { defaultCache } from '@serwist/next/worker'; -import type { PrecacheEntry, SerwistGlobalConfig } from 'serwist'; -import { CacheFirst, Serwist } from 'serwist'; - -declare const self: ServiceWorkerGlobalScope & - SerwistGlobalConfig & { - __SW_MANIFEST: (string | PrecacheEntry)[]; - }; - -const serwist = new Serwist({ - precacheEntries: self.__SW_MANIFEST, - skipWaiting: true, - clientsClaim: true, - navigationPreload: true, - runtimeCaching: [ - ...defaultCache, - { - // Intercept map tile requests from standard OSM / tile servers - matcher: ({ url }) => url.hostname.includes('tile.openstreetmap.org') || url.pathname.includes('/tiles/'), - handler: new CacheFirst({ - cacheName: 'excalibur-offline-map-tiles-v1', - }), - }, - ], -}); - -serwist.addEventListeners(); -*/ \ No newline at end of file +serwist.addEventListeners(); \ No newline at end of file diff --git a/src/components/riddles/Riddle_6.tsx b/src/components/riddles/Riddle_6.tsx index e1961ca..c545967 100644 --- a/src/components/riddles/Riddle_6.tsx +++ b/src/components/riddles/Riddle_6.tsx @@ -40,6 +40,7 @@ export default function Riddle_6({ const [isHeartFast, setIsHeartFast] = useState(true); const closePopupRef = useRef<(() => void) | null>(null); const heartFastTimerRef = useRef(null); + const popupTimerRef = useRef(null); const voiceOverModeRef = useRef(voiceOverMode); useEffect(() => { @@ -47,22 +48,32 @@ export default function Riddle_6({ }, [voiceOverMode]); const handleClosePopup = () => { - if (closePopupRef.current) { - closePopupRef.current(); - } else { - setPopupData(null); - } - }; + if (popupTimerRef.current) { + clearTimeout(popupTimerRef.current); + popupTimerRef.current = null; + } + + if (closePopupRef.current) { + closePopupRef.current(); + } else { + setPopupData(null); + } +}; useEffect(() => { - if (!popupData || voiceOverMode === "on") return; + if (!popupData) return; - const timer = setTimeout(() => { - handleClosePopup(); - }, 9000); + popupTimerRef.current = setTimeout(() => { + handleClosePopup(); + }, 15000); - return () => clearTimeout(timer); - }, [popupData, voiceOverMode]); + return () => { + if (popupTimerRef.current) { + clearTimeout(popupTimerRef.current); + popupTimerRef.current = null; + } + }; +}, [popupData]); useEffect(() => { if (page !== 2 || mode === 'won') return;