add location logging, display last location on map
Signed-off-by: Nicolas Froger <nicolas@kektus.xyz>
This commit is contained in:
parent
4356816f07
commit
130581a411
13 changed files with 386 additions and 3 deletions
|
|
@ -2,13 +2,18 @@
|
|||
|
||||
import { usePostsStore } from '@/stores/posts.js'
|
||||
import { computed, onMounted } from 'vue'
|
||||
import { Camera } from 'lucide-vue-next'
|
||||
import { Camera, MapPin } from 'lucide-vue-next'
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip/index.js'
|
||||
import { useLocationStore } from '@/stores/location.js'
|
||||
|
||||
const postStore = usePostsStore()
|
||||
const locationStore = useLocationStore()
|
||||
|
||||
const postsLinesCoordinates = computed(() => {
|
||||
const coords = []
|
||||
if (locationStore.lastLocation != null) {
|
||||
coords.push(locationStore.lastLocation.projectedCoordinates)
|
||||
}
|
||||
for (const post of postStore.posts) {
|
||||
coords.push(post.projectedCoordinates)
|
||||
}
|
||||
|
|
@ -17,6 +22,7 @@ const postsLinesCoordinates = computed(() => {
|
|||
|
||||
onMounted(() => {
|
||||
postStore.fetchPosts()
|
||||
locationStore.fetchLocation()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
|
@ -59,8 +65,27 @@ onMounted(() => {
|
|||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
</ol-overlay>
|
||||
<ol-overlay
|
||||
v-if="locationStore.lastLocation != null"
|
||||
:position="locationStore.lastLocation.projectedCoordinates"
|
||||
:autoPan="true"
|
||||
>
|
||||
<TooltipProvider>
|
||||
<Tooltip :default-open="true">
|
||||
<TooltipTrigger as-child>
|
||||
<div
|
||||
class="-translate-x-1/2 -translate-y-1/2 p-1 rounded-lg bg-rose-950 hover:bg-rose-900 transition-colors duration-200">
|
||||
<MapPin size="16" />
|
||||
</div>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>Dernière position, {{ locationStore.lastLocation.formatedDate }}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
</ol-overlay>
|
||||
|
||||
<ol-vector-layer v-if="postStore.posts.length > 1">
|
||||
<ol-vector-layer v-if="postsLinesCoordinates.length > 1">
|
||||
<ol-source-vector>
|
||||
<ol-feature ref="profileFeatureRef">
|
||||
<ol-geom-line-string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue