diff --git a/src/lib/workers/notificationWorker.ts b/src/lib/workers/notificationWorker.ts index 40bc2928..80a63cc7 100644 --- a/src/lib/workers/notificationWorker.ts +++ b/src/lib/workers/notificationWorker.ts @@ -7,7 +7,7 @@ async function loadNotifications(fastifyURL:string, userId:string) { const response = await fetch(fastifyURL+'/get-notifications', { method: 'POST', headers: { - "Content-Type": "application/json","X-API-KEY": apiKey + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -28,7 +28,6 @@ async function loadNotifications(fastifyURL:string, userId:string) { const numberOfUnreadNotification = notificationList?.length const hasUnreadElement = notificationList?.length !== 0 ? true : false; - const output = {notificationList, hasUnreadElement, numberOfUnreadNotification} postMessage({ message: 'success', output}); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 89f10a78..cb1ac657 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -39,7 +39,7 @@ import Boxes from "lucide-svelte/icons/boxes"; import Newspaper from "lucide-svelte/icons/newspaper"; import MessageCircle from "lucide-svelte/icons/message-circle"; - + import AudioLine from "lucide-svelte/icons/audio-lines"; export let data; @@ -79,24 +79,6 @@ async function detectSWUpdate() { $userRegion = data?.region?.split("::")[0]; - let collapse = false; - - - const usRegion = ['cle1','iad1','pdx1','sfo1']; - - - let fastifyURL; - - userRegion.subscribe(value => { - - if (usRegion?.includes(value)) { - fastifyURL = import.meta.env.VITE_USEAST_FASTIFY_URL; - } else { - fastifyURL = import.meta.env.VITE_EU_FASTIFY_URL; - } - }); - - let hideHeader = false; NProgress.configure({ showSpinner: false }); @@ -124,19 +106,6 @@ async function detectSWUpdate() { let hasUnreadElement = false; let notificationList = []; -function handleCollapse() { - if ($screenWidth > 640) - { - collapse = !collapse - stockGuide = false; - etfGuide = false; - optionsGuide = false; - calendarGuide = false; - } -} - - - //Define web workers: let syncWorker: Worker | undefined = undefined; @@ -164,8 +133,7 @@ const loadWorker = async () => { if ('serviceWorker' in navigator) { const SyncWorker = await import('$lib/workers/notificationWorker?worker'); syncWorker = new SyncWorker.default(); - - syncWorker.postMessage({ message: {'fastifyURL': fastifyURL, 'userId': data?.user?.id }}); + syncWorker.postMessage({ message: {'fastifyURL': data?.fastifyURL, 'userId': data?.user?.id }}); syncWorker.onmessage = handleMessage; } else { // Fallback logic here @@ -180,10 +148,10 @@ async function fallbackWorker() { console.log('Fallback worker activated'); const postData = {'userId': data?.user?.id}; - const response = await fetch(fastifyURL+'/get-notifications', { + const response = await fetch(data?.fastifyURL+'/get-notifications', { method: 'POST', headers: { - + "Content-Type": "application/json" }, body: JSON.stringify(postData) }); @@ -212,21 +180,11 @@ $showCookieConsent = typeof data?.cookieConsent !== 'undefined' ? false : true; onMount(async () => { await loadWorker(); - //await pushNotification() if($showCookieConsent === true) { Cookie = (await import("$lib/components/Cookie.svelte")).default; } - //await loadTwitchWorker(); - - /* - if (window.innerWidth <= 768) { - detectSWUpdate(); - } - */ - - }) @@ -261,9 +219,6 @@ $: { } - - - let innerWidth; @@ -297,16 +252,12 @@ $: { } } -$: { - if($screenWidth < 1536) - { - collapse = false; - } -} + +
@@ -507,6 +458,31 @@ $: {
+ +
+ + + + + + + + Tracker Datasets + + + + + + + + +
+