From a71947724ddbdb4ed94adff8cf89181afc7a01bc Mon Sep 17 00:00:00 2001 From: Florian Sommariva Date: Wed, 29 Dec 2021 11:43:15 +0100 Subject: [PATCH 1/7] Do not display empty filters --- .../pages/search/components/FilterBar/ShowFilters.tsx | 4 ++++ 1 file changed, 4 insertions(+) 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 ? ( Date: Wed, 12 Jan 2022 11:27:09 +0100 Subject: [PATCH 2/7] Display correctly tags inside list descriptions items --- .../DetailsDescription/DetailsDescription.tsx | 15 +++++++++------ .../DetailsDescription.test.tsx.snap | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) 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). From 7798ceeba0b550ce79e8256fcbbc976c56704cd7 Mon Sep 17 00:00:00 2001 From: Florian Sommariva Date: Wed, 19 Jan 2022 17:10:26 +0100 Subject: [PATCH 3/7] Exposing the order's property to all kinds of activities --- frontend/src/modules/activities/adapter.ts | 3 ++- frontend/src/modules/activities/interface.ts | 1 + frontend/src/modules/outdoorPractice/adapter.ts | 5 +++-- frontend/src/modules/outdoorPractice/interface.ts | 1 + frontend/src/modules/touristicContentCategory/adapter.ts | 3 ++- frontend/src/modules/touristicContentCategory/interface.ts | 1 + frontend/src/modules/touristicEventType/adapter.ts | 3 ++- frontend/src/modules/touristicEventType/interface.ts | 1 + 8 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/src/modules/activities/adapter.ts b/frontend/src/modules/activities/adapter.ts index 9b4132e20..5d3b3e60f 100644 --- a/frontend/src/modules/activities/adapter.ts +++ b/frontend/src/modules/activities/adapter.ts @@ -40,9 +40,10 @@ export const adaptActivities = (rawActivities: Partial[]): 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/interface.ts b/frontend/src/modules/activities/interface.ts index 7e4c80d20..3d46ea627 100644 --- a/frontend/src/modules/activities/interface.ts +++ b/frontend/src/modules/activities/interface.ts @@ -23,5 +23,6 @@ export interface ActivityChoices { export interface ActivityFilter extends Activity { id: string; + order: null | number; type: 'PRACTICE' | 'OUTDOOR_PRACTICE' | 'CATEGORY' | 'TOURISTIC_EVENT_TYPE'; } diff --git a/frontend/src/modules/outdoorPractice/adapter.ts b/frontend/src/modules/outdoorPractice/adapter.ts index 192b829b1..2c3556b1b 100644 --- a/frontend/src/modules/outdoorPractice/adapter.ts +++ b/frontend/src/modules/outdoorPractice/adapter.ts @@ -1,7 +1,7 @@ import { ActivityFilter } from '../activities/interface'; import { OUTDOOR_ID } from '../filters/constant'; import { FilterWithoutType } from '../filters/interface'; -import { OutdoorPractice, OutdoorPracticeChoices, RawOutdoorPractice } from './interface'; +import { OutdoorPracticeChoices, RawOutdoorPractice } from './interface'; export const adaptOutdoorPractices = ({ rawOutdoorPractices, @@ -23,9 +23,10 @@ export const adaptOutdoorPractices = ({ export const adaptOutdoorPracticesForActivities = ( rawOutdoorPractices: RawOutdoorPractice[], ): ActivityFilter[] => - 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; } From 504274c5c5034f5e2efbfaaac0673f7eed040b3c Mon Sep 17 00:00:00 2001 From: Florian Sommariva Date: Wed, 19 Jan 2022 17:13:08 +0100 Subject: [PATCH 4/7] Sort each activities type by order property --- frontend/src/modules/activities/connector.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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 Date: Thu, 20 Jan 2022 11:36:18 +0100 Subject: [PATCH 5/7] Write outdoor informations in sitemap if the outdoor module is enabled --- frontend/src/pages/sitemap.xml.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 From 20daffba5ccb975ad3921c70c3e25442930d0be3 Mon Sep 17 00:00:00 2001 From: Camille Monchicourt Date: Thu, 20 Jan 2022 22:34:21 +0100 Subject: [PATCH 6/7] Changelog 3.5.4 --- docs/changelog.md | 10 ++++++++++ 1 file changed, 10 insertions(+) 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) ------------------ From 8a021b05698ada90913e9011a67fbb8a7f468bd0 Mon Sep 17 00:00:00 2001 From: Camille Monchicourt Date: Thu, 20 Jan 2022 22:34:53 +0100 Subject: [PATCH 7/7] Prepare 3.5.4 --- frontend/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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",