diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index 1d524db5..96cae418 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -39,6 +39,7 @@ export let form; let prePostData = {}; + let stockDeck = {}; $: previousClose = data?.getStockQuote?.previousClose; @@ -577,32 +578,6 @@ MAX: maxPrice, }; - $: { - if ($stockTicker && typeof window !== "undefined") { - // add a check to see if running on client-side - shouldUpdatePriceChart.set(false); - oneDayPrice = []; - oneWeekPrice = []; - oneMonthPrice = []; - oneYearPrice = []; - maxPrice = []; - prePostData = {}; - output = null; - - const asyncFunctions = [getPrePostQuote()]; - - Promise.all(asyncFunctions) - .then((results) => { - setTimeout(() => { - initializePrice(); - }, 100); - }) - .catch((error) => { - console.error("An error occurred:", error); - }); - } - } - $: { if (form) { $globalForm = form; @@ -695,7 +670,6 @@ } onMount(() => { - // Subscribe to the store shouldUpdatePriceChart.subscribe(async (value) => { if ( value && @@ -718,6 +692,32 @@ } }); }); + + $: { + if ($stockTicker && typeof window !== "undefined") { + // add a check to see if running on client-side + shouldUpdatePriceChart.set(false); + oneDayPrice = []; + oneWeekPrice = []; + oneMonthPrice = []; + oneYearPrice = []; + maxPrice = []; + prePostData = {}; + output = null; + + stockDeck = stockDeck; + + const asyncFunctions = [getPrePostQuote()]; + + Promise.all(asyncFunctions) + .then((results) => { + initializePrice(); + }) + .catch((error) => { + console.error("An error occurred:", error); + }); + } + } @@ -997,7 +997,48 @@
-
+
+
+
    + {#each intervals as interval} +
  • + +
  • + {/each} +
+
+
+ = 0 + ? "before:content-['+'] text-[#00FC50]" + : "text-[#FF2F1F]"} + > + {displayLegend?.change}% + + +
+
+
@@ -1055,7 +1096,7 @@
- {#if output !== null} + {#if output !== null && dataMapping[displayData]?.length !== 0} {:else}