Skip to content

Commit d831d6e

Browse files
authored
cleanup: remove old code that are no longer used (#8117)
1 parent 792fe85 commit d831d6e

File tree

5 files changed

+3
-43
lines changed

5 files changed

+3
-43
lines changed

web/src/features/charts/bar-breakdown/BarBreakdownChart.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { TimeDisplay } from 'components/TimeDisplay';
44
import { getOffsetTooltipPosition } from 'components/tooltips/utilities';
55
import { ZoneHeaderGauges } from 'features/panels/zone/ZoneHeaderGauges';
66
import { useGetEstimationTranslation } from 'hooks/getEstimationTranslation';
7-
import { useHeaderHeight } from 'hooks/headerHeight';
87
import { TFunction } from 'i18next';
98
import { useAtomValue } from 'jotai';
109
import { CircleDashed, TrendingUpDown, X } from 'lucide-react';
@@ -67,7 +66,6 @@ function BarBreakdownChart({
6766
x: number;
6867
y: number;
6968
} | null>(null);
70-
const headerHeight = useHeaderHeight();
7169

7270
const titleText = useBarBreakdownChartTitle();
7371
const estimationMethod = currentZoneDetail?.estimationMethod;
@@ -155,7 +153,7 @@ function BarBreakdownChart({
155153
className="absolute mt-14 flex h-full w-full flex-col items-center gap-y-1 bg-black/20 sm:mt-auto sm:items-start"
156154
style={{
157155
left: tooltipData?.x,
158-
top: tooltipData?.y <= headerHeight ? headerHeight : tooltipData?.y,
156+
top: tooltipData?.y,
159157
}}
160158
>
161159
<BreakdownChartTooltip

web/src/features/charts/elements/AreaGraph.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ScaleLinear, scaleLinear } from 'd3-scale';
22
import { Series, stack, stackOffsetDiverging } from 'd3-shape';
33
import { add } from 'date-fns';
44
import TimeAxis from 'features/time/TimeAxis';
5-
import { useHeaderHeight } from 'hooks/headerHeight';
65
import { atom, useAtom, useAtomValue } from 'jotai';
76
import { memo, useCallback, useMemo, useRef, useState } from 'react';
87
import { useParams } from 'react-router-dom';
@@ -236,8 +235,6 @@ function AreaGraph({
236235
setGraphIndex(null);
237236
}, [setTooltipData, setHoveredLayerIndex, setGraphIndex]);
238237

239-
const headerHeight = useHeaderHeight();
240-
241238
// Don't render the graph if datetimes and datapoints are not in sync
242239
for (const layer of layers) {
243240
if (layer.datapoints.length !== datetimes.length) {
@@ -315,7 +312,6 @@ function AreaGraph({
315312
}
316313
tooltipSize={tooltipSize}
317314
isBiggerThanMobile={isBiggerThanMobile}
318-
headerHeight={headerHeight}
319315
closeTooltip={onCloseTooltip}
320316
>
321317
{(props) => tooltip(props)}

web/src/features/charts/tooltips/AreaGraphTooltip.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ interface AreaGraphTooltipProperties {
1414
position?: { x: number; y: number } | undefined;
1515
tooltipSize?: 'small' | 'large';
1616
isBiggerThanMobile: boolean;
17-
headerHeight: number;
1817
closeTooltip: () => void;
1918
}
2019

@@ -25,7 +24,6 @@ export default function AreaGraphTooltip({
2524
position,
2625
tooltipSize,
2726
isBiggerThanMobile,
28-
headerHeight,
2927
closeTooltip,
3028
}: AreaGraphTooltipProperties): ReactElement | null {
3129
if (selectedLayerKey === undefined || zoneDetail === undefined) {
@@ -46,10 +44,7 @@ export default function AreaGraphTooltip({
4644
<div
4745
style={{
4846
left: tooltipWithDataPositon.x,
49-
top:
50-
tooltipWithDataPositon.y <= headerHeight
51-
? headerHeight
52-
: tooltipWithDataPositon.y,
47+
top: tooltipWithDataPositon.y,
5348
}}
5449
className="relative flex flex-col items-center gap-y-1 p-2 pt-14 sm:block sm:p-0"
5550
>

web/src/features/exchanges/ExchangeArrow.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import TooltipWrapper from 'components/tooltips/TooltipWrapper';
22
import { mapMovingAtom } from 'features/map/mapAtoms';
3-
import { useHeaderHeight } from 'hooks/headerHeight';
43
import { useSetAtom } from 'jotai';
54
import { useCallback, useEffect } from 'react';
65
import { resolvePath } from 'react-router-dom';
@@ -28,7 +27,6 @@ function ExchangeArrow({
2827
}: ExchangeArrowProps) {
2928
const { co2intensity, lonlat, netFlow, rotation, key } = data;
3029
const setIsMoving = useSetAtom(mapMovingAtom);
31-
const headerHeight = useHeaderHeight();
3230

3331
useEffect(() => {
3432
const cancelWheel = (event: Event) => event.preventDefault();
@@ -116,7 +114,7 @@ function ExchangeArrow({
116114
// Setting the top position from the arrow tooltip preventing overflowing to top.
117115
let tooltipClassName = 'max-h-[256px] max-w-[512px] md:flex';
118116
if (!isMobile) {
119-
tooltipClassName += y - 140 < headerHeight ? ' top-[76px]' : ' top-[-76px]';
117+
tooltipClassName += y < 140 ? ' top-[76px]' : ' top-[-76px]';
120118
}
121119

122120
if (

web/src/hooks/headerHeight.ts

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)