From 13ca22d68f0f16ba2485907da6d9eab2b851b7f0 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Tue, 15 Oct 2024 16:33:58 +0200 Subject: [PATCH] ui fixes --- src/lib/components/RetailVolume.svelte | 5 +++ src/lib/components/ShareHolders.svelte | 56 +++++++++++++------------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/src/lib/components/RetailVolume.svelte b/src/lib/components/RetailVolume.svelte index 2ecda9b6..e122f3ea 100644 --- a/src/lib/components/RetailVolume.svelte +++ b/src/lib/components/RetailVolume.svelte @@ -28,6 +28,11 @@ function findMonthlyValue(data, lastDateStr) { + if (!data || !data.sentiment) { + console.error("Sentiment is undefined or missing in the data:", data); + $retailVolumeComponent = false; + return; // Or return a default value if necessary + } // Convert lastDateStr to Date object const lastDate = new Date(lastDateStr); // Set the first date to the beginning of the month of lastDate diff --git a/src/lib/components/ShareHolders.svelte b/src/lib/components/ShareHolders.svelte index 10a5a9ff..3a5c1934 100644 --- a/src/lib/components/ShareHolders.svelte +++ b/src/lib/components/ShareHolders.svelte @@ -36,15 +36,14 @@ let showFullStats = false; const plotPieChart = () => { - + if(rawData?.ownershipPercent !== undefined) { shareholderList = shareholderList?.filter(item => item?.ownership <= 100); topHolders = 0; otherOwner = 0; institutionalOwner = rawData?.ownershipPercent > 100 ? 99.99 : rawData?.ownershipPercent; otherOwner = institutionalOwner === 0 ? 0 : (100-institutionalOwner); - topHolders = shareholderList?.slice(0,10)?.reduce((total, shareholder) => total + shareholder.ownership, 0); - + topHolders = shareholderList?.slice(0,10)?.reduce((total, shareholder) => total + shareholder?.ownership, 0); const options = { animation: false, @@ -81,6 +80,8 @@ const plotPieChart = () => { return options; + } else return null; + } const getShareholders = async (ticker) => { @@ -185,31 +186,32 @@ let charNumber = 30; }).format(rawData?.investorsHolding)} Hedge Funds hold a total of {abbreviateNumber(rawData?.numberOf13Fshares)} {$displayCompanyName} shares, with a combined investment of {abbreviateNumber(rawData?.totalInvested, true)}. - -
-
- -
- -
+ {#if optionsPieChart !== null} +
+
+ +
+ +
-
- - - - Others: {otherOwner >= 99.99 ? 99.99 : otherOwner?.toFixed(2)}% - -
- -
- - - - Institutions: {institutionalOwner <= 0.01 ? "< 0.01%" : institutionalOwner?.toFixed(2)+'%'} - -
-
-
+
+ + + + Others: {otherOwner >= 99.99 ? 99.99 : otherOwner?.toFixed(2)}% + +
+ +
+ + + + Institutions: {institutionalOwner <= 0.01 ? "< 0.01%" : institutionalOwner?.toFixed(2)+'%'} + +
+
+
+ {/if} {#if putCallRatio !== 0}