Skip to content

Commit 2605c07

Browse files
committed
PB-90: Clean up code for PR
1 parent 05661ac commit 2605c07

File tree

5 files changed

+10
-103
lines changed

5 files changed

+10
-103
lines changed

src/modules/map/components/LocationPopup.vue

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup>
22
/** Right click pop up which shows the coordinates of the position under the cursor. */
33
4-
// importing directly the vue component, see https://github.com/ivanvermeyen/vue-collapse-transition/issues/5
54
import tippy from 'tippy.js'
65
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue'
76
import { useI18n } from 'vue-i18n'
@@ -18,17 +17,17 @@ import { stringifyQuery } from '@/utils/url-router'
1817
1918
const i18n = useI18n()
2019
const store = useStore()
20+
const route = useRoute()
2121
2222
const clickInfo = computed(() => store.state.map.clickInfo)
2323
const projection = computed(() => store.state.position.projection)
2424
const showIn3d = computed(() => store.state.cesium.active)
2525
const currentLang = computed(() => store.state.i18n.lang)
26+
const showEmbedSharing = computed(() => selectedTab.value === 'share')
2627
27-
const route = useRoute()
2828
const selectedTab = ref('position')
2929
const shareTabButton = ref(null)
3030
const newClickInfo = ref(true)
31-
const showEmbedSharing = ref(false)
3231
const requestClipboard = ref(false)
3332
const shareLinkCopied = ref(false)
3433
const shareLinkUrl = ref(null)
@@ -79,7 +78,6 @@ watch(
7978
updateShareLink()
8079
}
8180
}
82-
console.log('Query parameters changed:', newQuery)
8381
}
8482
)
8583
@@ -123,18 +121,16 @@ async function shortenShareLink(url) {
123121
124122
function onPositionTabClick() {
125123
selectedTab.value = 'position'
126-
showEmbedSharing.value = false
127124
newClickInfo.value = false
128125
}
129126
async function onShareTabClick() {
130-
selectedTab.value = 'share'
131127
if (newClickInfo.value && showEmbedSharing.value == false) {
132128
//copyShareLink is called by watcher since new shortlink is computed with a delay
133129
requestClipboard.value = true
134130
} else {
135131
copyShareLink()
136132
}
137-
showEmbedSharing.value = true
133+
selectedTab.value = 'share'
138134
newClickInfo.value = false
139135
}
140136
@@ -153,7 +149,6 @@ async function copyShareLink() {
153149
154150
function clearClick() {
155151
store.dispatch('clearClick')
156-
showEmbedSharing.value = false
157152
requestClipboard.value = false
158153
}
159154
</script>
@@ -162,7 +157,7 @@ function clearClick() {
162157
<component
163158
:is="mappingFrameworkSpecificPopup"
164159
v-if="coordinate"
165-
:title="selectedTab == 'position' ? $t('position') : $t('link_bowl_crosshair')"
160+
:title="selectedTab == 'position' ? i18n.t('position') : i18n.t('link_bowl_crosshair')"
166161
:coordinates="coordinate"
167162
:projection="projection"
168163
use-content-padding
@@ -184,7 +179,7 @@ function clearClick() {
184179
:aria-selected="selectedTab === 'position'"
185180
@click="onPositionTabClick()"
186181
>
187-
{{ $t('position') }}
182+
{{ i18n.t('position') }}
188183
</button>
189184
</li>
190185
<li class="nav-item" role="presentation">
@@ -208,7 +203,8 @@ function clearClick() {
208203
'': currentLang != 'it',
209204
}"
210205
>
211-
{{ $t('link_bowl_crosshair') }} &nbsp;&nbsp;<FontAwesomeIcon
206+
{{ i18n.t('link_bowl_crosshair') }} &nbsp;&nbsp;<FontAwesomeIcon
207+
data-cy="location-popup-share-tab-check"
212208
class="px-0 icon"
213209
:icon="copyButtonIcon"
214210
/>

src/modules/map/components/LocationPopupCopyInput.vue

-86
This file was deleted.

src/modules/map/components/LocationPopupPosition.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ async function updateHeight() {
159159
:value="heightInMeter"
160160
:extra-value="heightInFeet"
161161
>
162-
<a :href="$t('elevation_href')" target="_blank">{{ $t('elevation') }}</a>
162+
<a :href="i18n.t('elevation_href')" target="_blank">{{ i18n.t('elevation') }}</a>
163163
</LocationPopupCopySlot>
164164
</div>
165165
</div>

src/modules/map/components/LocationPopupShare.vue

-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,3 @@ const { shareLinkUrlShorten } = toRefs(props)
3333
/>
3434
</div>
3535
</template>
36-
37-
<style lang="scss" scoped>
38-
@import 'src/scss/webmapviewer-bootstrap-theme';
39-
</style>

tests/cypress/tests-e2e/mouseposition.cy.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,10 @@ describe('Test mouse position and interactions', () => {
227227

228228
cy.get('[data-cy="map"]').dblclick(120, 240)
229229
cy.get('[data-cy="map"]').rightclick()
230-
cy.get('[data-cy="location-popup-share-tab-button"]').realClick()
231230
cy.get('[data-cy="location-popup-share-tab-button"]').focus()
231+
cy.get('[data-cy="location-popup-share-tab-button"]').click()
232232
cy.get('[data-cy="location-popup-share-tab-button"]').realClick()
233+
cy.get('[data-cy="location-popup-share-tab-check"]').should('have.class', 'fa-check')
233234
cy.readClipboardValue().then((clipboardText) => {
234235
expect(clipboardText).to.be.equal('https://s.geo.admin.ch/3333333')
235236
})

0 commit comments

Comments
 (0)