diff --git a/canopeum_frontend/src/components/social/SiteSocialHeader.tsx b/canopeum_frontend/src/components/social/SiteSocialHeader.tsx index 438d697a..92ec5bcd 100644 --- a/canopeum_frontend/src/components/social/SiteSocialHeader.tsx +++ b/canopeum_frontend/src/components/social/SiteSocialHeader.tsx @@ -129,6 +129,22 @@ const SiteSocialHeader = ({ site, viewMode }: Props) => {

{translateValue(site.siteType)}

+ + + + location_on + + {site.coordinate.address ?? translate('analytics.site-summary.unknown')} +

{site.description ?? ''}

diff --git a/canopeum_frontend/src/pages/MapPage.tsx b/canopeum_frontend/src/pages/MapPage.tsx index e80de166..289abfc4 100644 --- a/canopeum_frontend/src/pages/MapPage.tsx +++ b/canopeum_frontend/src/pages/MapPage.tsx @@ -5,7 +5,7 @@ import { type CSSProperties, useCallback, useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import type { MarkerEvent } from 'react-map-gl/dist/esm/types' import ReactMap, { GeolocateControl, Marker, NavigationControl, ScaleControl, type ViewState } from 'react-map-gl/maplibre' -import { Link } from 'react-router-dom' +import { Link, useSearchParams } from 'react-router-dom' import SiteTypePin from '@components/assets/SiteTypePin' import { appRoutes } from '@constants/routes.constant' @@ -55,7 +55,10 @@ const MapPage = () => { const { getApiClient } = useApiClient() const { t } = useTranslation() const [sites, setSites] = useState([]) - const [selectedSiteId, setSelectedSiteId] = useState() + const [searchParams, setSearchParams] = useSearchParams() + const [selectedSiteId, setSelectedSiteId] = useState( + Number(searchParams.get('site')) || null, + ) const [mapViewState, setMapViewState] = useState({ longitude: 0, @@ -83,6 +86,8 @@ const MapPage = () => { zoom: PIN_FOCUS_ZOOM_LEVEL, }) setSelectedSiteId(site.id) + searchParams.set('site', site.id.toString()) + setSearchParams(searchParams) if (mapMarkerEvent) { // Clicked from map, scroll card into view document.getElementById(`site-card-${site.id}`)?.scrollIntoView({ behavior: 'smooth' }) @@ -94,7 +99,7 @@ const MapPage = () => { const onMapMove = (viewState: ViewState) => { setMapViewState(viewState) - setSelectedSiteId(undefined) + setSelectedSiteId(null) } useEffect(() => @@ -207,6 +212,7 @@ const MapPage = () => { event.stopPropagation()} // special styles needed for link-in-button hover style={{ position: 'relative', zIndex: 2 }} to={appRoutes.siteSocial(site.id)}