Skip to content

Commit

Permalink
Merge pull request #243 from Vizzuality/SKY30-354-empty-tooltip
Browse files Browse the repository at this point in the history
[SKY30-354]: hides hover tooltip when EEZ layer is not present
  • Loading branch information
andresgnlez authored Apr 10, 2024
2 parents c59dde1 + 76aca15 commit 7654280
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion frontend/src/containers/map/content/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,10 @@ const MainMap: React.FC = () => {

const disableMouseMove = popup.type === 'click' && popup.features?.length;

// ? the popup won't show up when the user is hovering a layer that is not EEZ
const hidePopup =
popup?.type === 'mousemove' && !popup.features?.some((f) => f.source === 'ezz-source');

return (
<div className="absolute left-0 h-full w-full border-r border-b border-black">
<Map
Expand All @@ -261,7 +265,7 @@ const MainMap: React.FC = () => {
cursor={cursor}
>
<>
<Popup />
{!hidePopup && <Popup />}
<LabelsManager />
<LayersToolbox />
<ZoomControls />
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/containers/map/content/map/popup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const PopupContainer = () => {
)}
{isHoveredTooltip && (
<div className="font-mono text-sm text-gray-500">
{popup.features[0].properties?.GEONAME}
{popup.features.find(({ source }) => source === 'ezz-source')?.properties?.GEONAME}
</div>
)}
{isClickedTooltip && selectedLayerId && <PopupItem id={selectedLayerId} />}
Expand Down

0 comments on commit 7654280

Please sign in to comment.