-
Notifications
You must be signed in to change notification settings - Fork 15
PB-90: Reduce shortlink location popup calls tabs version #603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PB-90: Reduce shortlink location popup calls tabs version #603
Conversation
Passing run #379 ↗︎Details:
Review all test suite changes for PR #603 ↗︎ |
1e8bad8
to
b4e2f29
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just did a quick functional test of the UI (no code review yet) and looks very promising. A few issues/adjustment to do are listed below:
- Once the popup is open in the share tab, if you move the map around or change the map zoom, the URL parameter are updated, but this update is not reflected to the share link. So changes in the url parameter should trigger an update of the share link
- The name of the share tab should be changed to
Share position
(the old viewer is using this traduction so you should find a traduction key) - The size of the window should be reduced, with both tab we have some white space on the right hand side.
- I would add the
Share link
label to the short link input element like in theShare
menu (personal preference) - The title of the popup window could be updated to the title of the tab (just an idea that needs to be experienced if it looks good)
|
|
7614eb9
to
abe8915
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The results looks very nice.
Some code clean up and improvements are required see comment, but thanks for the effort.
copyTooltip.value = tippy(copyButton.value, { | ||
content: i18n.t('copy_success'), | ||
arrow: true, | ||
placement: 'right', | ||
trigger: 'manual', | ||
onShow(instance) { | ||
setTimeout(() => { | ||
instance.hide() | ||
}, 1000) | ||
}, | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we should not make the tippy instance reactive. We should only use javascript plain object as reactive and as well in store. Unfortunately this is not always the case in our code, but we should make sure not to add more exception to this rule.
Adding complex object to reactive has some performance drawback and can lead to very subtle bugs.
Wo here you dan simply use a normal variable without ref
let copyTooltipInstance = null
onMounted(()=>{
copyTooltipInstance = tippy(...)
})
shareLinkUrl.value = `${location.origin}/#/map?${stringifyQuery(query)}` | ||
shortenShareLink(shareLinkUrl.value) | ||
|
||
function showTooltip() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe showCopiedTooltip
is more explicit
} | ||
async function updateQrCode(url) { | ||
|
||
async function copyValue() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use copyShareLink
const newClickInfo = ref(true) | ||
const showEmbedSharing = ref(false) | ||
const requestClipboard = ref(false) | ||
const copied = ref(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe shareLinkCopied
@click=" | ||
(selectedTab = 'position'), | ||
(showEmbedSharing = false), | ||
(newClickInfo = false) | ||
" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be better to put this code to a function, e.g. onPositionTabClick
.location-popup { | ||
@extend .clear-no-ios-long-press; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is not needed here, already part of the parent component
}) | ||
watch(currentLang, () => { | ||
if (showEmbedSharing.value) { | ||
setTimeout(() => updateShareLink(), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the setTimeout
here ? if you have a race condition it could be also solved using vue nextTick
method
}) | ||
watch(zoom, () => { | ||
if (showEmbedSharing.value) { | ||
setTimeout(() => updateShareLink(), 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dito as above
<LocationPopupShare | ||
:class="{ active: selectedTab === 'share', show: selectedTab === 'share' }" | ||
:coordinate="coordinate" | ||
:click-info="clickInfo" | ||
:current-lang="currentLang" | ||
:show-embed-sharing="showEmbedSharing" | ||
@share-link="(i) => (shareLink = i)" | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found the logic of the share link with the child event and the show-embed-sharing
hard to follow, might be better to put the shortlink logic in the parent vue, meaning in this component LocationPopup
and to pass the shortlink to the child component, might make the code simpler to follow.
24a2af5
to
21106ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice just a few minor comments but otherwise its all good.
@@ -1,45 +1,39 @@ | |||
<script setup> | |||
/** Right click pop up which shows the coordinates of the position under the cursor. */ | |||
|
|||
import proj4 from 'proj4' | |||
import { computed, onMounted, ref, watch } from 'vue' | |||
// importing directly the vue component, see https://github.com/ivanvermeyen/vue-collapse-transition/issues/5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is probably a copy past mistake
const route = useRoute() | ||
const store = useStore() | ||
|
||
const clickInfo = computed(() => store.state.map.clickInfo) | ||
const currentLang = computed(() => store.state.i18n.lang) | ||
const projection = computed(() => store.state.position.projection) | ||
const showIn3d = computed(() => store.state.cesium.active) | ||
const currentLang = computed(() => store.state.i18n.lang) | ||
|
||
const route = useRoute() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just code style I would keep the useRoute
above with the other use...
updateShareLink() | ||
} | ||
} | ||
console.log('Query parameters changed:', newQuery) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No console, if you want to keep some debugging log, you need to use log.debug
const selectedTab = ref('position') | ||
const shareTabButton = ref(null) | ||
const newClickInfo = ref(true) | ||
const showEmbedSharing = ref(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be simplified by using a computed property
const showEmbedSharing = computed(()=> selectedTab.value === 'share')
So you don't have to set it and clear it below
</script> | ||
|
||
<template> | ||
<component | ||
:is="mappingFrameworkSpecificPopup" | ||
v-if="coordinate" | ||
:title="$t('position')" | ||
:title="selectedTab == 'position' ? $t('position') : $t('link_bowl_crosshair')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the new style for translation i18n.t
instead of $t
:value="heightInMeter" | ||
:extra-value="heightInFeet" | ||
> | ||
<a :href="$t('elevation_href')" target="_blank">{{ $t('elevation') }}</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i18n.t
<style lang="scss" scoped> | ||
@import 'src/scss/webmapviewer-bootstrap-theme'; | ||
</style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the style is not used it can be removed
7cb07ed
to
5ac6711
Compare
5ac6711
to
dc1876c
Compare
b285b68
to
2605c07
Compare
Test link