diff --git a/frontend/src/components/Map/DetailsMap/DetailsMap.tsx b/frontend/src/components/Map/DetailsMap/DetailsMap.tsx index 7a53ebc3d..92ef392ee 100644 --- a/frontend/src/components/Map/DetailsMap/DetailsMap.tsx +++ b/frontend/src/components/Map/DetailsMap/DetailsMap.tsx @@ -48,6 +48,7 @@ export type PropsType = { bbox: { corner1: Coordinate2D; corner2: Coordinate2D }; trekChildrenGeometry?: TrekChildGeometry[]; sensitiveAreas?: SensitiveAreaGeometry[]; + trekId: number }; export const DetailsMap: React.FC = props => { @@ -93,6 +94,7 @@ export const DetailsMap: React.FC = props => { trekGeometry={props.trekGeometry} /> = props => { @@ -37,7 +38,7 @@ export const MapChildren: React.FC = props => { return ( <> {(visibleSection === 'children' || props.trekChildrenMobileVisibility === 'DISPLAYED') && ( - + )} {(visibleSection === 'description' || diff --git a/frontend/src/components/Map/DetailsMap/TrekChildren.tsx b/frontend/src/components/Map/DetailsMap/TrekChildren.tsx index aa564e8b2..541375033 100644 --- a/frontend/src/components/Map/DetailsMap/TrekChildren.tsx +++ b/frontend/src/components/Map/DetailsMap/TrekChildren.tsx @@ -6,6 +6,7 @@ import { HoverableMarker } from '../components/HoverableMarker'; export type TrekChildrenPropsType = { trekChildrenGeometry?: TrekChildGeometry[]; + parentId?: number; }; export const TrekChildren: React.FC = props => { @@ -24,7 +25,7 @@ export const TrekChildren: React.FC = props => { rank={index + 1} type="TREK_CHILD" > - + ); })} diff --git a/frontend/src/components/Map/components/Popup/index.tsx b/frontend/src/components/Map/components/Popup/index.tsx index 67967308a..7631e3d24 100644 --- a/frontend/src/components/Map/components/Popup/index.tsx +++ b/frontend/src/components/Map/components/Popup/index.tsx @@ -15,6 +15,7 @@ import { usePopupResult } from '../../hooks/usePopupResult'; interface Props { id: number; + parentId?: number; handleOpen?: () => void; handleClose?: () => void; type: 'TREK' | 'TOURISTIC_CONTENT'; @@ -24,8 +25,9 @@ interface PropsPC { showButton: boolean; id: number; type: 'TREK' | 'TOURISTIC_CONTENT'; + parentId?: number; } -const PopupContent: React.FC = ({ showButton, id, type }) => { +const PopupContent: React.FC = ({ showButton, id, type, parentId }) => { const { isLoading, trekPopupResult } = usePopupResult(id.toString(), true, type); return ( @@ -49,7 +51,7 @@ const PopupContent: React.FC = ({ showButton, id, type }) => { @@ -67,7 +69,7 @@ const PopupContent: React.FC = ({ showButton, id, type }) => { ); }; -export const Popup: React.FC = ({ id, handleOpen, handleClose, type }) => { +export const Popup: React.FC = ({ id, parentId, handleOpen, handleClose, type }) => { const [hideTooltip, setHideTooltip] = useState(false); return ( @@ -89,7 +91,7 @@ export const Popup: React.FC = ({ id, handleOpen, handleClose, type }) => }} offset={[0, -12]} > - + ); diff --git a/frontend/src/components/pages/details/Details.tsx b/frontend/src/components/pages/details/Details.tsx index fc6ede5d2..da343a41b 100644 --- a/frontend/src/components/pages/details/Details.tsx +++ b/frontend/src/components/pages/details/Details.tsx @@ -449,6 +449,7 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, geometry, color, }))} + trekId={Number(id)} /> )} @@ -499,6 +500,7 @@ export const DetailsUIWithoutContext: React.FC = ({ detailsId, parentId, id: `${touristicContent.id}`, }))} hideMap={hideMobileMap} + trekId={Number(id)} /> )} diff --git a/frontend/src/components/pages/search/utils.ts b/frontend/src/components/pages/search/utils.ts index 49405078a..875e5f75e 100644 --- a/frontend/src/components/pages/search/utils.ts +++ b/frontend/src/components/pages/search/utils.ts @@ -61,9 +61,15 @@ export const formatInfiniteQuery = ( }; /** Generates the details page url related to a result */ -export const generateResultDetailsUrl = (id: number | string, title: string): string => { +export const generateResultDetailsUrl = ( + id: number | string, + title: string, + parentId?: number, +): string => { const titleWithNoSpace = convertStringForSitemap(title); - const detailsPageUrl = `${routes.DETAILS}/${id}-${encodeURI(titleWithNoSpace)}`; + const detailsPageUrl = `${routes.DETAILS}/${id}-${encodeURI(titleWithNoSpace)}${ + parentId ? `?parentId=${parentId}` : '' + }`; return detailsPageUrl; };