From 0b93a78d88c995cf999b8371c96eb8e188e4c5df Mon Sep 17 00:00:00 2001 From: Peter Bull Hove Date: Tue, 2 Apr 2024 10:27:26 +0200 Subject: [PATCH] refactor: rename and refactor --- web/src/Components/Bridging/BridgeGraph.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/src/Components/Bridging/BridgeGraph.tsx b/web/src/Components/Bridging/BridgeGraph.tsx index 618b98a..02e82f3 100644 --- a/web/src/Components/Bridging/BridgeGraph.tsx +++ b/web/src/Components/Bridging/BridgeGraph.tsx @@ -29,7 +29,7 @@ const TooltipCard = styled.div` ` -const CustomTooltip = ({ active, payload }) => { +const GraphTooltip = ({ active, payload }) => { if (active && payload && payload.length) { const numMicrons = Math.round(payload[0].payload.size) return ( @@ -61,14 +61,14 @@ export function BridgeGraph({ bridges, sizeFractions }) { }, [particleRange, sizeFractions]) function particleSizeOffsetPercentage(offsetSize) { - let index = sizeFractions.findIndex(size => size > offsetSize) + const index = sizeFractions.findIndex(size => size > offsetSize) if (index === -1) return "" - let percentage = (index / sizeFractions.length) * 100 - return `${parseInt(percentage)}%` + const percentage = Math.round(index / sizeFractions.length) * 100 + return `${percentage}%` } useEffect(() => { - let newGraphData = findGraphData(sizeFractions, bridges) + const newGraphData = findGraphData(sizeFractions, bridges) setGraphData(newGraphData) }, [bridges, sizeFractions]) @@ -95,7 +95,7 @@ export function BridgeGraph({ bridges, sizeFractions }) { height={70} /> - } /> + } /> {Object.entries(bridges).map(([name, cumulative], index) => (