From 7a485ddc02ce28fa050c26c7b72447e528ea895b Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sun, 2 Feb 2025 16:30:52 +0100 Subject: [PATCH] clean code --- src/routes/+layout.svelte | 46 ++++----------------------------------- 1 file changed, 4 insertions(+), 42 deletions(-) diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 683dc140..ffde8c07 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -51,12 +51,13 @@ import AudioLine from "lucide-svelte/icons/audio-lines"; import Gem from "lucide-svelte/icons/gem"; import stocknear_logo from "$lib/images/stocknear_logo.png"; - + /* import { requestNotificationPermission, sendNotification, } from "$lib/notifications"; + */ export let data; let hideHeader = false; @@ -92,49 +93,8 @@ notificationList = output?.notificationList; hasUnreadElement = output?.hasUnreadElement; numberOfUnreadNotification.set(output?.numberOfUnreadNotification); - //pushNotification() }; - // Send notification and handle click redirection - async function handleNotificationClick() { - const permissionGranted = await requestNotificationPermission(); - - if (permissionGranted) { - sendNotification("Price Alert for ZBRA", { - body: `📈 The price of 12 is above your target of 23.`, - iconSize: 12, - url: "/notifications", - }); - } - } - - //Check Service Worker (SW) - /* - async function detectSWUpdate() { - try { - const registration = await navigator.serviceWorker.ready; - - registration.addEventListener("updatefound", () => { - const newSW = registration.installing; - - newSW?.addEventListener("statechange", () => { - if (newSW.state === "installed") { - const message = - "🚀 A fresh update is ready! Reload now to enjoy the latest features"; - - if (confirm(message)) { - newSW.postMessage({ type: "SKIP_WAITING" }); - window.location.reload(); - } - } - }); - }); - } catch (error) { - console.error("Service Worker registration failed:", error); - } - } - */ - const loadWorker = async () => { if ("serviceWorker" in navigator) { const SyncWorker = await import("$lib/workers/notificationWorker?worker"); @@ -1214,9 +1174,11 @@
+