From 3344f40e33d327dcec90b1aa0dba12c7d5d82538 Mon Sep 17 00:00:00 2001 From: Markus Killendahl Date: Thu, 29 Dec 2022 11:09:57 +0100 Subject: [PATCH] add tooltips (#99) --- web/src/features/map-controls/MapControls.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/features/map-controls/MapControls.tsx b/web/src/features/map-controls/MapControls.tsx index 2db7fde81e..55f868a0da 100644 --- a/web/src/features/map-controls/MapControls.tsx +++ b/web/src/features/map-controls/MapControls.tsx @@ -41,6 +41,10 @@ function WeatherButton({ type }: { type: 'wind' | 'solar' }) { const [isLoadingLayer, setIsLoadingLayer] = useAtom(weatherButtonMap[type].loadingAtom); const isEnabled = enabled === ToggleOptions.ON; const Icon = weatherButtonMap[type].icon; + const tooltipTexts = { + wind: isEnabled ? __('tooltips.hideWindLayer') : __('tooltips.showWindLayer'), + solar: isEnabled ? __('tooltips.hideSolarLayer') : __('tooltips.showSolarLayer'), + }; const onToggle = () => { if (!isEnabled) { @@ -58,7 +62,7 @@ function WeatherButton({ type }: { type: 'wind' | 'solar' }) { ) } - tooltipText={__(`tooltips.${type}}`)} + tooltipText={tooltipTexts[type]} dataTestId={`${type}-layer-button`} className={`${isLoadingLayer ? 'cursor-default' : 'cursor-pointer'}`} onClick={!isLoadingLayer ? onToggle : () => {}}