bugfixing

This commit is contained in:
MuslemRahimi 2024-11-17 18:16:54 +01:00
parent 33a13b04bf
commit 8a1f4afa98
3 changed files with 18 additions and 18 deletions

View File

@ -95,4 +95,4 @@ export const load = async ({ params, locals }) => {
companyName: cleanString(getStockDeck?.companyName), companyName: cleanString(getStockDeck?.companyName),
getParams: params.tickerID, getParams: params.tickerID,
}; };
}; };

View File

@ -57,4 +57,4 @@ export const load = async ({ params, data }) => {
assetType.set("stock"); assetType.set("stock");
displayCompanyName.set(data?.companyName); displayCompanyName.set(data?.companyName);
await checkMarketHour(); await checkMarketHour();
}; };

View File

@ -12,7 +12,7 @@
wsBidPrice, wsBidPrice,
wsAskPrice, wsAskPrice,
currentPortfolioPrice, currentPortfolioPrice,
etfTicker, stockTicker,
displayCompanyName, displayCompanyName,
isOpen, isOpen,
isBeforeMarketOpen, 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 // add a check to see if running on client-side
if ($realtimePrice !== null && $realtimePrice !== 0) { if ($realtimePrice !== null && $realtimePrice !== 0) {
$realtimePrice = $realtimePrice =
@ -291,7 +291,7 @@
let maxPrice = []; let maxPrice = [];
async function historicalPrice(timePeriod: string) { async function historicalPrice(timePeriod: string) {
const cachedData = getCache($etfTicker, "historicalPrice" + timePeriod); const cachedData = getCache($stockTicker, "historicalPrice" + timePeriod);
if (cachedData) { if (cachedData) {
switch (timePeriod) { switch (timePeriod) {
case "one-week": case "one-week":
@ -316,7 +316,7 @@
output = null; output = null;
const postData = { const postData = {
ticker: $etfTicker, ticker: $stockTicker,
timePeriod: timePeriod, timePeriod: timePeriod,
}; };
@ -362,7 +362,7 @@
default: default:
console.log(`Unsupported time period: ${timePeriod}`); console.log(`Unsupported time period: ${timePeriod}`);
} }
setCache($etfTicker, mappedData, "historicalPrice" + timePeriod); setCache($stockTicker, mappedData, "historicalPrice" + timePeriod);
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} }
@ -423,7 +423,7 @@
async function getPrePostQuote() { async function getPrePostQuote() {
if (!$isOpen) { 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", { const response = await fetch("/api/ticker-data", {
method: "POST", method: "POST",
headers: { headers: {
@ -636,7 +636,7 @@
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
body: JSON.stringify({ ticker: $etfTicker, timePeriod: timePeriod }), body: JSON.stringify({ ticker: $stockTicker, timePeriod: timePeriod }),
}); });
exportList = await response.json(); exportList = await response.json();
@ -670,7 +670,7 @@
const a = document.createElement("a"); const a = document.createElement("a");
a.setAttribute("hidden", ""); a.setAttribute("hidden", "");
a.setAttribute("href", url); a.setAttribute("href", url);
a.setAttribute("download", `${$etfTicker}_${timePeriod}.csv`); a.setAttribute("download", `${$stockTicker}_${timePeriod}.csv`);
document.body.appendChild(a); document.body.appendChild(a);
a.click(); a.click();
document.body.removeChild(a); 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 // add a check to see if running on client-side
shouldUpdatePriceChart.set(false); shouldUpdatePriceChart.set(false);
oneDayPrice = []; oneDayPrice = [];
@ -769,21 +769,21 @@
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<title> <title>
{$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""} {$numberOfUnreadNotification > 0 ? `(${$numberOfUnreadNotification})` : ""}
{$displayCompanyName} ({$etfTicker}) Stock Price, Quote & News · stocknear {$displayCompanyName} ({$stockTicker}) Stock Price, Quote & News · stocknear
</title> </title>
<meta <meta
name="description" name="description"
content={`Get a real-time ${$displayCompanyName} (${$etfTicker}) stock chart, price quote with breaking news, financials, statistics, charts and more.`} content={`Get a real-time ${$displayCompanyName} (${$stockTicker}) stock chart, price quote with breaking news, financials, statistics, charts and more.`}
/> />
<!-- Other meta tags --> <!-- Other meta tags -->
<meta <meta
property="og:title" property="og:title"
content={`${$displayCompanyName} (${$etfTicker}) Stock Price, Quote & News · stocknear`} content={`${$displayCompanyName} (${$stockTicker}) Stock Price, Quote & News · stocknear`}
/> />
<meta <meta
property="og:description" property="og:description"
content={`Get a real-time ${$displayCompanyName} (${$etfTicker}) stock chart, price quote with breaking news, financials, statistics, charts and more.`} content={`Get a real-time ${$displayCompanyName} (${$stockTicker}) stock chart, price quote with breaking news, financials, statistics, charts and more.`}
/> />
<!--<meta property="og:image" content="https://stocknear-pocketbase.s3.amazonaws.com/logo/meta_logo.jpg"/>--> <!--<meta property="og:image" content="https://stocknear-pocketbase.s3.amazonaws.com/logo/meta_logo.jpg"/>-->
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
@ -793,11 +793,11 @@
<meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:card" content="summary_large_image" />
<meta <meta
name="twitter:title" name="twitter:title"
content={`${$displayCompanyName} (${$etfTicker}) Stock Price, Quote & News · stocknear`} content={`${$displayCompanyName} (${$stockTicker}) Stock Price, Quote & News · stocknear`}
/> />
<meta <meta
name="twitter:description" name="twitter:description"
content={`Get a real-time ${$displayCompanyName} (${$etfTicker}) stock chart, price quote with breaking news, financials, statistics, charts and more.`} content={`Get a real-time ${$displayCompanyName} (${$stockTicker}) stock chart, price quote with breaking news, financials, statistics, charts and more.`}
/> />
<!--<meta name="twitter:image" content="https://stocknear-pocketbase.s3.amazonaws.com/logo/meta_logo.jpg"/>--> <!--<meta name="twitter:image" content="https://stocknear-pocketbase.s3.amazonaws.com/logo/meta_logo.jpg"/>-->
<!-- Add more Twitter meta tags as needed --> <!-- Add more Twitter meta tags as needed -->
@ -907,7 +907,7 @@
<div <div
class="hidden sm:flex flex-row items-center pl-1 sm:pl-6 w-full mt-4" class="hidden sm:flex flex-row items-center pl-1 sm:pl-6 w-full mt-4"
> >
{#if !$etfTicker?.includes(".")} {#if !$stockTicker?.includes(".")}
<DropdownMenu.Root> <DropdownMenu.Root>
<DropdownMenu.Trigger asChild let:builder> <DropdownMenu.Trigger asChild let:builder>
<Button <Button