From bf8f1096021920166e85ea90dc60db0fd0a8af91 Mon Sep 17 00:00:00 2001 From: Yana Date: Sat, 22 Feb 2025 18:08:26 +0200 Subject: [PATCH] cut off last day in noise and stake line graphs --- .../landingPageComponents/NetworkStakeCard.tsx | 14 ++++++++------ .../landingPageComponents/NoiseCard.tsx | 17 ++++------------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/explorer-nextjs/src/components/landingPageComponents/NetworkStakeCard.tsx b/explorer-nextjs/src/components/landingPageComponents/NetworkStakeCard.tsx index 90936e2d79..f18a0c926b 100644 --- a/explorer-nextjs/src/components/landingPageComponents/NetworkStakeCard.tsx +++ b/explorer-nextjs/src/components/landingPageComponents/NetworkStakeCard.tsx @@ -44,12 +44,14 @@ export const NetworkStakeCard = () => { const lastTotalStake = packetsAndStaking[packetsAndStaking.length - 1]?.total_stake / 1_000_000; - const data = packetsAndStakingData.map((item: IPacketsAndStakingData) => { - return { - date_utc: item.date_utc, - numericData: item.total_stake / 1000000, - }; - }); + const data = packetsAndStakingData + .slice(0, -1) + .map((item: IPacketsAndStakingData) => { + return { + date_utc: item.date_utc, + numericData: item.total_stake / 1000000, + }; + }); const stakeLineGraphData = { color: "#00CA33", diff --git a/explorer-nextjs/src/components/landingPageComponents/NoiseCard.tsx b/explorer-nextjs/src/components/landingPageComponents/NoiseCard.tsx index 5802a8b44c..c722184f7b 100644 --- a/explorer-nextjs/src/components/landingPageComponents/NoiseCard.tsx +++ b/explorer-nextjs/src/components/landingPageComponents/NoiseCard.tsx @@ -40,15 +40,6 @@ export const NoiseCard = () => { const todaysData = data[data.length - 1]; const yesterdaysData = data[data.length - 2]; - const filterData = ( - data: IPacketsAndStakingData[], - cutoffDateStr = "2025-02-11", - ): IPacketsAndStakingData[] => { - const cutoffDate = new Date(cutoffDateStr); - - return data.filter((entry) => new Date(entry.date_utc) >= cutoffDate); - }; - const noiseLast24H = todaysData.total_packets_sent + todaysData.total_packets_received; const noisePrevious24H = @@ -90,14 +81,14 @@ export const NoiseCard = () => { const noiseLast24HFormatted = formatBigNum(noiseLast24H)?.toString() || ""; - const noiseLineGraphData = filterData(data).map( - (item: IPacketsAndStakingData) => { + const noiseLineGraphData = data + .slice(0, -1) + .map((item: IPacketsAndStakingData) => { return { date_utc: item.date_utc, numericData: item.total_packets_sent + item.total_packets_received, }; - }, - ); + }); return (