update hover chart
This commit is contained in:
parent
b44f381e48
commit
08e738352e
@ -8,6 +8,7 @@
|
|||||||
import { abbreviateNumber } from "$lib/utils";
|
import { abbreviateNumber } from "$lib/utils";
|
||||||
import { afterUpdate } from "svelte";
|
import { afterUpdate } from "svelte";
|
||||||
export let symbol;
|
export let symbol;
|
||||||
|
export let assetType = "stock";
|
||||||
|
|
||||||
let priceData = [];
|
let priceData = [];
|
||||||
let changesPercentage = 0;
|
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 topLineColor = "#71CA96";
|
||||||
const topFillColor1 = "rgba( 38, 166, 154, 0.2)";
|
const topFillColor1 = "rgba( 38, 166, 154, 0.2)";
|
||||||
const bottomLineColor = "#FF7070";
|
const bottomLineColor = "#FF7070";
|
||||||
@ -156,19 +172,13 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div on:mouseover={() => getStockData(symbol)}>
|
<div on:mouseover={() => getStockData(symbol)} class="inline-block">
|
||||||
<HoverCard.Root>
|
<HoverCard.Root>
|
||||||
<div on:mouseover>
|
<div on:mouseover>
|
||||||
<HoverCard.Trigger
|
<HoverCard.Trigger
|
||||||
class="rounded-sm underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-8 focus-visible:outline-black"
|
class="rounded-sm underline-offset-4 hover:underline focus-visible:outline-2 focus-visible:outline-offset-8 focus-visible:outline-black"
|
||||||
>
|
>
|
||||||
<a
|
<a href={getHref(symbol)} class="sm:hover:text-white text-blue-400"
|
||||||
href={symbol?.length !== 0 && !["BTC", "USD"]?.includes(symbol)
|
|
||||||
? `/stocks/${symbol}`
|
|
||||||
: symbol === "BTC"
|
|
||||||
? "/crypto/BTCUSD"
|
|
||||||
: ""}
|
|
||||||
class="sm:hover:text-white text-blue-400"
|
|
||||||
>{symbol?.length !== 0 ? symbol : "-"}</a
|
>{symbol?.length !== 0 ? symbol : "-"}</a
|
||||||
>
|
>
|
||||||
</HoverCard.Trigger>
|
</HoverCard.Trigger>
|
||||||
|
|||||||
@ -337,6 +337,7 @@ const handleTwitchMessage = (event) => {
|
|||||||
>Top Analyst</a
|
>Top Analyst</a
|
||||||
>
|
>
|
||||||
</Button>
|
</Button>
|
||||||
|
<!--
|
||||||
<Button
|
<Button
|
||||||
builders={[builder]}
|
builders={[builder]}
|
||||||
type="submit"
|
type="submit"
|
||||||
@ -348,6 +349,7 @@ const handleTwitchMessage = (event) => {
|
|||||||
>Top Analyst Stocks</a
|
>Top Analyst Stocks</a
|
||||||
>
|
>
|
||||||
</Button>
|
</Button>
|
||||||
|
-->
|
||||||
<Button
|
<Button
|
||||||
builders={[builder]}
|
builders={[builder]}
|
||||||
type="submit"
|
type="submit"
|
||||||
@ -941,11 +943,13 @@ const handleTwitchMessage = (event) => {
|
|||||||
class="text-[1rem] text-white ml-4 mt-4"
|
class="text-[1rem] text-white ml-4 mt-4"
|
||||||
>Top Analyst</a
|
>Top Analyst</a
|
||||||
>
|
>
|
||||||
|
<!--
|
||||||
<a
|
<a
|
||||||
href="/analysts/top-stocks"
|
href="/analysts/top-stocks"
|
||||||
class="text-[1rem] text-white ml-4 mt-4"
|
class="text-[1rem] text-white ml-4 mt-4"
|
||||||
>Top Analyst Stocks</a
|
>Top Analyst Stocks</a
|
||||||
>
|
>
|
||||||
|
-->
|
||||||
<a
|
<a
|
||||||
href="/most-shorted-stocks"
|
href="/most-shorted-stocks"
|
||||||
class="text-[1rem] text-white ml-4 mt-4"
|
class="text-[1rem] text-white ml-4 mt-4"
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
import ArrowUpRight from "lucide-svelte/icons/arrow-up-right";
|
import ArrowUpRight from "lucide-svelte/icons/arrow-up-right";
|
||||||
import { abbreviateNumber } from "$lib/utils";
|
import { abbreviateNumber } from "$lib/utils";
|
||||||
import * as Tabs from "$lib/components/shadcn/tabs/index.js";
|
import * as Tabs from "$lib/components/shadcn/tabs/index.js";
|
||||||
|
import HoverStockChart from "$lib/components/HoverStockChart.svelte";
|
||||||
|
|
||||||
import { screenWidth, numberOfUnreadNotification } from "$lib/store";
|
import { screenWidth, numberOfUnreadNotification } from "$lib/store";
|
||||||
|
|
||||||
@ -267,11 +268,7 @@
|
|||||||
{#each gainersList as item}
|
{#each gainersList as item}
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
<a
|
<HoverStockChart symbol={item?.symbol} />
|
||||||
href={`/stocks/${item?.symbol}`}
|
|
||||||
class="text-sm sm:text-[1rem] font-medium text-blue-400 sm:hover:text-white transition duration-100"
|
|
||||||
>{item?.symbol}</a
|
|
||||||
>
|
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
<Table.Cell
|
<Table.Cell
|
||||||
class="hidden sm:table-cell xl:table.-column text-sm sm:text-[1rem]"
|
class="hidden sm:table-cell xl:table.-column text-sm sm:text-[1rem]"
|
||||||
@ -348,11 +345,7 @@
|
|||||||
{#each losersList as item}
|
{#each losersList as item}
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
<a
|
<HoverStockChart symbol={item?.symbol} />
|
||||||
href={`/stocks/${item?.symbol}`}
|
|
||||||
class="text-sm sm:text-[1rem] font-medium text-blue-400 sm:hover:text-white transition duration-100"
|
|
||||||
>{item?.symbol}</a
|
|
||||||
>
|
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
<Table.Cell
|
<Table.Cell
|
||||||
class="hidden sm:table-cell xl:table.-column text-sm sm:text-[1rem]"
|
class="hidden sm:table-cell xl:table.-column text-sm sm:text-[1rem]"
|
||||||
@ -469,13 +462,10 @@
|
|||||||
{#each optionsTable as item}
|
{#each optionsTable as item}
|
||||||
<Table.Row>
|
<Table.Row>
|
||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
<a
|
<HoverStockChart
|
||||||
href={item?.underlying_type === "stock"
|
symbol={item?.ticker}
|
||||||
? `/stocks/${item?.ticker}`
|
assetType={item?.underlying_type}
|
||||||
: `/etf/${item?.ticker}`}
|
/>
|
||||||
class="text-sm sm:text-[1rem] font-medium text-blue-400 sm:hover:text-white transition duration-100"
|
|
||||||
>{item?.ticker}</a
|
|
||||||
>
|
|
||||||
</Table.Cell>
|
</Table.Cell>
|
||||||
<Table.Cell
|
<Table.Cell
|
||||||
class="text-right xl:table.-column text-sm sm:text-[1rem] {item?.put_call ===
|
class="text-right xl:table.-column text-sm sm:text-[1rem] {item?.put_call ===
|
||||||
@ -537,11 +527,9 @@
|
|||||||
{#if data?.getDashboard?.recentDividends?.length !== 0}
|
{#if data?.getDashboard?.recentDividends?.length !== 0}
|
||||||
<ul style="padding-left: 5px;">
|
<ul style="padding-left: 5px;">
|
||||||
{#each data?.getDashboard?.recentDividends as item}
|
{#each data?.getDashboard?.recentDividends as item}
|
||||||
<strong>{item?.name}</strong> (<a
|
<strong>{item?.name}</strong> (<HoverStockChart
|
||||||
href="/stocks/{item?.symbol}"
|
symbol={item?.symbol}
|
||||||
class="sm:hover:text-white text-blue-400"
|
/>) has announced its upcoming dividend details as of {convertTimestamp(
|
||||||
>{item?.symbol}</a
|
|
||||||
>) has announced its upcoming dividend details as of {convertTimestamp(
|
|
||||||
item?.updated,
|
item?.updated,
|
||||||
)}:
|
)}:
|
||||||
|
|
||||||
@ -645,11 +633,9 @@
|
|||||||
<li
|
<li
|
||||||
style="margin-left: 8px; line-height: 22px; margin-bottom: 30px; list-style-type: disc;"
|
style="margin-left: 8px; line-height: 22px; margin-bottom: 30px; list-style-type: disc;"
|
||||||
>
|
>
|
||||||
<strong>{item?.name}</strong> (<a
|
<strong>{item?.name}</strong> (<HoverStockChart
|
||||||
href="/stocks/{item?.symbol}"
|
symbol={item?.symbol}
|
||||||
class="text-blue-400 sm:hover:text-white"
|
/>)
|
||||||
>{item?.symbol}</a
|
|
||||||
>)
|
|
||||||
{item?.isToday === true
|
{item?.isToday === true
|
||||||
? "will report today"
|
? "will report today"
|
||||||
: [
|
: [
|
||||||
@ -724,11 +710,9 @@
|
|||||||
{#if data?.getDashboard?.recentEarnings?.length !== 0}
|
{#if data?.getDashboard?.recentEarnings?.length !== 0}
|
||||||
<ul style="padding-left: 5px;">
|
<ul style="padding-left: 5px;">
|
||||||
{#each data?.getDashboard?.recentEarnings as item}
|
{#each data?.getDashboard?.recentEarnings as item}
|
||||||
<strong>{item?.name}</strong> (<a
|
<strong>{item?.name}</strong> (<HoverStockChart
|
||||||
href="/stocks/{item?.symbol}"
|
symbol={item?.symbol}
|
||||||
class="sm:hover:text-white text-blue-400"
|
/>) has released its quarterly earnings at {formatTime(
|
||||||
>{item?.symbol}</a
|
|
||||||
>) has released its quarterly earnings at {formatTime(
|
|
||||||
item?.time,
|
item?.time,
|
||||||
)}:
|
)}:
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
displayCompanyName,
|
displayCompanyName,
|
||||||
} from "$lib/store";
|
} from "$lib/store";
|
||||||
import { Button } from "$lib/components/shadcn/button/index.js";
|
import { Button } from "$lib/components/shadcn/button/index.js";
|
||||||
import { screenWidth, getCache, setCache } from "$lib/store";
|
import { screenWidth } from "$lib/store";
|
||||||
import { abbreviateNumber, formatString } from "$lib/utils";
|
import { abbreviateNumber, formatString } from "$lib/utils";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import { goto } from "$app/navigation";
|
import { goto } from "$app/navigation";
|
||||||
|
|||||||
@ -93,7 +93,7 @@
|
|||||||
<aside class="hidden lg:block relative fixed w-1/4 ml-4">
|
<aside class="hidden lg:block relative fixed w-1/4 ml-4">
|
||||||
{#if data?.user?.tier !== "Pro" || data?.user?.freeTrial}
|
{#if data?.user?.tier !== "Pro" || data?.user?.freeTrial}
|
||||||
<div
|
<div
|
||||||
class="w-full bg-[#27272A] duration-100 ease-out sm:hover:text-white text-gray-400 sm:hover:border-gray-700 border border-gray-800 rounded-md h-fit pb-4 mt-4 cursor-pointer"
|
class="w-full text-white border border-gray-600 rounded-md h-fit pb-4 mt-4 cursor-pointer"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href={"/pricing"}
|
href={"/pricing"}
|
||||||
@ -113,7 +113,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="w-full bg-[#27272A] duration-100 ease-out sm:hover:text-white text-gray-400 sm:hover:border-gray-700 border border-gray-800 rounded-md h-fit pb-4 mt-4 cursor-pointer"
|
class="w-full text-white border border-gray-600 rounded-md h-fit pb-4 mt-4 cursor-pointer"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href={"/analysts"}
|
href={"/analysts"}
|
||||||
@ -132,7 +132,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="w-full bg-[#27272A] duration-100 ease-out sm:hover:text-white text-gray-400 sm:hover:border-gray-700 border border-gray-800 rounded-md h-fit pb-4 mt-4 cursor-pointer"
|
class="w-full text-white border border-gray-600 rounded-md h-fit pb-4 mt-4 cursor-pointer"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href={"/politicians"}
|
href={"/politicians"}
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
import { screenWidth, numberOfUnreadNotification } from "$lib/store";
|
import { screenWidth, numberOfUnreadNotification } from "$lib/store";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
import TableHeader from "$lib/components/Table/TableHeader.svelte";
|
import TableHeader from "$lib/components/Table/TableHeader.svelte";
|
||||||
|
import HoverStockChart from "$lib/components/HoverStockChart.svelte";
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
let rawData = data?.getETFProviderData;
|
let rawData = data?.getETFProviderData;
|
||||||
@ -226,12 +227,7 @@
|
|||||||
<td
|
<td
|
||||||
class="font-medium text-sm sm:text-[1rem] whitespace-nowrap border-b-[#09090B]"
|
class="font-medium text-sm sm:text-[1rem] whitespace-nowrap border-b-[#09090B]"
|
||||||
>
|
>
|
||||||
<a
|
<HoverStockChart symbol={item?.symbol} assetType={"etf"} />
|
||||||
href={"/etf/" + item?.symbol}
|
|
||||||
class="sm:hover:text-white text-blue-400"
|
|
||||||
>
|
|
||||||
{item?.symbol}
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td
|
<td
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user