Skip to content

Commit

Permalink
[fix]: Show attributionControl on IncidentMap and hide leaflet prefix (
Browse files Browse the repository at this point in the history
…#2886)

* Show attributionControl on IncidentMap and hide leaflet prefix

* Hide attributionControl in location map

* Change empty string to false
  • Loading branch information
vdegraaf authored Jul 2, 2024
1 parent 5aaf24c commit 3c1bc42
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
7 changes: 0 additions & 7 deletions src/components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,7 @@ const Map: FC<PropsWithChildren<MapProps>> = ({
const { mapActive } = useSelector(makeSelectIncidentContainer)

useEffect(() => {
/* istanbul ignore next */
const timeout = setTimeout(() => {
document.querySelector('.leaflet-control-attribution a')?.remove()
document.querySelector('.leaflet-control-attribution span')?.remove()
}, 0)

return () => {
clearTimeout(timeout)
if (mapActive) {
dispatch(closeMap())
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/MapInput/MapInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const MapInput = ({
useEffect(() => {
if (!map) return
map.attributionControl.getContainer()?.setAttribute('aria-hidden', 'true')
map.attributionControl.setPrefix('')
map.attributionControl.setPrefix(false)
}, [map])

const clickFunc = useCallback(
Expand Down
2 changes: 2 additions & 0 deletions src/components/OverviewMap/OverviewMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ const OverviewMap: FC<OverviewMapProps> = ({
const [incident, setIncident] = useState<IncidentSummary>()
const [pollingCount, setPollingCount] = useState(0)

map?.attributionControl.setPrefix(false)

const params = useMemo(
() => ({
...filterParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export const IncidentMap = () => {

const { deviceMode, isMobile } = useDeviceMode()

map?.attributionControl.setPrefix(false)

const closeDrawerOverlay = useCallback(() => {
setDrawerState(DrawerState.Closed)
}, [])
Expand Down Expand Up @@ -191,7 +193,6 @@ export const IncidentMap = () => {
dragging: true,
scrollWheelZoom: true,
zoom: configuration.map.optionsIncidentMap.zoom,
attributionControl: false,
}}
>
{isMobile(deviceMode) && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ const Selector: FC = () => {
const hasFeatureTypes = meta.featureTypes.length > 0
const showMarker =
coordinates && (!selection || selectionIsUndetermined(selection[0]))
map?.attributionControl.setPrefix(false)

const mapClick = useCallback(
({ latlng }: LeafletMouseEvent) => {
Expand Down

0 comments on commit 3c1bc42

Please sign in to comment.