Skip to content

Commit

Permalink
Fix conditional display of theme according by the config
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrucs committed Jan 25, 2024
1 parent 9eace71 commit 37e3a52
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 24 deletions.
14 changes: 7 additions & 7 deletions frontend/config/resultCard.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"trek": {
"location": {
"display": true
},
"labels": {
"display": true
},
"location": {
"display": true
},
"themes": {
"display": true
},
"informations": ["difficulty", "duration", "distance", "positiveElevation"]
}
}
}
14 changes: 7 additions & 7 deletions frontend/customization/config/resultCard.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"trek": {
"location": {
"display": true
},
"labels": {
"display": true
},
"location": {
"display": true
},
"themes": {
"display": true
},
"informations": ["difficulty", "duration", "distance", "positiveElevation"]
}
}
}
19 changes: 11 additions & 8 deletions frontend/jestAfterEnv.setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,17 @@ setConfig({
},
resultCard: {
trek: {
location: {
display: true
},
labels: {
display: true
},
informations: ["difficulty", "duration", "distance", "positiveElevation"]
}
location: {
display: true,
},
themes: {
display: true,
},
labels: {
display: true,
},
informations: ['difficulty', 'duration', 'distance', 'positiveElevation'],
},
},
detailsSectionHtml: {
forecastWidget: { default: '<iframe\n id="widget_autocomplete_preview"\n className="w-full"\n height="150"\n src="https://meteofrance.com/widget/prevision/{{ cityCode }}0"\n></iframe>\n' }
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/modules/results/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import { formatDistance } from './utils';
const {
publicRuntimeConfig: {
resultCard: {
trek: { location, labels, informations = [] },
trek: {
location,
themes: { display: displayThemes },
informations = [],
},
},
},
} = getNextConfig();
Expand Down Expand Up @@ -58,7 +62,7 @@ export const adaptTrekResultList = ({
place: (location.display === true && cityDictionnary[rawResult.departure_city]?.name) || null,
name: rawResult.name,
tags:
labels.display === true ? rawResult.themes.map(themeId => themes[themeId]?.label || '') : [],
displayThemes === true ? rawResult.themes.map(themeId => themes[themeId]?.label || '') : [],
attachments: getThumbnails(rawResult.attachments),
category: activities[rawResult.practice] ?? null,
informations: [
Expand Down

0 comments on commit 37e3a52

Please sign in to comment.