diff --git a/src/lib/components/HoverStockChart.svelte b/src/lib/components/HoverStockChart.svelte index 4cb81b81..95ab6d1c 100644 --- a/src/lib/components/HoverStockChart.svelte +++ b/src/lib/components/HoverStockChart.svelte @@ -8,6 +8,7 @@ import { abbreviateNumber } from "$lib/utils"; import { afterUpdate } from "svelte"; export let symbol; + export let assetType = "stock"; let priceData = []; let changesPercentage = 0; @@ -48,6 +49,21 @@ ); } + function getHref(symbol: string) { + let path = ""; + if (symbol?.length !== 0) { + if (assetType?.toLowerCase() === "stock") { + path = `/stocks/${symbol}`; + } else if (assetType?.toLowerCase() === "etf") { + path = `/etf/${symbol}`; + } else if (["BTC", "USD"]?.includes(symbol)) { + path = ""; + } else { + path = `/crypto/${symbol}`; + } + } + return path; + } const topLineColor = "#71CA96"; const topFillColor1 = "rgba( 38, 166, 154, 0.2)"; const bottomLineColor = "#FF7070"; @@ -156,19 +172,13 @@ }); -
getStockData(symbol)}> +
getStockData(symbol)} class="inline-block">
- {symbol?.length !== 0 ? symbol : "-"} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 71a223b9..2986f8f6 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -337,6 +337,7 @@ const handleTwitchMessage = (event) => { >Top Analyst +