diff --git a/docs/changelog.md b/docs/changelog.md index c6c36644a..0469fd3a4 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,15 @@ # Changelog +3.5.4 (2022-01-20) +------------------ + +**🐛 Fixes** + +* Do not display empty filters (#518 by @dtrucs) +* Correctly display tags inside list descriptions items (#540 by @dtrucs) +* Sort activities by order defined in API (#539 by @dtrucs) +* Fix sitemap generation when Outdoor module is disabled (by @dtrucs) + 3.5.3 (2021-12-17) ------------------ diff --git a/frontend/package.json b/frontend/package.json index e31997d46..61283b19a 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "geotrek-rando-frontend", - "version": "3.5.3", + "version": "3.5.4", "private": true, "scripts": { "debug": "NODE_OPTIONS='--inspect' next ./src", diff --git a/frontend/src/components/pages/details/components/DetailsDescription/DetailsDescription.tsx b/frontend/src/components/pages/details/components/DetailsDescription/DetailsDescription.tsx index b8538e790..0dd690dd9 100644 --- a/frontend/src/components/pages/details/components/DetailsDescription/DetailsDescription.tsx +++ b/frontend/src/components/pages/details/components/DetailsDescription/DetailsDescription.tsx @@ -92,23 +92,26 @@ const StyledListWithSteps = styled(HtmlText)` } & > ol > li { counter-increment: item; - display: flex; - align-items: center; - padding-top: ${getSpacing(4)}; + margin-top: ${getSpacing(4)}; ${desktopOnly(css` - padding-top: ${getSpacing(10)}; + margin-top: ${getSpacing(10)}; `)} + position: relative; + padding-left: ${getSpacing(12)}; } & > ol > li:first-child { - padding: 0; + margin-top: 0; } & > ol > li::before { + position: absolute; + left: 0; + top: 50%; + transform: translateY(-50%); font-size: 14px; content: counter(item); border-radius: 100%; width: ${getSpacing(6.5)}; height: ${getSpacing(6.5)}; - flex: none; margin-right: ${getSpacing(3.5)}; color: white; background-color: ${colorPalette.redMarker}; diff --git a/frontend/src/components/pages/details/components/DetailsDescription/__tests__/__snapshots__/DetailsDescription.test.tsx.snap b/frontend/src/components/pages/details/components/DetailsDescription/__tests__/__snapshots__/DetailsDescription.test.tsx.snap index 9e1d5de87..4e9b4b217 100644 --- a/frontend/src/components/pages/details/components/DetailsDescription/__tests__/__snapshots__/DetailsDescription.test.tsx.snap +++ b/frontend/src/components/pages/details/components/DetailsDescription/__tests__/__snapshots__/DetailsDescription.test.tsx.snap @@ -23,7 +23,7 @@ Object { id="details_descriptionContent" >

Du parking remonter la vallée du Sélé par le sentier qui suit la rive gauche du torrent de Celse NiÚre. AprÚs une longue montée en faux plat, le sentier remonte des lacets raides jusqu'à la jonction avec le sentier du refuge du Sélé (1993 m). @@ -72,7 +72,7 @@ Object { id="details_descriptionContent" >

Du parking remonter la vallée du Sélé par le sentier qui suit la rive gauche du torrent de Celse NiÚre. AprÚs une longue montée en faux plat, le sentier remonte des lacets raides jusqu'à la jonction avec le sentier du refuge du Sélé (1993 m). diff --git a/frontend/src/components/pages/search/components/FilterBar/ShowFilters.tsx b/frontend/src/components/pages/search/components/FilterBar/ShowFilters.tsx index 5af6c2008..ac1196a7e 100644 --- a/frontend/src/components/pages/search/components/FilterBar/ShowFilters.tsx +++ b/frontend/src/components/pages/search/components/FilterBar/ShowFilters.tsx @@ -10,6 +10,10 @@ interface Props { } const ShowFilters: React.FC = ({ item, setFilterSelectedOptions, hideLabel = false }) => { + // The API can send empty item + if (item.label === '' && item.options.length === 0) { + return null; + } return item.options.length > 10 ? ( []): Acti export const adaptActivitiesFilter = ( rawActivities: Partial[], ): ActivityFilter[] => - rawActivities.filter(isCompleteRawListActivity).map(({ name, pictogram, id }) => ({ + rawActivities.filter(isCompleteRawListActivity).map(({ name, pictogram, id, order = null }) => ({ name, pictogram, id: `${id}`, + order, type: 'PRACTICE', })); diff --git a/frontend/src/modules/activities/connector.ts b/frontend/src/modules/activities/connector.ts index 2afded21e..7ddb474e0 100644 --- a/frontend/src/modules/activities/connector.ts +++ b/frontend/src/modules/activities/connector.ts @@ -36,6 +36,9 @@ export const getActivity = async ( return adaptActivity(rawActivity); }; +const sortedActivitiesByOrder = (a: ActivityFilter, b: ActivityFilter) => + (a.order ?? Infinity) - (b.order ?? Infinity); + export const getActivityBarContent = async (language: string): Promise => { const [rawPractices, rawTouristicContentCategories, rawOutdoorPractices, rawTouristicEvents] = await Promise.all([ @@ -46,9 +49,15 @@ export const getActivityBarContent = async (language: string): Promise - rawOutdoorPractices.map(({ name, id, pictogram }) => ({ + rawOutdoorPractices.map(({ name, id, pictogram, order = null }) => ({ id, name, + order, pictogram, type: 'OUTDOOR_PRACTICE', })); diff --git a/frontend/src/modules/outdoorPractice/interface.ts b/frontend/src/modules/outdoorPractice/interface.ts index d0963c09e..5ec6f7d4e 100644 --- a/frontend/src/modules/outdoorPractice/interface.ts +++ b/frontend/src/modules/outdoorPractice/interface.ts @@ -1,5 +1,6 @@ export interface RawOutdoorPractice { id: string; + order: null | number; sector: number; name: string; pictogram: string; diff --git a/frontend/src/modules/touristicContentCategory/adapter.ts b/frontend/src/modules/touristicContentCategory/adapter.ts index 00937846d..cf317ac4d 100644 --- a/frontend/src/modules/touristicContentCategory/adapter.ts +++ b/frontend/src/modules/touristicContentCategory/adapter.ts @@ -28,10 +28,11 @@ export const adaptTouristicContentCategoryList = ( ): ActivityFilter[] => rawToutisticContentCategories .filter(isCompleteRawListTouristicContentCategory) - .map(({ label, pictogram, id }) => ({ + .map(({ label, pictogram, id, order = null }) => ({ name: label, pictogram, id: `${id}`, + order, type: 'CATEGORY', })); diff --git a/frontend/src/modules/touristicContentCategory/interface.ts b/frontend/src/modules/touristicContentCategory/interface.ts index a79f2f9ad..3e666c5c9 100644 --- a/frontend/src/modules/touristicContentCategory/interface.ts +++ b/frontend/src/modules/touristicContentCategory/interface.ts @@ -4,6 +4,7 @@ export interface RawTouristicContentCategory { id: number; pictogram: string; label: string; + order: null | number; types: TouristicContentType[]; } diff --git a/frontend/src/modules/touristicEventType/adapter.ts b/frontend/src/modules/touristicEventType/adapter.ts index 6cbabfb3f..499dc5179 100644 --- a/frontend/src/modules/touristicEventType/adapter.ts +++ b/frontend/src/modules/touristicEventType/adapter.ts @@ -23,9 +23,10 @@ export const adaptTouristicEventTypes = ({ export const adaptTouristicEventTypesForActivities = ( rawTouristicEventTypes: RawTouristicEventType[], ): ActivityFilter[] => - rawTouristicEventTypes.map(({ type, id, pictogram }) => ({ + rawTouristicEventTypes.map(({ type, id, pictogram, order = null }) => ({ id, name: type, + order, pictogram, type: 'TOURISTIC_EVENT_TYPE', })); diff --git a/frontend/src/modules/touristicEventType/interface.ts b/frontend/src/modules/touristicEventType/interface.ts index fe91c9176..1ff9d50cf 100644 --- a/frontend/src/modules/touristicEventType/interface.ts +++ b/frontend/src/modules/touristicEventType/interface.ts @@ -1,5 +1,6 @@ export interface RawTouristicEventType { id: string; + order: null | number; type: string; pictogram: string; } diff --git a/frontend/src/pages/sitemap.xml.tsx b/frontend/src/pages/sitemap.xml.tsx index ab2176cb4..88c106d3d 100644 --- a/frontend/src/pages/sitemap.xml.tsx +++ b/frontend/src/pages/sitemap.xml.tsx @@ -86,7 +86,9 @@ const getApiContentForLanguage = async (language: string): Promise => { ) .join(''); - const outdoorSites = await getOutdoorSiteForLanguage(language); + const outdoorSites = getGlobalConfig().enableOutdoor + ? await getOutdoorSiteForLanguage(language) + : []; const outdoorSitesUrls = outdoorSites .map(({ id, name }) => name && id @@ -97,7 +99,9 @@ const getApiContentForLanguage = async (language: string): Promise => { ) .join(''); - const outdoorCourses = await getOutdoorCourseForLanguage(language); + const outdoorCourses = getGlobalConfig().enableOutdoor + ? await getOutdoorCourseForLanguage(language) + : []; const outdoorCoursesUrls = outdoorCourses .map(({ id, name }) => name && id