From 205220a901dba9caba70c52d69f354c9dc43b81a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= <38253764+wazolab@users.noreply.github.com> Date: Mon, 26 Feb 2024 17:20:07 +0100 Subject: [PATCH] Contrib Mode (#163) --- README.md | 3 ++ components/Fields/ContribFieldGroup.vue | 42 ++++++++++++++++++ components/PoisCard/PoiCardContent.vue | 8 +++- components/PoisDetails/PoiDetails.vue | 22 +++++----- components/PoisList/PoisList.vue | 4 +- components/PoisList/PoisTable.vue | 11 ++++- lib/apiPois.ts | 2 +- locales/en-GB.ts | 6 +++ locales/es-ES.ts | 6 +++ locales/fr-FR.ts | 6 +++ middleware/contrib-mode.global.ts | 58 +++++++++++++++++++++++++ mixins/contribution.ts | 25 +++++++++++ plugins/fontawesome.ts | 4 ++ stores/contrib.ts | 19 ++++++++ stores/map.ts | 6 +-- 15 files changed, 200 insertions(+), 22 deletions(-) create mode 100644 components/Fields/ContribFieldGroup.vue create mode 100644 middleware/contrib-mode.global.ts create mode 100644 mixins/contribution.ts create mode 100644 stores/contrib.ts diff --git a/README.md b/README.md index e7c181d00..7ce6dca42 100644 --- a/README.md +++ b/README.md @@ -172,3 +172,6 @@ Special formatting support: | Action on details page | details_event | favorite | details_event | action, title, poiId | trackEvent | event, action, title, poiId | Note on Matomo. `Origin` is a set as dimension `1` and should be configured as is on Matomo. + +## Contributor Mode +Enable/Disable: Add the following query parameter in the URL: `?contrib=true|false` diff --git a/components/Fields/ContribFieldGroup.vue b/components/Fields/ContribFieldGroup.vue new file mode 100644 index 000000000..b2ad0874b --- /dev/null +++ b/components/Fields/ContribFieldGroup.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/components/PoisCard/PoiCardContent.vue b/components/PoisCard/PoiCardContent.vue index 8097bfd8f..9c57a94ac 100644 --- a/components/PoisCard/PoiCardContent.vue +++ b/components/PoisCard/PoiCardContent.vue @@ -2,7 +2,6 @@ import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' import { mapState } from 'pinia' import type { PropType } from 'vue' - import { defineNuxtComponent } from '#app' import Fields from '~/components/PoisCard/Fields.vue' import FavoriteIcon from '~/components/UI/FavoriteIcon.vue' @@ -12,6 +11,7 @@ import { coordinatesHref } from '~/lib/coordinates' import { favoritesStore } from '~/stores/favorite' import { mapStore } from '~/stores/map' import { isIOS } from '~/utils/isIOS' +import ContributionMixin from '~/mixins/contribution' export default defineNuxtComponent({ components: { @@ -20,7 +20,7 @@ export default defineNuxtComponent({ FavoriteIcon, Fields, }, - + mixins: [ContributionMixin], props: { poi: { type: Object as PropType, @@ -217,6 +217,10 @@ export default defineNuxtComponent({ {{ description }}

+ + + +
+ + + {{ $t('fields.contrib.heading') }} + + + {{ $t('poiDetails.lastUpdate') }} - - - - + diff --git a/components/PoisList/PoisList.vue b/components/PoisList/PoisList.vue index d063e3f2d..d9257a3a3 100644 --- a/components/PoisList/PoisList.vue +++ b/components/PoisList/PoisList.vue @@ -87,9 +87,7 @@ export default defineNuxtComponent({ geometry_as: 'point', short_description: true, }, - ).then((pois) => { - this.pois = pois - }) + ).then(pois => this.pois = pois) }, }, diff --git a/components/PoisList/PoisTable.vue b/components/PoisList/PoisTable.vue index a3627918e..73f2df965 100644 --- a/components/PoisList/PoisTable.vue +++ b/components/PoisList/PoisTable.vue @@ -1,16 +1,16 @@