From c7f8d1446191c82bed5f45b36d40ebe42387a77c Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Tue, 17 Sep 2024 16:13:51 +0200 Subject: [PATCH] ui fixes --- src/routes/earnings-calendar/+page.svelte | 2 +- src/routes/market-news/+layout.svelte | 92 +++++++++++---- src/routes/market-news/+page.svelte | 36 +++--- src/routes/market-news/general/+page.svelte | 122 ++++++++++++-------- 4 files changed, 164 insertions(+), 88 deletions(-) diff --git a/src/routes/earnings-calendar/+page.svelte b/src/routes/earnings-calendar/+page.svelte index 167dfead..ffae28d1 100644 --- a/src/routes/earnings-calendar/+page.svelte +++ b/src/routes/earnings-calendar/+page.svelte @@ -461,7 +461,7 @@ $: {

- Pro Subscription + Pro Subscription 🔥

diff --git a/src/routes/market-news/+layout.svelte b/src/routes/market-news/+layout.svelte index e31ed8b9..2eb8b7f0 100644 --- a/src/routes/market-news/+layout.svelte +++ b/src/routes/market-news/+layout.svelte @@ -3,11 +3,38 @@ import logo from '$lib/images/news_logo.png' import ScrollToTop from '$lib/components/ScrollToTop.svelte'; import ArrowLogo from "lucide-svelte/icons/move-up-right"; import { goto } from '$app/navigation'; +import { page } from '$app/stores'; export let data; -let displaySection = 'stock' + function handleMode(i) { + activeIdx = i; + if(activeIdx === 0) { + goto("/market-news") + } else if (activeIdx === 1) { + goto("/market-news/general") + } + } + + const tabs = [ + { + title: "Stock", + }, + { + title: "General", + }, + ]; + +let activeIdx = 0; + + // Subscribe to the $page store to reactively update the activeIdx based on the URL + $: if ($page.url.pathname === '/market-news') { + activeIdx = 0; + } else if ($page.url.pathname.startsWith('/market-news/general')) { + activeIdx = 1; + } + @@ -86,22 +113,25 @@ let displaySection = 'stock' - +
+ {#each tabs as item, i} + + {/each} +
@@ -121,7 +151,7 @@ let displaySection = 'stock'

- Pro Subscription + Pro Subscription 🔥

@@ -132,30 +162,44 @@ let displaySection = 'stock'
{/if} -
goto('/analysts')} class="w-full bg-[#141417] duration-100 ease-out sm:hover:text-white text-gray-400 sm:hover:border-gray-700 border border-gray-800 rounded-lg h-fit pb-4 mt-4 cursor-pointer"> +
goto('/earnings-calendar')} class="w-full bg-[#141417] duration-100 ease-out sm:hover:text-white text-gray-400 sm:hover:border-gray-700 border border-gray-800 rounded-lg h-fit pb-4 mt-4 cursor-pointer"> +
+
+

+ Earnings Calendar 🌟 +

+ +
+ + Get the latest Earnings of companies + +
+
+ +
goto('/dividends-calendar')} class="w-full bg-[#141417] duration-100 ease-out sm:hover:text-white text-gray-400 sm:hover:border-gray-700 border border-gray-800 rounded-lg h-fit pb-4 mt-4 cursor-pointer">

- Wallstreet Analyst + Dividend Calendar 💸

- Get the latest top Wall Street analyst ratings. + Stay updated on upcoming Dividends in the stock market.
-
goto('/politicians')} class="w-full bg-[#141417] duration-100 ease-out sm:hover:text-white text-gray-400 sm:hover:border-gray-700 border border-gray-800 rounded-lg h-fit pb-4 mt-4 cursor-pointer"> +
goto('/economic-calendar')} class="w-full bg-[#141417] duration-100 ease-out sm:hover:text-white text-gray-400 sm:hover:border-gray-700 border border-gray-800 rounded-lg h-fit pb-4 mt-4 cursor-pointer">

- Congress Trading + Economic Events 🌍

- Get the latest top Congress trading insights. + Stay updated on upcoming Economic Events worldwide.
diff --git a/src/routes/market-news/+page.svelte b/src/routes/market-news/+page.svelte index 79aa87cc..28d99283 100644 --- a/src/routes/market-news/+page.svelte +++ b/src/routes/market-news/+page.svelte @@ -1,9 +1,8 @@ + } + + onMount(async () => { + window.addEventListener('scroll', handleScroll); + return () => { + window.removeEventListener('scroll', handleScroll); + }; + }) + +let videoId = null; + + +function checkIfYoutubeVideo(link) { + + const url = new URL(link); + if (url.hostname === "www.youtube.com") { + const searchParams = url.searchParams; + searchParams?.delete('t'); // Remove the "t" parameter + const videoIdMatch = url?.search?.match(/v=([^&]+)/); + + if (videoIdMatch) { + return videoIdMatch[1]; + } + } else { + return null; + } + +} + + + + @@ -92,7 +123,7 @@ {:else}
- news image + news image
{/if} @@ -114,7 +145,6 @@ {/each} -