From 6a9803222add77276293bfb2bf35baf76aa26082 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 25 Apr 2024 18:02:39 +0200 Subject: [PATCH 01/36] Remove props of AttributionsContent and move logic to the component --- .../src/components/AttributionContent.vue | 47 +++++++++++-------- .../src/components/Attributions.vue | 19 +------- 2 files changed, 30 insertions(+), 36 deletions(-) diff --git a/packages/plugins/Attributions/src/components/AttributionContent.vue b/packages/plugins/Attributions/src/components/AttributionContent.vue index e6c7b9f18..19a297fb6 100644 --- a/packages/plugins/Attributions/src/components/AttributionContent.vue +++ b/packages/plugins/Attributions/src/components/AttributionContent.vue @@ -1,12 +1,6 @@ @@ -62,10 +61,7 @@ export default Vue.extend({ }, data: () => ({ closeLabel: 'common:plugins.gfi.header.close' }), computed: { - ...mapGetters(['clientWidth', 'hasSmallWidth', 'hasWindowSize']), - photoHeight(): number { - return this.clientWidth * 0.15 - }, + ...mapGetters(['hasSmallWidth', 'hasWindowSize']), }, methods: { ...mapActions('plugin/gfi', ['close']), diff --git a/packages/plugins/Gfi/src/components/FeatureTableBody.vue b/packages/plugins/Gfi/src/components/FeatureTableBody.vue index 0a5503ced..958e47172 100644 --- a/packages/plugins/Gfi/src/components/FeatureTableBody.vue +++ b/packages/plugins/Gfi/src/components/FeatureTableBody.vue @@ -9,7 +9,7 @@ :alt="$t('common:plugins.gfi.property.imageAlt')" :title="$t('common:plugins.gfi.property.linkTitle')" :aria-label="$t('common:plugins.gfi.property.linkTitle')" - :height="photoHeight < 200 ? 200 : photoHeight" + :height="photoHeight" width="auto" /> @@ -34,6 +34,7 @@ - + From 65e5ba9e1641fd47c6061cb0ea6635bbec133123 Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Thu, 25 Apr 2024 19:08:59 +0200 Subject: [PATCH 06/36] Remove redundant component and add logic to the main component --- .../src/components/DefaultIndicator.vue | 24 ------------------- .../src/components/LoadingIndicator.vue | 11 ++++++--- 2 files changed, 8 insertions(+), 27 deletions(-) delete mode 100644 packages/plugins/LoadingIndicator/src/components/DefaultIndicator.vue diff --git a/packages/plugins/LoadingIndicator/src/components/DefaultIndicator.vue b/packages/plugins/LoadingIndicator/src/components/DefaultIndicator.vue deleted file mode 100644 index 94fd5a77f..000000000 --- a/packages/plugins/LoadingIndicator/src/components/DefaultIndicator.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - - - diff --git a/packages/plugins/LoadingIndicator/src/components/LoadingIndicator.vue b/packages/plugins/LoadingIndicator/src/components/LoadingIndicator.vue index 03d9efd90..b423afbca 100644 --- a/packages/plugins/LoadingIndicator/src/components/LoadingIndicator.vue +++ b/packages/plugins/LoadingIndicator/src/components/LoadingIndicator.vue @@ -1,15 +1,20 @@ diff --git a/packages/plugins/Gfi/src/components/Gfi.vue b/packages/plugins/Gfi/src/components/Gfi.vue index bcf836938..de7d3975e 100644 --- a/packages/plugins/Gfi/src/components/Gfi.vue +++ b/packages/plugins/Gfi/src/components/Gfi.vue @@ -45,7 +45,6 @@ export default Vue.extend({ : { currentProperties: this.currentProperties, exportProperty: this.exportProperty, - showSwitchButtons: this.showSwitchButtons, } }, currentProperties(): GeoJsonProperties { @@ -88,10 +87,6 @@ export default Vue.extend({ renderUi(): boolean { return this.windowFeatures.length > 0 || this.showList }, - /** only show switch buttons if multiple property sets are available */ - showSwitchButtons(): boolean { - return this.windowFeatures.length > 1 - }, }, watch: { moveHandleProperties( diff --git a/packages/plugins/Gfi/src/store/getters.ts b/packages/plugins/Gfi/src/store/getters.ts index 87e95026d..efec454ab 100644 --- a/packages/plugins/Gfi/src/store/getters.ts +++ b/packages/plugins/Gfi/src/store/getters.ts @@ -53,6 +53,10 @@ const getters: PolarGetterTree = { {} as Record ) }, + /** only show switch buttons if multiple property sets are available */ + showSwitchButtons(_, { windowFeatures }) { + return windowFeatures.length > 1 + }, windowLayerKeys(_, { gfiConfiguration }): string[] { return Object.entries(gfiConfiguration?.layers || {}).reduce( (accumulator, [key, { window }]) => { diff --git a/packages/plugins/Gfi/src/types.ts b/packages/plugins/Gfi/src/types.ts index 5d3e8b9a2..c782de769 100644 --- a/packages/plugins/Gfi/src/types.ts +++ b/packages/plugins/Gfi/src/types.ts @@ -58,6 +58,7 @@ export interface GfiGetters extends GfiState { renderMoveHandle: boolean renderType: RenderType showList: boolean + showSwitchButtons: boolean /** subset of layerKeys, where features' properties are to be shown in UI */ windowLayerKeys: string[] /** From aaa83884a92b92b927f9ee65d31aee43313b765d Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Fri, 26 Apr 2024 14:26:56 +0200 Subject: [PATCH 09/36] Move logic of currentProperties to the store as a getter --- packages/clients/dish/src/plugins/Gfi/Content.vue | 5 +---- .../meldemichel/src/plugins/Gfi/Feature.vue | 4 +--- packages/plugins/Gfi/src/components/Feature.vue | 8 +------- .../Gfi/src/components/FeatureTableBody.vue | 7 +------ packages/plugins/Gfi/src/components/Gfi.vue | 14 +------------- packages/plugins/Gfi/src/store/getters.ts | 14 ++++++++++++++ packages/plugins/Gfi/src/types.ts | 1 + 7 files changed, 20 insertions(+), 33 deletions(-) diff --git a/packages/clients/dish/src/plugins/Gfi/Content.vue b/packages/clients/dish/src/plugins/Gfi/Content.vue index c036a0517..a11d33a18 100644 --- a/packages/clients/dish/src/plugins/Gfi/Content.vue +++ b/packages/clients/dish/src/plugins/Gfi/Content.vue @@ -102,10 +102,6 @@ export default Vue.extend({ name: 'DishGfiContent', components: { ActionButton }, props: { - currentProperties: { - type: Object as PropType, - required: true, - }, exportProperty: { type: String, default: '', @@ -125,6 +121,7 @@ export default Vue.extend({ computed: { ...mapGetters(['clientWidth', 'hasSmallWidth', 'hasWindowSize']), ...mapGetters('plugin/gfi', [ + 'currentProperties', 'imageLoaded', 'visibleWindowFeatureIndex', 'windowFeatures', diff --git a/packages/clients/meldemichel/src/plugins/Gfi/Feature.vue b/packages/clients/meldemichel/src/plugins/Gfi/Feature.vue index f4dcbcf21..ef5782368 100644 --- a/packages/clients/meldemichel/src/plugins/Gfi/Feature.vue +++ b/packages/clients/meldemichel/src/plugins/Gfi/Feature.vue @@ -69,6 +69,7 @@ export default Vue.extend({ computed: { ...mapGetters(['hasSmallWidth', 'hasWindowSize']), ...mapGetters('plugin/gfi', [ + 'currentProperties', 'imageLoaded', 'visibleWindowFeatureIndex', 'windowFeatures', @@ -77,9 +78,6 @@ export default Vue.extend({ displayImage(): boolean { return this.currentProperties.pic }, - currentProperties(): GeoJsonProperties { - return { ...this.windowFeatures[this.visibleWindowFeatureIndex] } - }, }, watch: { currentProperties(newProps: object) { diff --git a/packages/plugins/Gfi/src/components/Feature.vue b/packages/plugins/Gfi/src/components/Feature.vue index 4a0a9fc4a..2de0e1f07 100644 --- a/packages/plugins/Gfi/src/components/Feature.vue +++ b/packages/plugins/Gfi/src/components/Feature.vue @@ -17,9 +17,7 @@ , - required: true, - }, exportProperty: { type: String, default: '', diff --git a/packages/plugins/Gfi/src/components/FeatureTableBody.vue b/packages/plugins/Gfi/src/components/FeatureTableBody.vue index 958e47172..5a983787e 100644 --- a/packages/plugins/Gfi/src/components/FeatureTableBody.vue +++ b/packages/plugins/Gfi/src/components/FeatureTableBody.vue @@ -39,14 +39,9 @@ import isValidHttpUrl from '../utils/isValidHttpUrl' export default Vue.extend({ name: 'GfiFeatureTableBody', - props: { - currentProperties: { - type: Object as PropType, - required: true, - }, - }, computed: { ...mapGetters(['clientWidth']), + ...mapGetters('plugin/gfi', ['currentProperties']), /** Removes polarInternalLayerKey as it shouldn't be displayed to the user. */ filteredProperties() { if (this.currentProperties) { diff --git a/packages/plugins/Gfi/src/components/Gfi.vue b/packages/plugins/Gfi/src/components/Gfi.vue index de7d3975e..12fff4459 100644 --- a/packages/plugins/Gfi/src/components/Gfi.vue +++ b/packages/plugins/Gfi/src/components/Gfi.vue @@ -16,7 +16,6 @@ import compare from 'just-compare' import { t } from 'i18next' import Vue from 'vue' import { mapActions, mapGetters, mapMutations } from 'vuex' -import { GeoJsonProperties } from 'geojson' import { MoveHandleProperties } from '@polar/lib-custom-types' import Feature from './Feature.vue' import List from './List.vue' @@ -26,6 +25,7 @@ export default Vue.extend({ computed: { ...mapGetters(['moveHandle']), ...mapGetters('plugin/gfi', [ + 'currentProperties', 'exportPropertyLayerKeys', 'gfiContentComponent', 'gfiConfiguration', @@ -43,21 +43,9 @@ export default Vue.extend({ return this.showList ? {} : { - currentProperties: this.currentProperties, exportProperty: this.exportProperty, } }, - currentProperties(): GeoJsonProperties { - const properties = { - ...this.windowFeatures[this.visibleWindowFeatureIndex], - } - const exportProperty = - this.exportPropertyLayerKeys[properties.polarInternalLayerKey] - if (exportProperty?.length > 0) { - delete properties[exportProperty] - } - return properties - }, exportProperty(): string { if (this.currentProperties) { const property = diff --git a/packages/plugins/Gfi/src/store/getters.ts b/packages/plugins/Gfi/src/store/getters.ts index efec454ab..cf8245f56 100644 --- a/packages/plugins/Gfi/src/store/getters.ts +++ b/packages/plugins/Gfi/src/store/getters.ts @@ -41,6 +41,20 @@ const getters: PolarGetterTree = { ? gfiConfiguration.afterLoadFunction : null }, + currentProperties( + _, + { exportPropertyLayerKeys, visibleWindowFeatureIndex, windowFeatures } + ) { + const properties = { + ...windowFeatures[visibleWindowFeatureIndex], + } + const exportProperty = + exportPropertyLayerKeys[properties.polarInternalLayerKey] + if (exportProperty?.length > 0) { + delete properties[exportProperty] + } + return properties + }, layerKeys(_, { gfiConfiguration }) { return Object.keys(gfiConfiguration?.layers || {}) }, diff --git a/packages/plugins/Gfi/src/types.ts b/packages/plugins/Gfi/src/types.ts index c782de769..f3c83177c 100644 --- a/packages/plugins/Gfi/src/types.ts +++ b/packages/plugins/Gfi/src/types.ts @@ -43,6 +43,7 @@ export interface GfiState { export interface GfiGetters extends GfiState { afterLoadFunction: GfiAfterLoadFunction | null + currentProperties: GeoJsonProperties exportPropertyLayerKeys: Record /** subset of layerKeys, where features' geometries are to be shown on map */ geometryLayerKeys: string[] From 04f9a07cf7b6356b8dd3fe3dda0ab25df3e5c8da Mon Sep 17 00:00:00 2001 From: Pascal Roehling Date: Fri, 26 Apr 2024 14:30:53 +0200 Subject: [PATCH 10/36] Remove unused imports --- packages/plugins/Gfi/src/components/Feature.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/plugins/Gfi/src/components/Feature.vue b/packages/plugins/Gfi/src/components/Feature.vue index 2de0e1f07..73037df00 100644 --- a/packages/plugins/Gfi/src/components/Feature.vue +++ b/packages/plugins/Gfi/src/components/Feature.vue @@ -28,8 +28,7 @@ diff --git a/packages/clients/dish/src/plugins/Gfi/Content.vue b/packages/clients/dish/src/plugins/Gfi/Content.vue index a11d33a18..3b5fc3a64 100644 --- a/packages/clients/dish/src/plugins/Gfi/Content.vue +++ b/packages/clients/dish/src/plugins/Gfi/Content.vue @@ -1,7 +1,7 @@