diff --git a/src/components/Contribution.jsx b/src/components/Contribution.jsx index 034ce6d4..545ca3a6 100644 --- a/src/components/Contribution.jsx +++ b/src/components/Contribution.jsx @@ -1,17 +1,29 @@ import React from 'react'; import Telemetry from 'src/libs/telemetry'; import { Flex } from '@qwant/qwant-ponents'; -import { isFromOSM, isFromPagesJaunes, isFromTripAdvisor } from 'src/libs/pois'; +import { + isFromCircuitsCourts, + isFromEcotables, + isFromOSM, + isFromPagesJaunes, + isFromTripAdvisor, + isFromVrac, +} from 'src/libs/pois'; import classnames from 'classnames'; import { useI18n } from 'src/hooks'; const eventName = (poi, suffix) => { + if (isFromEcotables(poi)) return `ecotables_${suffix}`; + if (isFromCircuitsCourts(poi)) return `circuitscourts_${suffix}`; + if (isFromVrac(poi)) return `vrac_${suffix}`; if (isFromOSM(poi)) return `osm_${suffix}`; if (isFromTripAdvisor(poi)) return `ta_${suffix}`; if (isFromPagesJaunes(poi)) return `pj_${suffix}`; }; const sentenceFor = (poi, _) => { + if (isFromVrac(poi)) return `${_('In partnership with')} RĂ©seau vrac`; + if (isFromCircuitsCourts(poi)) return `${_('In partnership with')} ObSat`; if (isFromOSM(poi)) return _('Qwant Maps uses OpenStreetMap data.'); if (isFromTripAdvisor(poi)) return `${_('In partnership with')} TripAdvisor.`; if (isFromPagesJaunes(poi)) return `${_('In partnership with')} PagesJaunes.`; @@ -33,7 +45,8 @@ const Contribution = ({ poi }) => { 'contribute', isFromOSM(poi) && 'contribute--osm', isFromPagesJaunes(poi) && 'contribute--pj', - isFromTripAdvisor(poi) && 'contribute--ta' + isFromTripAdvisor(poi) && 'contribute--ta', + (isFromEcotables(poi) || isFromCircuitsCourts(poi) || isFromVrac(poi)) && 'contribute--eco' )} >
diff --git a/src/libs/pois.js b/src/libs/pois.js index e3a4b35c..616baa0d 100644 --- a/src/libs/pois.js +++ b/src/libs/pois.js @@ -51,6 +51,14 @@ export const isPoiCompliantKey = key => key.indexOf(prefix) === 0; export const isFromPagesJaunes = poi => poi.meta && poi.meta.source === sources.pagesjaunes; export const isFromOSM = poi => poi.meta && poi.meta.source === sources.osm; +export const isFromEcotables = poi => + poi.blocks && + !!poi.blocks?.find(b => b.type === 'ecoresponsible' && b.source === sources.ecotables); +export const isFromVrac = poi => + poi.blocks && !!poi.blocks?.find(b => b.type === 'ecoresponsible' && b.source === sources.vrac); +export const isFromCircuitsCourts = poi => + poi.blocks && + !!poi.blocks?.find(b => b.type === 'ecoresponsible' && b.source === sources.circuitscourts); export const isFromTripAdvisor = poi => poi.meta && poi.meta.source === sources.tripadvisor; // POI map util functions diff --git a/src/scss/includes/contribute.scss b/src/scss/includes/contribute.scss index dace9ca4..1103f463 100644 --- a/src/scss/includes/contribute.scss +++ b/src/scss/includes/contribute.scss @@ -24,4 +24,9 @@ .contribute--ta & { background-image: url('../../images/tripadvisor.svg'); } + + .contribute--eco & { + background: var(--grey-100); + border-radius: 12px; + } }