From 093ff73a6dfc8392cc979150db917a689a550bb5 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Tue, 12 Nov 2024 01:30:28 +0100 Subject: [PATCH] update stock list page --- .../list/magnificent-seven/+page.svelte | 348 ++++++++---------- .../list/market-cap/[slug]/+page.svelte | 9 + src/routes/list/sector/[slug]/+page.svelte | 49 +-- 3 files changed, 169 insertions(+), 237 deletions(-) diff --git a/src/routes/list/magnificent-seven/+page.svelte b/src/routes/list/magnificent-seven/+page.svelte index 5b1c8f57..83e55c62 100644 --- a/src/routes/list/magnificent-seven/+page.svelte +++ b/src/routes/list/magnificent-seven/+page.svelte @@ -1,11 +1,14 @@
- The term "Magnificent 7" refers to a group of 7 well-known technological - stocks that made large contributions to the market's overall performance. + The "magnificent seven" stocks are 7 technology stocks that drove a large + portion of the market's returns in 2023 and 2024. The list includes Apple, + Microsoft, Amazon, Alphabet (Google), Tesla, Nvidia and Meta Platforms.
-
-
-
-
- - -
-
- {rawData?.length} -
-
- -
-
- - -
- -
- {abbreviateNumber(totalMarketCap, true)} -
-
- -
-
- - -
-
- {abbreviateNumber(totalRevenue, true)} -
-
- -
-
- - -
-
- {abbreviateNumber(totalProfits, true)} -
-
- -
-
- - -
- -
- {((totalProfits / totalRevenue) * 100)?.toFixed(2)}% -
-
- -
-
- - -
-
- {avgPERatio} +
+
+
+
Total Stocks
+
+ {new Intl.NumberFormat("en")?.format(rawData?.length)}
+
+
+
Total Market Cap
+
+ {abbreviateNumber(totalMarketCap)} +
+
+
+
+
+
Total Revenue
+
+ {abbreviateNumber(totalRevenue)} +
+
+
+
+ +
+
@@ -167,32 +169,24 @@ class="table table-sm sm:table-md table-compact rounded-none sm:rounded-md w-full border-bg-[#09090B] m-auto mt-4" > - - Symbol - Company - Market Cap - Revenue - Profits - Price - + - {#each rawData as item} + {#each stockList as item} goto("/stocks/" + item?.symbol)} - class="sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] odd:bg-[#27272A] border-b-[#09090B] shake-ticker cursor-pointer" + class="sm:hover:bg-[#245073] sm:hover:bg-opacity-[0.2] odd:bg-[#27272A] border-b-[#09090B] text-white" > + + {item?.rank} + + - {item?.symbol} + - {abbreviateNumber(item?.marketCap, true)} + {item.price?.toFixed(2)} - {item?.revenue !== null - ? abbreviateNumber(item?.revenue, true) + {#if item?.changesPercentage >= 0} + +{item.changesPercentage?.toFixed(2)}% + {:else} + {item.changesPercentage?.toFixed(2)}% + + {/if} + + + + {item?.marketCap !== null + ? abbreviateNumber(item?.marketCap) : "-"} - - {item?.netIncome !== null - ? abbreviateNumber(item?.netIncome, true) - : "-"} - - - -
-
- ${item.price?.toFixed(2)} -
- {#if item.changesPercentage >= 0} - - +{item.changesPercentage?.toFixed(2)}% - {:else} - - {item.changesPercentage?.toFixed(2)}% - - {/if} -
-
-
+ {item?.revenue !== null ? abbreviateNumber(item?.revenue) : "-"} {/each} diff --git a/src/routes/list/market-cap/[slug]/+page.svelte b/src/routes/list/market-cap/[slug]/+page.svelte index fac78f10..0cd6fff4 100644 --- a/src/routes/list/market-cap/[slug]/+page.svelte +++ b/src/routes/list/market-cap/[slug]/+page.svelte @@ -5,6 +5,7 @@ import { page } from "$app/stores"; import HoverStockChart from "$lib/components/HoverStockChart.svelte"; import TableHeader from "$lib/components/Table/TableHeader.svelte"; + import DownloadData from "$lib/components/DownloadData.svelte"; export let data; @@ -270,6 +271,14 @@
+
+ +
+
diff --git a/src/routes/list/sector/[slug]/+page.svelte b/src/routes/list/sector/[slug]/+page.svelte index bc2de6dd..46bb8b33 100644 --- a/src/routes/list/sector/[slug]/+page.svelte +++ b/src/routes/list/sector/[slug]/+page.svelte @@ -4,6 +4,7 @@ import { onMount } from "svelte"; import { page } from "$app/stores"; import HoverStockChart from "$lib/components/HoverStockChart.svelte"; + import DownloadData from "$lib/components/DownloadData.svelte"; import TableHeader from "$lib/components/Table/TableHeader.svelte"; @@ -12,46 +13,6 @@ let rawData = []; let marketCapList = []; - const BILLION = 1_000_000_000; - const MILLION = 1_000_000; - - const marketCapNavigation = [ - { - threshold: 200 * BILLION, - name: "Mega Cap", - link: "/list/market-cap/mega-cap-stocks", - }, - { - minThreshold: 10 * BILLION, - maxThreshold: 200 * BILLION, - name: "Large Cap", - link: "/list/market-cap/large-cap-stocks", - }, - { - minThreshold: 2 * BILLION, - maxThreshold: 10 * BILLION, - name: "Mid Cap", - link: "/list/market-cap/mid-cap-stocks", - }, - { - minThreshold: 300 * MILLION, - maxThreshold: 2 * BILLION, - name: "Small Cap", - link: "/list/market-cap/small-cap-stocks", - }, - { - minThreshold: 50 * MILLION, - maxThreshold: 300 * MILLION, - name: "Micro Cap", - link: "/list/market-cap/micro-cap-stocks", - }, - { - maxThreshold: 50 * MILLION, - name: "Nano Cap", - link: "/list/market-cap/nano-cap-stocks", - }, - ]; - async function handleScroll() { const scrollThreshold = document.body.offsetHeight * 0.8; // 80% of the website height const isBottom = window.innerHeight + window.scrollY >= scrollThreshold; @@ -216,6 +177,14 @@
+
+ +
+