From a42246213b880f7dbda8c85f2eec7cc816214f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Viricel?= Date: Mon, 4 Mar 2024 11:35:00 +0100 Subject: [PATCH] chore: add data typings --- components/PoisCard/PoiCardContent.vue | 9 +++++++-- components/PoisDetails/PoiDetails.vue | 9 +++++++-- components/PoisList/PoisTable.vue | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/components/PoisCard/PoiCardContent.vue b/components/PoisCard/PoiCardContent.vue index 4ea772e9f..4bc1482be 100644 --- a/components/PoisCard/PoiCardContent.vue +++ b/components/PoisCard/PoiCardContent.vue @@ -6,12 +6,13 @@ import { defineNuxtComponent } from '#app' import Fields from '~/components/PoisCard/Fields.vue' import FavoriteIcon from '~/components/UI/FavoriteIcon.vue' import TeritorioIcon from '~/components/UI/TeritorioIcon.vue' -import type { ApiPoi, ApiPoiId } from '~/lib/apiPois' +import type { ApiPoi, ApiPoiId, ApiPoiProperties } from '~/lib/apiPois' import { coordinatesHref } from '~/lib/coordinates' import { favoritesStore } from '~/stores/favorite' import { mapStore } from '~/stores/map' import { isIOS } from '~/utils/isIOS' import ContribFieldGroup from '~/components/Fields/ContribFieldGroup.vue' +import type { ContribFields } from '~/composables/useContrib' export default defineNuxtComponent({ components: { @@ -37,7 +38,11 @@ export default defineNuxtComponent({ }, }, - data() { + data(): { + contribMode: boolean + isContribEligible: (properties: ApiPoiProperties) => boolean + getContributorFields: (feature: ApiPoi) => ContribFields + } { const { contribMode, isContribEligible, getContributorFields } = useContrib() return { diff --git a/components/PoisDetails/PoiDetails.vue b/components/PoisDetails/PoiDetails.vue index e36a349d4..b04239269 100644 --- a/components/PoisDetails/PoiDetails.vue +++ b/components/PoisDetails/PoiDetails.vue @@ -16,13 +16,14 @@ import RelativeDate from '~/components/UI/RelativeDate.vue' import TeritorioIcon from '~/components/UI/TeritorioIcon.vue' import type { ContentEntry } from '~/lib/apiContent' import type { ApiPoiDeps } from '~/lib/apiPoiDeps' -import type { ApiPoi, ApiPoiId, FieldsList } from '~/lib/apiPois' +import type { ApiPoi, ApiPoiId, ApiPoiProperties, FieldsList } from '~/lib/apiPois' import type { Settings } from '~/lib/apiSettings' import { PropertyTranslationsContextEnum } from '~/plugins/property-translations' import { favoritesStore } from '~/stores/favorite' import { OriginEnum } from '~/utils/types' import FieldsHeader from '~/components/UI/FieldsHeader.vue' import ContribFieldGroup from '~/components/Fields/ContribFieldGroup.vue' +import type { ContribFields } from '~/composables/useContrib' export default defineNuxtComponent({ components: { @@ -60,7 +61,11 @@ export default defineNuxtComponent({ }, }, - data() { + data(): { + contribMode: boolean + isContribEligible: (properties: ApiPoiProperties) => boolean + getContributorFields: (feature: ApiPoi) => ContribFields + } { const { contribMode, isContribEligible, getContributorFields } = useContrib() return { diff --git a/components/PoisList/PoisTable.vue b/components/PoisList/PoisTable.vue index d18c1bff1..eb2715f83 100644 --- a/components/PoisList/PoisTable.vue +++ b/components/PoisList/PoisTable.vue @@ -2,9 +2,10 @@ import type { PropType } from 'vue' import { defineNuxtComponent } from '#app' import Field from '~/components/Fields/Field.vue' -import type { ApiPois, FieldsListItem } from '~/lib/apiPois' +import type { ApiPoi, ApiPoiProperties, ApiPois, FieldsListItem } from '~/lib/apiPois' import { PropertyTranslationsContextEnum } from '~/plugins/property-translations' import ContribFieldGroup from '~/components/Fields/ContribFieldGroup.vue' +import type { ContribFields } from '~/composables/useContrib' export default defineNuxtComponent({ components: { @@ -21,7 +22,11 @@ export default defineNuxtComponent({ required: true, }, }, - data() { + data(): { + contribMode: boolean + isContribEligible: (properties: ApiPoiProperties) => boolean + getContributorFields: (feature: ApiPoi) => ContribFields + } { const { contribMode, isContribEligible, getContributorFields } = useContrib() return { contribMode,