From 8a1f4afa98b07c6c0e323cd29d6e29fba4de59fc Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sun, 17 Nov 2024 18:16:54 +0100 Subject: [PATCH] bugfixing --- .../stocks/[tickerID]/+layout.server.ts | 2 +- src/routes/stocks/[tickerID]/+layout.ts | 2 +- src/routes/stocks/[tickerID]/+page.svelte | 32 +++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/routes/stocks/[tickerID]/+layout.server.ts b/src/routes/stocks/[tickerID]/+layout.server.ts index 5be06500..eae3a072 100644 --- a/src/routes/stocks/[tickerID]/+layout.server.ts +++ b/src/routes/stocks/[tickerID]/+layout.server.ts @@ -95,4 +95,4 @@ export const load = async ({ params, locals }) => { companyName: cleanString(getStockDeck?.companyName), getParams: params.tickerID, }; -}; +}; \ No newline at end of file diff --git a/src/routes/stocks/[tickerID]/+layout.ts b/src/routes/stocks/[tickerID]/+layout.ts index 1e4724c9..208e5b77 100644 --- a/src/routes/stocks/[tickerID]/+layout.ts +++ b/src/routes/stocks/[tickerID]/+layout.ts @@ -57,4 +57,4 @@ export const load = async ({ params, data }) => { assetType.set("stock"); displayCompanyName.set(data?.companyName); await checkMarketHour(); -}; +}; \ No newline at end of file diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index b8157c3b..0b8316c0 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -12,7 +12,7 @@ wsBidPrice, wsAskPrice, currentPortfolioPrice, - etfTicker, + stockTicker, displayCompanyName, isOpen, isBeforeMarketOpen, @@ -156,7 +156,7 @@ //==========================// $: { - if ($etfTicker && typeof window !== "undefined") { + if ($stockTicker && typeof window !== "undefined") { // add a check to see if running on client-side if ($realtimePrice !== null && $realtimePrice !== 0) { $realtimePrice = @@ -291,7 +291,7 @@ let maxPrice = []; async function historicalPrice(timePeriod: string) { - const cachedData = getCache($etfTicker, "historicalPrice" + timePeriod); + const cachedData = getCache($stockTicker, "historicalPrice" + timePeriod); if (cachedData) { switch (timePeriod) { case "one-week": @@ -316,7 +316,7 @@ output = null; const postData = { - ticker: $etfTicker, + ticker: $stockTicker, timePeriod: timePeriod, }; @@ -362,7 +362,7 @@ default: console.log(`Unsupported time period: ${timePeriod}`); } - setCache($etfTicker, mappedData, "historicalPrice" + timePeriod); + setCache($stockTicker, mappedData, "historicalPrice" + timePeriod); } catch (e) { console.log(e); } @@ -423,7 +423,7 @@ async function getPrePostQuote() { if (!$isOpen) { - const postData = { ticker: $etfTicker, path: "pre-post-quote" }; + const postData = { ticker: $stockTicker, path: "pre-post-quote" }; const response = await fetch("/api/ticker-data", { method: "POST", headers: { @@ -636,7 +636,7 @@ headers: { "Content-Type": "application/json", }, - body: JSON.stringify({ ticker: $etfTicker, timePeriod: timePeriod }), + body: JSON.stringify({ ticker: $stockTicker, timePeriod: timePeriod }), }); exportList = await response.json(); @@ -670,7 +670,7 @@ const a = document.createElement("a"); a.setAttribute("hidden", ""); a.setAttribute("href", url); - a.setAttribute("download", `${$etfTicker}_${timePeriod}.csv`); + a.setAttribute("download", `${$stockTicker}_${timePeriod}.csv`); document.body.appendChild(a); a.click(); document.body.removeChild(a); @@ -738,7 +738,7 @@ }); $: { - if ($etfTicker && typeof window !== "undefined") { + if ($stockTicker && typeof window !== "undefined") { // add a check to see if running on client-side shouldUpdatePriceChart.set(false); oneDayPrice = []; @@ -769,21 +769,21 @@ {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} - {$displayCompanyName} ({$etfTicker}) Stock Price, Quote & News · stocknear + {$displayCompanyName} ({$stockTicker}) Stock Price, Quote & News · stocknear @@ -793,11 +793,11 @@ @@ -907,7 +907,7 @@