-
Notifications
You must be signed in to change notification settings - Fork 0
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
Gslux 755 location info #175
Conversation
GitHub Pages links: * Luxembourg-geoportail: https://geoportail-luxembourg.github.io/luxembourg-geoportail/GSLUX-755-location_info/ |
16b4f94
to
129ffb0
Compare
@@ -31,7 +31,7 @@ describe('Footer bar', () => { | |||
cy.get('[data-cy="infoOpenClose"]').find('button').click() | |||
cy.get('[data-cy="infoPanel"]').should('exist') | |||
cy.get('button[data-cy="drawButton"]').click() | |||
cy.get('[data-cy="infoPanel"]').should('not.exist') | |||
cy.get('[data-cy="infoPanel"]').should('be.hidden') |
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.
Any reason why hiding the panel with css instead of removing it from the dom?
src/components/info/info-panel.vue
Outdated
</ul> | ||
</div> | ||
<template v-if="map"> | ||
<div v-show="locationInfo" class="absolute"> |
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.
any reason why using v-if l.37 and v-show l.38? could this be done using only one if? (and use v-else l.43)
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.
v-show is needed so that the streetview component remains persistant, so that the dom reference in google code remains valid
v-if removes thecomponent from the dom
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.
Ok understood, I hope this won't break the v3 panel because I remember facing some issues when the v3 was just hidden.But maybe it won't be the case for your Streetview panel.
|
||
const map = useMap().getOlMap() | ||
|
||
const shortUrl = ref() |
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.
it would be great to add some typing here, I don't even understand how this can pass the linter...
clickCoordinateLuref.value = info.clickCoordinateLuref | ||
formatted_coordinates.value = info.formatted_coordinates | ||
elevation.value = await getElevation(info.clickCoordinateLuref) | ||
address.value = await getNearestAddress(info.clickCoordinateLuref) |
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.
You are doing 3 await
sequentially, this means the user is going to wait a bit more at each request. Please use parallele loading instead (eg. Promise.allSettled
).
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.
yes, good idea, the awaits came together after refactoring,and I did not notice the possibility to regroup
const elevation = ref() | ||
const address = ref() | ||
const clickCoordinateLuref = ref() | ||
const formatted_coordinates = ref({}) |
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.
We do use camel case in our code since the beginning of the project.
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.
yep,
do you think it's possible to enforce camelCase in the linter if it is a project standard?
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.
yes, "camelcase": "on"
(I guess, did not test)
|
||
const isRapportForageVirtuelAvailable = computed(() => { | ||
const userRole = 'ACT' | ||
return userRole === 'ACT' |
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 add a comment here? because I don't understand the utility of this (maybe because the PR isn't finished yet?)
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.
sorry, still a stub (I should have marked it)
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.
FYI if you need user's role it is available in the auth service.
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.
or user-manager store
const getLidarUrl = () => 'bla' | ||
const cyclomediaUrl = computed(() => | ||
clickCoordinateLuref.value | ||
? `http://streetsmart.cyclomedia.com/streetsmart?q=${clickCoordinateLuref.value[0]};${clickCoordinateLuref.value[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.
Move http://streetsmart.cyclomedia.com/streetsmart
to a const in .env
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.
OK
const isCyclomediaAvailable = computed(() => true) | ||
const isImagesObliquesAvailable = computed(() => true) | ||
|
||
const getLidarUrl = () => 'bla' |
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 hope this won't stay as is.
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.
nope
const addRoutePoint = () => '// TODO: add point to route' | ||
|
||
const open = ref(true) | ||
const { isStreetviewActive } = storeToRefs(useInfoStore()) |
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.
useInfoStore()
is also called l. 18, instead declare a new const infoStore = useInfoStore()
and use this new const.
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.
thanks, I'll do a one-line destructioning
|
||
const open = ref(true) | ||
const { isStreetviewActive } = storeToRefs(useInfoStore()) | ||
const toggleStreetview = () => { |
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.
const toggleStreetview = () => { | |
function toggleStreetview () { |
Any reason why this is declared as a const?
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.
is there any difference ?
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.
Code consistency?
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.
👍
|
||
function downloadRapportForageVirtuel() { | ||
downloadingRepport.value = true | ||
setTimeout(() => (downloadingRepport.value = false), 2000) |
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 add a comment here? it looks like it is unfinished
<template> | ||
<div class="flex flex-row"> | ||
<div class="grow-[2] flex flex-col content-end"> | ||
<div class="grow"></div> |
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.
don't add empty dom node just for display.
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 need a spacer for flex
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.
don't add empty dom node just for display.
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.
justify-end works also
<h3 class="text-3xl text-white"> | ||
{{ t('Short Url', { ns: 'client' }) }} | ||
</h3> | ||
<input |
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.
input should have a name or id attribute to be html valid (and accessibility compliance).
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.
tricky one, thanks
added: aria-labelledby="short_url_title"
no name needed since input is not part of a form
<td>{{ coords }}</td> | ||
</tr> | ||
<tr> | ||
<th style="text-align: left">{{ t('Elevation') }}</th> |
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 tailwind class
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.
forgot to remove (handled by CSS)
<td>{{ elevation }}</td> | ||
</tr> | ||
<tr> | ||
<th style="text-align: left">{{ t('Adresse la plus proche') }}</th> |
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 tailwind class
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.
forgot to remove (handled by CSS)
<td>{{ address?.formattedAddress }}</td> | ||
</tr> | ||
<tr> | ||
<th style="text-align: left">{{ t('Distance approximative') }}</th> |
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 tailwind class
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.
forgot to remove (handled by CSS)
<img class="mx-5 mt-5" v-if="qrUrl" :src="qrUrl" /> | ||
</div> | ||
<div> | ||
<div class="mt-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.
looks like you can get rid of this dev and add the "mt-5" class to the h3 below.
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.
👍
</table> | ||
</div> | ||
<div> | ||
<div v-if="isRapportForageVirtuelAvailable"> |
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.
look like this div is not useful and the condition can be attached to the button below
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.
removesd
<a | ||
v-if="isInBoxOfLidar" | ||
class="lux-btn whitespace-nowrap" | ||
:href="getLidarUrl()" |
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 is this one getter whereas the others are refs?
src/components/info/street-view.vue
Outdated
class="h-[500px]" | ||
v-show="isStreetviewActive && !noDataAtLocation" | ||
> | ||
Streetview Container |
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.
Is this a title? any translation for that?
src/components/info/street-view.vue
Outdated
Streetview Container | ||
</div> | ||
<div | ||
class="grid before:content-streetview before:col-start-1 before:row-start-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 is this a grid? you only display a text message.
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.
modern equivalent of position: absolute
https://dev.to/nicm42/using-css-grid-to-put-elements-on-top-of-each-other-44ei
@@ -93,7 +93,7 @@ watch(infoOpen, infoOpen => { | |||
</div> | |||
|
|||
<!-- Info panel --> | |||
<div v-if="infoOpen" class="w-full md:w-80 bg-secondary z-10"> | |||
<div v-show="infoOpen" class="w-full md:w-80 bg-secondary z-10"> |
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.
same as first comment above, any reason why you are hiding the panel instead of remove it from the dom like the others?
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.
streetview needs to be persistent
if (doHide) { | ||
infoFeatureLayer.getSource()?.clear() | ||
} else { | ||
if (locationInfo.value) { |
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 else if
if (location && !hidePointer.value) { | ||
infoOpen.value = true | ||
const feature = new Feature(new Point(location)) | ||
infoFeatureLayer.getSource()?.addFeature(feature) |
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 watcher is very similar to the previous one, maybe they can be combined into one.
Or at least a bit of refactor, move
const feature = new Feature(new Point(location))
infoFeatureLayer.getSource()?.addFeature(feature)
into a new function eg. createNewPoint()
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.
good idea, thanks
return map.getEventCoordinate(event.originalEvent) | ||
} | ||
|
||
const handleClick = function (event: MapBrowserEvent<PointerEvent>) { |
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.
Any reason why declaring function 3 different ways in this file? (getClickCoordinate
, handleClick
, setInfoStyle
)
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.
typescript's fault ;-)
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.
harmonized
if (event.originalEvent.button === 2) { | ||
// if right mouse click | ||
locationInfo.value = getClickCoordinate(event) | ||
} else if (event.originalEvent.pointerType == 'touch') { |
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 ===
} | ||
} | ||
|
||
listen(map, 'pointerup', (event: any) => { |
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.
don't use any, you have found the right typing below event as MapBrowserEvent<PointerEvent>
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.
it's a MapBrowserEvent<MouseEvent>
, unfortunaltely incompatible
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.
incompatible with what? don't use any, please. You can remove it, TS will consider it as a BaseEvent.
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.
Thanks, I had not tried simply removing it :-(
listen(map, 'pointerup', (event: any) => { | ||
if ( | ||
startPixel && | ||
(event as MapBrowserEvent<PointerEvent>).originalEvent.button === 0 |
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.
Move the typing event as MapBrowserEvent<PointerEvent>
up l. 85 to replace the any
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.
does not work, above is MapBrowserEvent<MouseEvent>
so it needs to be cast to any however
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.
incompatible with what? don't use any, please. You can remove it, TS will consider it as a BaseEvent.
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.
yes, just removing it works, thanks!
(I had tried all sort of combinations, BaseEvent was not accepted, the signature wanted Event | BaseEvent, but I could not figure out where to find "Event" )
11b0349
to
e5ec30d
Compare
comply with assumptions in feature info tests
hello @tkohr I would like to do some more harmonization, what do you think of it ?:
|
src/components/info/info-panel.vue
Outdated
onUnmounted(() => { | ||
clearContent() | ||
}) |
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.
If we really need the v-show
above this component, we could get rid of the onUnmounted
I guess ?
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.
you're right.
I could not set up the correct link to street view without the component being persistent
Thanks for the rebase @mki-c2c ! Looks nice to see the right click and left click work together. Didn't notice any issues with the feature info part.
Good idea!
What do you think of creating an
Good idea! |
JIRA issue
https://jira.camptocamp.com/browse/GSLUX-XXX
Description
(details of the change, additional tests that have been done, reference to the issue for tracking, etc)
Screenshots
(only if the final render is different)