From 240ad1f993f0fee42dcc12c0ffe45afe555840fd Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Wed, 27 Nov 2024 11:50:41 +0100 Subject: [PATCH] ui fixes --- src/lib/components/Feedback.svelte | 4 +- src/lib/components/News.svelte | 2 +- src/routes/+layout.svelte | 77 +++--------------------------- 3 files changed, 9 insertions(+), 74 deletions(-) diff --git a/src/lib/components/Feedback.svelte b/src/lib/components/Feedback.svelte index bd068e61..5b17538f 100644 --- a/src/lib/components/Feedback.svelte +++ b/src/lib/components/Feedback.svelte @@ -7,7 +7,7 @@ export let data; import * as Tabs from "$lib/components/shadcn/tabs/index.js"; - let cloudFrontUrl = import.meta.env.VITE_IMAGE_URL; + import feedback_icon from "$lib/images/feedback_icon.png"; let rating = ""; let inputValue = ""; @@ -92,7 +92,7 @@ diff --git a/src/lib/components/News.svelte b/src/lib/components/News.svelte index a57ddf51..0f388de4 100644 --- a/src/lib/components/News.svelte +++ b/src/lib/components/News.svelte @@ -153,7 +153,7 @@ {#if newsList?.length !== rawData?.length} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 3c452c61..409e2b6c 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -5,7 +5,6 @@ import "../app.pcss"; import { Toaster } from "svelte-french-toast"; - import { getImageURL } from "$lib/utils"; import NProgress from "nprogress"; import "nprogress/nprogress.css"; @@ -24,7 +23,6 @@ import { clearCache, showCookieConsent, - newAvatar, screenWidth, stockTicker, etfTicker, @@ -36,7 +34,6 @@ import { Button } from "$lib/components/shadcn/button/index.ts"; import * as Card from "$lib/components/shadcn/card/index.ts"; import * as DropdownMenu from "$lib/components/shadcn/dropdown-menu/index.ts"; - //import { Input } from "$lib/components/shadcn/input/index.ts"; import * as Sheet from "$lib/components/shadcn/sheet/index.ts"; import * as Accordion from "$lib/components/shadcn/accordion/index.js"; @@ -51,40 +48,10 @@ import Newspaper from "lucide-svelte/icons/newspaper"; import AudioLine from "lucide-svelte/icons/audio-lines"; import Gem from "lucide-svelte/icons/gem"; + import stocknear_logo from "$lib/images/stocknear_logo.png"; export let data; - let cloudFrontUrl = import.meta.env.VITE_IMAGE_URL; - - //const trialLeftDays = Math?.floor(addDays(data, 7, '')); - - async function pushNotification() { - Notification?.requestPermission()?.then((perm) => { - if (perm === "granted") { - new Notification("Stocknear", { - body: "this is more text", - }); - } - }); - } - - //Check Service Worker (SW) - async function detectSWUpdate() { - const registration = await navigator.serviceWorker.ready; - - registration.addEventListener("updatefound", () => { - const newSW = registration.installing; - newSW?.addEventListener("statechange", () => { - if (newSW.state === "installed") { - if (confirm("New Update available! Reload to update?")) { - newSW.postMessage({ type: "SKIP_WAITING" }); - window.location.reload(); - } - } - }); - }); - } - let hideHeader = false; NProgress.configure({ showSpinner: false }); @@ -107,13 +74,7 @@ } } - $: hideFooter = - $page.url.pathname.startsWith("/options-flow") || - $page.url.pathname.startsWith("/options-zero-dte") || - $page.url.pathname.startsWith("/login") || - $page.url.pathname.startsWith("/etf") || - $page.url.pathname.startsWith("/portfolio") || - $page.url.pathname.startsWith("/hedge-funds"); + $: hideFooter = $page.url.pathname.startsWith("/options-flow"); let hasUnreadElement = false; let notificationList = []; @@ -125,18 +86,10 @@ const output = event.data?.output; notificationList = output?.notificationList; hasUnreadElement = output?.hasUnreadElement; - //const unreadNotificationList = output?.unreadNotificationList; $numberOfUnreadNotification = output?.numberOfUnreadNotification?.length; //pushNotification() }; - /* -const handleTwitchMessage = (event) => { - const output = event.data?.output; - $twitchStatus = output?.twitchStatus; -}; -*/ - const loadWorker = async () => { if ("serviceWorker" in navigator) { const SyncWorker = await import("$lib/workers/notificationWorker?worker"); @@ -211,8 +164,6 @@ const handleTwitchMessage = (event) => { } } - let innerWidth; - $: { if ($stockTicker && !$clientSideCache[$stockTicker]) { $clientSideCache[$stockTicker] = {}; @@ -224,22 +175,9 @@ const handleTwitchMessage = (event) => { $clientSideCache[$etfTicker] = {}; } } - - $: { - if ($newAvatar?.length !== 0) { - data.user.avatar = $newAvatar; - $newAvatar = ""; - } - } - - $: { - if (innerWidth) { - $screenWidth = innerWidth; - } - } - +
@@ -276,7 +214,7 @@ const handleTwitchMessage = (event) => { > Stocknear @@ -804,10 +742,7 @@ const handleTwitchMessage = (event) => { - + Stocknear @@ -900,7 +835,7 @@ const handleTwitchMessage = (event) => { > Stocknear