From e7cb0c7d51295281768d3d58a16504901adcd1aa Mon Sep 17 00:00:00 2001 From: christn Date: Fri, 24 May 2024 16:45:56 +0800 Subject: [PATCH] Remove logs and change linewidth --- src/mainsite/api/market-caps.ts | 16 +++++++++++++++- src/mainsite/components/MarketCapRatioWidget.tsx | 9 +++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/mainsite/api/market-caps.ts b/src/mainsite/api/market-caps.ts index aec3e809..e98c9a29 100644 --- a/src/mainsite/api/market-caps.ts +++ b/src/mainsite/api/market-caps.ts @@ -1,6 +1,7 @@ import useSWR from "swr"; import * as Duration from "../../duration"; import { fetchJsonSwr } from "./fetchers"; +import { useFlippeningData } from "./flippening-data"; type MarketCaps = { btcMarketCap: number; @@ -14,6 +15,19 @@ export const useMarketCaps = (): MarketCaps | undefined => { const { data } = useSWR("/api/fees/market-caps", fetchJsonSwr, { refreshInterval: Duration.millisFromSeconds(30), }); + const flippeningData = useFlippeningData(); + const lastFlippeningDatapoint = flippeningData?.[flippeningData.length - 1]; - return data; + const marketCapData = + (data === undefined || lastFlippeningDatapoint === undefined) + ? undefined + : { + btcMarketCap: lastFlippeningDatapoint.btcMarketcap, + ethMarketCap: lastFlippeningDatapoint.ethMarketcap, + goldMarketCap: data.goldMarketCap, + usdM3MarketCap: data.usdM3MarketCap, + timestamp: data.timestamp, + }; + + return marketCapData; }; diff --git a/src/mainsite/components/MarketCapRatioWidget.tsx b/src/mainsite/components/MarketCapRatioWidget.tsx index 871b1103..8376ff46 100644 --- a/src/mainsite/components/MarketCapRatioWidget.tsx +++ b/src/mainsite/components/MarketCapRatioWidget.tsx @@ -227,7 +227,7 @@ const MarketCapRatiosWidget: FC = ({ color: COLORS.SERIES[0], threshold: barrier, data: marketCapRatiosSeries, - lineWidth: 3, + lineWidth: 2, states: { hover: { lineWidthPlus: 0, @@ -244,7 +244,7 @@ const MarketCapRatiosWidget: FC = ({ showInLegend: true, threshold: barrier, data: exponentialGrowthCurveSeries, - lineWidth: 3, + lineWidth: 2, states: { hover: { lineWidthPlus: 0, @@ -299,10 +299,7 @@ const MarketCapRatiosWidget: FC = ({ ); if (!isProjected && firstPoint?.x !== undefined) { - console.log("First Point", firstPoint); const marketCaps = marketCapsMap[firstPoint.x as number]; - console.log("Market caps Map", marketCapsMap); - console.log("Market caps", marketCaps); const marketCapRows = [ ` @@ -390,7 +387,7 @@ const MarketCapRatiosWidget: FC = ({ ) : ( -
+
)}