This commit is contained in:
MuslemRahimi 2024-11-02 19:05:18 +01:00
parent ce6733d1f9
commit de84b1e93a
2 changed files with 8 additions and 24 deletions

View File

@ -1,5 +1,4 @@
<script lang="ts"> <script lang="ts">
import * as Avatar from "$lib/components/shadcn/avatar/index.js";
import * as HoverCard from "$lib/components/shadcn/hover-card/index.js"; import * as HoverCard from "$lib/components/shadcn/hover-card/index.js";
import { ColorType } from "lightweight-charts"; import { ColorType } from "lightweight-charts";
@ -29,7 +28,7 @@
body: JSON.stringify(postData), body: JSON.stringify(postData),
}); });
stockChartData = (await response.json()) ?? {}; stockChartData = (await response?.json()) ?? {};
setCache(ticker, stockChartData, "hoverStockChart"); setCache(ticker, stockChartData, "hoverStockChart");
} }
@ -41,11 +40,14 @@
priceData = priceData priceData = priceData
?.map((item) => ({ ?.map((item) => ({
time: Date.parse(item.time), // Assuming 'time' is the correct property to parse time: Date?.parse(item?.time), // Assuming 'time' is the correct property to parse
value: item?.close ?? null, value: item?.close ?? null,
})) }))
.filter( ?.filter(
(item) => item?.value !== 0 && item?.value != null, // Simplified condition (item) =>
item?.value !== 0 &&
item?.value !== null &&
item?.value !== undefined,
); );
} }
@ -64,10 +66,7 @@
} }
return path; return path;
} }
const topLineColor = "#71CA96"; $: topLineColor = changesPercentage >= 0 ? "#71CA96" : "#FF7070";
const topFillColor1 = "rgba( 38, 166, 154, 0.2)";
const bottomLineColor = "#FF7070";
const bottomFillColor1 = "rgba(239, 83, 80, 0.2)";
let width = $screenWidth < 640 ? 80 : 150; //= ($screenWidth <= 1200 && $screenWidth > 900) ? 360 : ($screenWidth <= 900 && $screenWidth > 700) ? 260 : ($screenWidth <= 700 && $screenWidth >=600 ) ? 200 : ($screenWidth < 600 && $screenWidth >=500 ) ? 150 : 80; let width = $screenWidth < 640 ? 80 : 150; //= ($screenWidth <= 1200 && $screenWidth > 900) ? 360 : ($screenWidth <= 900 && $screenWidth > 700) ? 260 : ($screenWidth <= 700 && $screenWidth >=600 ) ? 200 : ($screenWidth < 600 && $screenWidth >=500 ) ? 150 : 80;
@ -252,9 +251,6 @@
data={priceData} data={priceData}
{...theme.series} {...theme.series}
{topLineColor} {topLineColor}
{topFillColor1}
{bottomLineColor}
{bottomFillColor1}
> >
<PriceLine <PriceLine
price={priceData?.at(0)?.value} price={priceData?.at(0)?.value}

View File

@ -132,18 +132,6 @@
let buttonText = "Top Winners"; let buttonText = "Top Winners";
const tabs = [
{
title: "Gainers",
},
{
title: "Losers",
},
{
title: "Active",
},
];
let activeIdx = 0; let activeIdx = 0;
function changeSection(index) { function changeSection(index) {