Skip to content

Commit a0f8051

Browse files
combine gfi and gfiIntern plugins
1 parent e69d512 commit a0f8051

File tree

8 files changed

+87
-87
lines changed

8 files changed

+87
-87
lines changed

packages/clients/dish/src/addPlugins.ts

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import merge from 'lodash.merge'
1818

1919
import {
2020
AddressSearchConfiguration,
21+
GfiConfiguration,
2122
SearchMethodFunction,
2223
} from '@polar/lib-custom-types'
2324
import { extendGfi } from './utils/extendGfi'
@@ -30,30 +31,25 @@ import {
3031
import { denkmalSearchResult } from './utils/denkmalSearchIntern'
3132
import DishModal from './plugins/Modal'
3233
import DishHeader from './plugins/Header'
33-
import DishGfiContent from './plugins/Gfi'
3434
import { MODE } from './enums'
35-
import DishGfiIntern from './plugins/GfiIntern'
35+
import { DishGfiIntern, DishGfiExtern } from './plugins/Gfi'
3636
import DishExportMap from './plugins/DishExportMap'
3737
import { searchMethods } from './mapConfigurations/searchConfigParams'
3838

39-
const pluginGfiExtern = {
40-
coordinateSources: ['plugin/addressSearch/chosenAddress'],
41-
gfiContentComponent: DishGfiContent,
42-
afterLoadFunction: extendGfi,
43-
}
44-
45-
const pluginGfiIntern = {
46-
coordinateSources: ['plugin/addressSearch/chosenAddress'],
47-
gfiContentComponent: DishGfiIntern,
48-
}
49-
50-
function getPluginGfiConfig(mode: keyof typeof MODE) {
51-
return mode === MODE.EXTERN ? pluginGfiExtern : pluginGfiIntern
39+
const gfiConfig = (mode: keyof typeof MODE): Partial<GfiConfiguration> => {
40+
const gfiConfig: Partial<GfiConfiguration> = {
41+
coordinateSources: ['plugin/addressSearch/chosenAddress'],
42+
gfiContentComponent: mode === MODE.EXTERN ? DishGfiExtern : DishGfiIntern,
43+
}
44+
if (mode === MODE.EXTERN) {
45+
gfiConfig.afterLoadFunction = extendGfi
46+
}
47+
return gfiConfig
5248
}
5349

54-
function getAddressSearchConfig(
50+
const addressSearchConfig = (
5551
mode: keyof typeof MODE
56-
): Partial<AddressSearchConfiguration> {
52+
): Partial<AddressSearchConfiguration> => {
5753
const addressSearchConfig: Partial<AddressSearchConfiguration> = {
5854
displayComponent: true,
5955
layoutTag: NineLayoutTag.TOP_LEFT,
@@ -122,7 +118,7 @@ export const addPlugins = (core, mode: keyof typeof MODE = 'EXTERN') => {
122118
layoutTag: NineLayoutTag.TOP_MIDDLE,
123119
}),
124120
PolarPluginAddressSearch(
125-
getAddressSearchConfig(mode) as AddressSearchConfiguration
121+
addressSearchConfig(mode) as AddressSearchConfiguration
126122
),
127123
PolarPluginPins({
128124
displayComponent: mode === MODE.EXTERN,
@@ -150,7 +146,7 @@ export const addPlugins = (core, mode: keyof typeof MODE = 'EXTERN') => {
150146
displayComponent: true,
151147
layoutTag: NineLayoutTag.TOP_LEFT,
152148
},
153-
getPluginGfiConfig(mode)
149+
gfiConfig(mode)
154150
)
155151
),
156152
PolarPluginLoadingIndicator({

packages/clients/dish/src/plugins/Gfi/Content.vue renamed to packages/clients/dish/src/plugins/Gfi/ContentExtern.vue

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
<template>
2-
<v-card class="dish-gfi-content">
3-
<v-card-actions v-if="!hasWindowSize || !hasSmallWidth">
4-
<ActionButton></ActionButton>
5-
<v-spacer></v-spacer>
6-
<v-btn
7-
icon
8-
small
9-
:aria-label="$t('common:plugins.gfi.header.close')"
10-
@click="close(true)"
11-
>
12-
<v-icon small>fa-xmark</v-icon>
13-
</v-btn>
14-
</v-card-actions>
2+
<SharedContent>
153
<v-card-title class="dish-gfi-title" :style="`max-width: ${imgMaxWidth}`">
164
{{ currentProperties.Bezeichnung }}
175
</v-card-title>
@@ -87,19 +75,19 @@
8775
</tbody>
8876
</v-simple-table>
8977
</v-card-text>
90-
</v-card>
78+
</SharedContent>
9179
</template>
9280

9381
<script lang="ts">
9482
import Vue from 'vue'
9583
import { mapActions, mapMutations, mapGetters } from 'vuex'
96-
import ActionButton from './ActionButton.vue'
84+
import SharedContent from './SharedContent.vue'
9785
9886
type GfiIndexStep = -1 | 1
9987
10088
export default Vue.extend({
101-
name: 'DishGfiContent',
102-
components: { ActionButton },
89+
name: 'DishGfiExtern',
90+
components: { SharedContent },
10391
data: () => ({
10492
infoFields: [
10593
'Kreis',
@@ -112,7 +100,6 @@ export default Vue.extend({
112100
sachgesamtheitOpen: false,
113101
}),
114102
computed: {
115-
...mapGetters(['clientWidth', 'hasSmallWidth', 'hasWindowSize']),
116103
...mapGetters('plugin/gfi', [
117104
'currentProperties',
118105
'imageLoaded',
@@ -155,18 +142,7 @@ export default Vue.extend({
155142
return this.sachgesamtheit.properties.Foto !== 'Kein Foto gefunden'
156143
},
157144
},
158-
mounted() {
159-
if (this.hasWindowSize && this.hasSmallWidth) {
160-
this.setMoveHandleActionButton({
161-
component: ActionButton,
162-
})
163-
}
164-
},
165-
beforeDestroy() {
166-
this.setMoveHandleActionButton(null)
167-
},
168145
methods: {
169-
...mapMutations(['setMoveHandleActionButton']),
170146
...mapMutations('plugin/gfi', [
171147
'setImageLoaded',
172148
'setVisibleWindowFeatureIndex',

packages/clients/dish/src/plugins/GfiIntern/ContentIntern.vue renamed to packages/clients/dish/src/plugins/Gfi/ContentIntern.vue

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,33 @@
11
<template>
2-
<v-card v-if="showGfi" class="dish-gfi-content">
3-
<v-card-actions v-if="!hasWindowSize || !hasSmallWidth">
4-
<ActionButton></ActionButton>
5-
<v-spacer></v-spacer>
6-
<v-btn
7-
icon
8-
small
9-
:aria-label="$t('common:plugins.gfi.header.close')"
10-
@click="close(true)"
11-
>
12-
<v-icon small>fa-xmark</v-icon>
13-
</v-btn>
14-
</v-card-actions>
2+
<SharedContent :show-gfi="showGfi">
153
<MonumentContent></MonumentContent>
164
<div id="dish-gfi-switch-buttons">
17-
<SwitchButtonIntern v-if="showDishSwitchButtons"></SwitchButtonIntern>
5+
<SwitchButton v-if="showDishSwitchButtons"></SwitchButton>
186
</div>
19-
</v-card>
7+
</SharedContent>
208
</template>
219

2210
<script lang="ts">
2311
import Vue from 'vue'
2412
import { mapActions, mapMutations, mapGetters } from 'vuex'
25-
import ActionButton from '../Gfi/ActionButton.vue'
2613
import { denkmaelerWMS, alkisWms } from '../../servicesConstants'
27-
import SwitchButtonIntern from './SwitchButtonIntern.vue'
14+
import SharedContent from './SharedContent.vue'
15+
import SwitchButton from './SwitchButton.vue'
2816
import MonumentContent from './MonumentContent.vue'
2917
3018
export default Vue.extend({
3119
name: 'DishGfiIntern',
3220
components: {
33-
ActionButton,
34-
SwitchButtonIntern,
21+
SharedContent,
22+
SwitchButton,
3523
MonumentContent,
3624
},
3725
data: () => ({}),
3826
computed: {
39-
...mapGetters(['hasSmallWidth', 'hasWindowSize']),
4027
...mapGetters('plugin/gfi', ['currentProperties', 'windowFeatures']),
4128
...mapGetters('plugin/layerChooser', ['activeMaskIds']),
42-
objektIdentifier(): string {
43-
return this.currentProperties.objektid
29+
objektIdentifier(): boolean {
30+
return Boolean(this.currentProperties.objektid)
4431
},
4532
showDishSwitchButtons(): boolean {
4633
if (
@@ -63,18 +50,7 @@ export default Vue.extend({
6350
this.setVisibleWindowFeatureIndex(0)
6451
},
6552
},
66-
mounted() {
67-
if (this.hasWindowSize && this.hasSmallWidth) {
68-
this.setMoveHandleActionButton({
69-
component: ActionButton,
70-
})
71-
}
72-
},
73-
beforeDestroy() {
74-
this.setMoveHandleActionButton(null)
75-
},
7653
methods: {
77-
...mapMutations(['setMoveHandleActionButton']),
7854
...mapMutations('plugin/gfi', ['setVisibleWindowFeatureIndex']),
7955
...mapActions('plugin/gfi', ['close']),
8056
showInfoForActiveLayers(topic: 'alkis' | 'monument') {

packages/clients/dish/src/plugins/GfiIntern/MonumentContent.vue renamed to packages/clients/dish/src/plugins/Gfi/MonumentContent.vue

File renamed without changes.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<template>
2+
<v-card v-if="showGfi" class="dish-gfi-content">
3+
<v-card-actions v-if="!hasWindowSize || !hasSmallWidth">
4+
<ActionButton></ActionButton>
5+
<v-spacer></v-spacer>
6+
<v-btn
7+
icon
8+
small
9+
:aria-label="$t('common:plugins.gfi.header.close')"
10+
@click="close(true)"
11+
>
12+
<v-icon small>fa-xmark</v-icon>
13+
</v-btn>
14+
</v-card-actions>
15+
<slot></slot>
16+
</v-card>
17+
</template>
18+
19+
<script lang="ts">
20+
import Vue from 'vue'
21+
import { mapActions, mapMutations, mapGetters } from 'vuex'
22+
import ActionButton from './ActionButton.vue'
23+
24+
export default Vue.extend({
25+
name: 'SharedContent',
26+
components: { ActionButton },
27+
props: {
28+
showGfi: {
29+
type: Boolean,
30+
required: false,
31+
default: true,
32+
},
33+
},
34+
computed: {
35+
...mapGetters(['hasSmallWidth', 'hasWindowSize']),
36+
},
37+
mounted() {
38+
if (this.hasWindowSize && this.hasSmallWidth) {
39+
this.setMoveHandleActionButton({
40+
component: ActionButton,
41+
})
42+
}
43+
},
44+
beforeDestroy() {
45+
this.setMoveHandleActionButton(null)
46+
},
47+
methods: {
48+
...mapMutations(['setMoveHandleActionButton']),
49+
...mapActions('plugin/gfi', ['close']),
50+
},
51+
})
52+
</script>
53+
54+
<style lang="scss" scoped></style>

packages/clients/dish/src/plugins/GfiIntern/SwitchButtonIntern.vue renamed to packages/clients/dish/src/plugins/Gfi/SwitchButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import { mapGetters, mapMutations } from 'vuex'
3232
type GfiIndexStep = -1 | 1
3333
3434
export default Vue.extend({
35-
name: 'GfiFeatureSwitchButtons',
35+
name: 'SwitchButton',
3636
computed: {
3737
...mapGetters('plugin/gfi', [
3838
'windowFeatures',
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
import DishGfiContent from './Content.vue'
1+
import DishGfiExtern from './ContentExtern.vue'
2+
import DishGfiIntern from './ContentIntern.vue'
23

3-
export default DishGfiContent
4+
export { DishGfiIntern, DishGfiExtern }

packages/clients/dish/src/plugins/GfiIntern/index.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)