diff --git a/docs/changelog.md b/docs/changelog.md index a6866adca..b4f23e892 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,14 @@ # Changelog +3.8.2 (2022-04-25) +------------------ + +**🐛 Fixes** + +- Fix HTML interpretation of new "Accessibility" fields (#536 / #638) +- Don't display label filter (Others) in trek filters if no label defined as filter (#418) +- Improve outdoor subobjects display on site maps with adding it in layer control (#542) + 3.8.1 (2022-04-25) ------------------ diff --git a/frontend/package.json b/frontend/package.json index ca2d4885b..7bee84dba 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "geotrek-rando-frontend", - "version": "3.8.1", + "version": "3.8.2", "private": true, "scripts": { "debug": "NODE_OPTIONS='--inspect' next ./src", diff --git a/frontend/src/components/Map/DetailsMap/DetailsMap.tsx b/frontend/src/components/Map/DetailsMap/DetailsMap.tsx index 8b1b03658..98bff425e 100644 --- a/frontend/src/components/Map/DetailsMap/DetailsMap.tsx +++ b/frontend/src/components/Map/DetailsMap/DetailsMap.tsx @@ -101,6 +101,10 @@ export const DetailsMap: React.FC = props => { toggleTouristicContentVisibility, informationDeskMobileVisibility, toggleInformationDeskVisibility, + coursesVisibility, + toggleCoursesVisibility, + experiencesVisibility, + toggleExperiencesVisibility, } = useDetailsMap(); const mapConfig = getMapConfig(); @@ -183,11 +187,15 @@ export const DetailsMap: React.FC = props => { ? informationDeskMobileVisibility : null } + coursesVisibility={props.courses ? coursesVisibility : null} + experiencesVisibility={props.experiences ? experiencesVisibility : null} toggleTrekChildrenVisibility={toggleTrekChildrenVisibility} togglePoiVisibility={togglePoiVisibility} toggleReferencePointsVisibility={toggleReferencePointsVisibility} toggleTouristicContentVisibility={toggleTouristicContentVisibility} toggleInformationDeskVisibility={toggleInformationDeskVisibility} + toggleCoursesVisibility={toggleCoursesVisibility} + toggleExperiencesVisibility={toggleExperiencesVisibility} /> {props.trekGeometry && ( = props => { touristicContentMobileVisibility={touristicContentMobileVisibility} informationDeskMobileVisibility={informationDeskMobileVisibility} reportVisibility={reportVisibility} + coursesVisibility={coursesVisibility} + experiencesVisibility={experiencesVisibility} informationDesks={props.informationDesks} /> {props.displayAltimetricProfile === true && props.trekGeoJSON && ( diff --git a/frontend/src/components/Map/DetailsMap/MapChildren.tsx b/frontend/src/components/Map/DetailsMap/MapChildren.tsx index dcfad9d56..bbf9265a9 100644 --- a/frontend/src/components/Map/DetailsMap/MapChildren.tsx +++ b/frontend/src/components/Map/DetailsMap/MapChildren.tsx @@ -36,6 +36,8 @@ type Props = { referencePointsMobileVisibility: Visibility; poiMobileVisibility: Visibility; touristicContentMobileVisibility: Visibility; + coursesVisibility: Visibility; + experiencesVisibility: Visibility; reportVisibility: boolean; parentId?: number; informationDeskMobileVisibility: Visibility; @@ -59,7 +61,7 @@ export const MapChildren: React.FC = props => { )} - {visibleSection === 'experiences' && ( + {(visibleSection === 'experiences' || props.experiencesVisibility === 'DISPLAYED') && ( ({ @@ -71,7 +73,7 @@ export const MapChildren: React.FC = props => { /> )} - {visibleSection === 'courses' && ( + {(visibleSection === 'courses' || props.coursesVisibility === 'DISPLAYED') && ( ({ diff --git a/frontend/src/components/Map/DetailsMap/useDetailsMap.tsx b/frontend/src/components/Map/DetailsMap/useDetailsMap.tsx index 06094ffb4..32b6bbb0f 100644 --- a/frontend/src/components/Map/DetailsMap/useDetailsMap.tsx +++ b/frontend/src/components/Map/DetailsMap/useDetailsMap.tsx @@ -16,6 +16,9 @@ export const useDetailsMap = () => { const [informationDeskMobileVisibility, setInformationDeskVisibility] = useState('HIDDEN'); + const [coursesVisibility, setCoursesVisibility] = useState('HIDDEN'); + const [experiencesVisibility, setExperiencesVisibility] = useState('HIDDEN'); + const toggleTrekChildrenVisibility = () => setTrekChildrenVisibility(toggleVisibility); const togglePoiVisibility = () => setPoiVisibility(toggleVisibility); @@ -26,6 +29,9 @@ export const useDetailsMap = () => { const toggleInformationDeskVisibility = () => setInformationDeskVisibility(toggleVisibility); + const toggleExperiencesVisibility = () => setExperiencesVisibility(toggleVisibility); + const toggleCoursesVisibility = () => setCoursesVisibility(toggleVisibility); + return { trekChildrenMobileVisibility, toggleTrekChildrenVisibility, @@ -37,5 +43,9 @@ export const useDetailsMap = () => { touristicContentMobileVisibility, toggleTouristicContentVisibility, toggleInformationDeskVisibility, + coursesVisibility, + toggleCoursesVisibility, + experiencesVisibility, + toggleExperiencesVisibility, }; }; diff --git a/frontend/src/components/Map/components/ControlSection/ControlPanel/IconOutdoorRoute.tsx b/frontend/src/components/Map/components/ControlSection/ControlPanel/IconOutdoorRoute.tsx new file mode 100644 index 000000000..84b35cded --- /dev/null +++ b/frontend/src/components/Map/components/ControlSection/ControlPanel/IconOutdoorRoute.tsx @@ -0,0 +1,23 @@ +import * as React from 'react'; +import { SVGProps } from 'react'; + +const SvgComponent = (props: SVGProps) => ( + + + +); + +export default SvgComponent; diff --git a/frontend/src/components/Map/components/ControlSection/ControlPanel/IconOutdoorSite.tsx b/frontend/src/components/Map/components/ControlSection/ControlPanel/IconOutdoorSite.tsx new file mode 100644 index 000000000..d87598d7c --- /dev/null +++ b/frontend/src/components/Map/components/ControlSection/ControlPanel/IconOutdoorSite.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { SVGProps } from 'react'; + +const SvgComponent = (props: SVGProps) => ( + + + +); + +export default SvgComponent; diff --git a/frontend/src/components/Map/components/ControlSection/ControlPanel/index.tsx b/frontend/src/components/Map/components/ControlSection/ControlPanel/index.tsx index 78e6e7290..e8f7ff51a 100644 --- a/frontend/src/components/Map/components/ControlSection/ControlPanel/index.tsx +++ b/frontend/src/components/Map/components/ControlSection/ControlPanel/index.tsx @@ -5,6 +5,8 @@ import IconLocation from './IconLocation'; import IconInfo from './IconInfo'; import IconDrapeau from './IconDrapeau'; import IconPatrimoine from './IconPatrimoine'; +import IconOutdoorSite from './IconOutdoorSite'; +import IconOutdoorRoute from './IconOutdoorRoute'; import { ControlSectionProps } from '../ControlSection'; const Wrapper = styled.div` @@ -36,6 +38,10 @@ export const ControlPanel: React.FC = ({ toggleTouristicContentVisibility, informationDeskMobileVisibility, toggleInformationDeskVisibility, + coursesVisibility, + toggleCoursesVisibility, + experiencesVisibility, + toggleExperiencesVisibility, }) => { return ( @@ -79,6 +85,22 @@ export const ControlPanel: React.FC = ({ transKey="search.map.panel.informationDesks" /> )} + {coursesVisibility !== null && ( + + )} + {experiencesVisibility !== null && ( + + )} ); }; diff --git a/frontend/src/components/Map/components/ControlSection/ControlSection.tsx b/frontend/src/components/Map/components/ControlSection/ControlSection.tsx index 514b03c57..dec365ef0 100644 --- a/frontend/src/components/Map/components/ControlSection/ControlSection.tsx +++ b/frontend/src/components/Map/components/ControlSection/ControlSection.tsx @@ -18,6 +18,10 @@ export interface ControlSectionProps { toggleTouristicContentVisibility: () => void; informationDeskMobileVisibility: Visibility; toggleInformationDeskVisibility: () => void; + coursesVisibility: Visibility; + toggleCoursesVisibility: () => void; + experiencesVisibility: Visibility; + toggleExperiencesVisibility: () => void; className?: string; position?: ControlPosition; } diff --git a/frontend/src/components/pages/details/components/DetailsInformationDesk/DetailsInformationDesk.tsx b/frontend/src/components/pages/details/components/DetailsInformationDesk/DetailsInformationDesk.tsx index b9dc0f1a3..f18625668 100644 --- a/frontend/src/components/pages/details/components/DetailsInformationDesk/DetailsInformationDesk.tsx +++ b/frontend/src/components/pages/details/components/DetailsInformationDesk/DetailsInformationDesk.tsx @@ -77,14 +77,6 @@ export const DetailsInformationDesk: React.FC = ({

{phone}

- {accessibility && ( -

- - :{' '} - - {accessibility} -

- )}
{truncateState === 'TRUNCATE' ? ( @@ -101,6 +93,15 @@ export const DetailsInformationDesk: React.FC = ({ />
+ + {accessibility && ( +

+ + :{' '} + + {parse(accessibility)} +

+ )} ); diff --git a/frontend/src/components/pages/details/components/DetailsReservationWidget/DetailsReservationWidget.tsx b/frontend/src/components/pages/details/components/DetailsReservationWidget/DetailsReservationWidget.tsx index 2226f54f1..855b10f4d 100644 --- a/frontend/src/components/pages/details/components/DetailsReservationWidget/DetailsReservationWidget.tsx +++ b/frontend/src/components/pages/details/components/DetailsReservationWidget/DetailsReservationWidget.tsx @@ -40,12 +40,14 @@ export const DetailsReservationWidget: React.FC = }; // eslint-disable-next-line - waitForGlobal('eitinerance').then(() => { - const spaClient = ITW.pages.getSinglePageApplicationClient({ layer }); - AllianceReseaux.jQuery(function () { - spaClient.executePage(); + waitForGlobal('eitinerance') + .then(() => waitForGlobal('AllianceReseaux')) + .then(() => { + const spaClient = ITW.pages.getSinglePageApplicationClient({ layer }); + AllianceReseaux.jQuery(function () { + spaClient.executePage(); + }); }); - }); })(window, (window as any)?.eitinerance?.core); }, []); diff --git a/frontend/src/components/pages/search/components/FilterBar/ShowFilters.tsx b/frontend/src/components/pages/search/components/FilterBar/ShowFilters.tsx index 300f4e1f9..af61fa049 100644 --- a/frontend/src/components/pages/search/components/FilterBar/ShowFilters.tsx +++ b/frontend/src/components/pages/search/components/FilterBar/ShowFilters.tsx @@ -11,7 +11,7 @@ interface Props { const ShowFilters: React.FC = ({ item, setFilterSelectedOptions, hideLabel = false }) => { // The API can send empty item - if (item.label === '' && item.options.length === 0) { + if (item.label === '' || item.options.length === 0) { return null; } return item.options.length > 10 ? ( diff --git a/frontend/src/components/pages/site/OutdoorCourseUI.tsx b/frontend/src/components/pages/site/OutdoorCourseUI.tsx index f8c7c2a20..f7a5d5658 100644 --- a/frontend/src/components/pages/site/OutdoorCourseUI.tsx +++ b/frontend/src/components/pages/site/OutdoorCourseUI.tsx @@ -1,3 +1,4 @@ +import parse from 'html-react-parser'; import { Layout } from 'components/Layout/Layout'; import { Modal } from 'components/Modal'; import { DetailsAdvice } from 'components/pages/details/components/DetailsAdvice'; @@ -7,7 +8,7 @@ import { DetailsHeader } from 'components/pages/details/components/DetailsHeader import { DetailsSection } from 'components/pages/details/components/DetailsSection'; import { DetailsHeaderMobile, marginDetailsChild } from 'components/pages/details/Details'; import { useOnScreenSection } from 'components/pages/details/hooks/useHighlightedSection'; -import { generateTouristicContentUrl } from 'components/pages/details/utils'; +import { generateTouristicContentUrl, HtmlText } from 'components/pages/details/utils'; import { VisibleSectionProvider } from 'components/pages/details/VisibleSectionContext'; import { OutdoorSiteChildrenSection } from 'components/pages/site/components/OutdoorSiteChildrenSection'; import { useOutdoorCourse } from 'components/pages/site/useOutdoorCourse'; @@ -246,20 +247,21 @@ export const OutdoorCourseUIWithoutContext: React.FC = ({ outdoorCourseUr titleId="details.recommandations" className={marginDetailsChild} > - {outdoorCourseContent.accessibility && ( -
- - :{' '} - - {outdoorCourseContent.accessibility} -
- )} {outdoorCourseContent.advice && ( )} + + {outdoorCourseContent.accessibility && ( +
+ + :{' '} + + {parse(outdoorCourseContent.accessibility)} +
+ )} )} diff --git a/frontend/src/components/pages/site/OutdoorSiteUI.tsx b/frontend/src/components/pages/site/OutdoorSiteUI.tsx index e1727137f..be7af5e52 100644 --- a/frontend/src/components/pages/site/OutdoorSiteUI.tsx +++ b/frontend/src/components/pages/site/OutdoorSiteUI.tsx @@ -1,3 +1,4 @@ +import parse from 'html-react-parser'; import MoreLink from 'components/Information/MoreLink'; import { Layout } from 'components/Layout/Layout'; import { Modal } from 'components/Modal'; @@ -11,7 +12,7 @@ import { DetailsSection } from 'components/pages/details/components/DetailsSecti import { DetailsSource } from 'components/pages/details/components/DetailsSource'; import { DetailsHeaderMobile, marginDetailsChild } from 'components/pages/details/Details'; import { useOnScreenSection } from 'components/pages/details/hooks/useHighlightedSection'; -import { generateTouristicContentUrl } from 'components/pages/details/utils'; +import { generateTouristicContentUrl, HtmlText } from 'components/pages/details/utils'; import { VisibleSectionProvider } from 'components/pages/details/VisibleSectionContext'; import { AccessChildrenSection } from 'components/pages/site/components/AccessChildrenSection'; import { OutdoorCoursesChildrenSection } from 'components/pages/site/components/OutdoorCoursesChildrenSection'; @@ -250,15 +251,6 @@ const OutdoorSiteUIWithoutContext: React.FC = ({ outdoorSiteUrl, language titleId="details.recommandations" className={marginDetailsChild} > - {outdoorSiteContent.accessibility && ( -
- - :{' '} - - {outdoorSiteContent.accessibility} -
- )} - {!!outdoorSiteContent.advice && ( = ({ outdoorSiteUrl, language } /> ))} + + {outdoorSiteContent.accessibility && ( +
+ + :{' '} + + {parse(outdoorSiteContent.accessibility)} +
+ )} )} diff --git a/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx b/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx index 0eb435df4..c6b055c62 100644 --- a/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx +++ b/frontend/src/components/pages/touristicContent/TouristicContentUI.tsx @@ -137,6 +137,17 @@ export const TouristicContentUI: React.FC = ({ )} + + {touristicContent.accessibility && ( +
+ + :{' '} + + {parse(touristicContent.accessibility)} +
+ )} +
+ {(!!touristicContent.contact?.length || !!touristicContent.email?.length || !!touristicContent.website?.length) && ( @@ -145,14 +156,6 @@ export const TouristicContentUI: React.FC = ({ titleId="touristicContent.contact" className={marginDetailsChild} > - {touristicContent.accessibility && ( -
- - :{' '} - - {touristicContent.accessibility} -
- )} {parse(touristicContent.contact)} {!!touristicContent.email?.length && (
diff --git a/frontend/src/translations/ca.json b/frontend/src/translations/ca.json index f6c280a6e..d27178fe9 100644 --- a/frontend/src/translations/ca.json +++ b/frontend/src/translations/ca.json @@ -63,7 +63,9 @@ "poi": "Heritage", "referencePoints": "Landmarks", "touristicContent": "Close by", - "informationDesks": "Llocs d’informació" + "informationDesks": "Llocs d’informació", + "courses": "Parcours", + "experiences": "Lieux de pratique" }, "resetView": "Recenter el mapa" } diff --git a/frontend/src/translations/de.json b/frontend/src/translations/de.json index f3917cb9f..6d1ea7157 100644 --- a/frontend/src/translations/de.json +++ b/frontend/src/translations/de.json @@ -63,7 +63,9 @@ "poi": "Heritage", "referencePoints": "Landmarken", "touristicContent": "Close by", - "informationDesks": "Orte der Information" + "informationDesks": "Orte der Information", + "courses": "Parcours", + "experiences": "Lieux de pratique" }, "resetView": "Karte zentrieren" } diff --git a/frontend/src/translations/en.json b/frontend/src/translations/en.json index c92fa7bcd..29b8872b1 100644 --- a/frontend/src/translations/en.json +++ b/frontend/src/translations/en.json @@ -65,7 +65,9 @@ "poi": "Heritage", "referencePoints": "Landmarks", "touristicContent": "Close by", - "informationDesks": "Information desks" + "informationDesks": "Information desks", + "courses": "Parcours", + "experiences": "Lieux de pratique" }, "resetView": "Recenter map" } diff --git a/frontend/src/translations/es.json b/frontend/src/translations/es.json index 2a2e6bc8f..940ecaac1 100644 --- a/frontend/src/translations/es.json +++ b/frontend/src/translations/es.json @@ -63,7 +63,9 @@ "poi": "Patrimonios", "referencePoints": "Puntos de referencia", "touristicContent": "Cercano", - "informationDesks": "Lugares de información" + "informationDesks": "Lugares de información", + "courses": "Parcours", + "experiences": "Lieux de pratique" }, "resetView": "Centrarse la mapa" } diff --git a/frontend/src/translations/fr.json b/frontend/src/translations/fr.json index fa52a0c5b..6bbd0c00b 100644 --- a/frontend/src/translations/fr.json +++ b/frontend/src/translations/fr.json @@ -66,7 +66,9 @@ "poi": "Patrimoines", "referencePoints": "Repères", "touristicContent": "À proximité", - "informationDesks": "Lieux de renseignement" + "informationDesks": "Lieux de renseignement", + "courses": "Parcours", + "experiences": "Lieux de pratique" }, "resetView": "Recentrer la carte" } diff --git a/frontend/src/translations/it.json b/frontend/src/translations/it.json index 57f294a9e..f2d362183 100644 --- a/frontend/src/translations/it.json +++ b/frontend/src/translations/it.json @@ -65,7 +65,9 @@ "poi": "Eredità", "referencePoints": "Riferimenti", "touristicContent": "Vicino", - "informationDesks": "Luoghi di informazione" + "informationDesks": "Luoghi di informazione", + "courses": "Parcours", + "experiences": "Lieux de pratique" }, "resetView": "Rimettere a fuoco la mappa" }