From e2075b96d49472c611f9ca177bb4614c6fc8fab3 Mon Sep 17 00:00:00 2001 From: SRP-mango Date: Wed, 29 Nov 2023 17:09:10 +0700 Subject: [PATCH 1/4] feature: add user location --- src/components/DestinationInfoCard.vue | 29 +++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/components/DestinationInfoCard.vue b/src/components/DestinationInfoCard.vue index ddd0003..b600c5c 100644 --- a/src/components/DestinationInfoCard.vue +++ b/src/components/DestinationInfoCard.vue @@ -104,6 +104,7 @@ background-color: rgba(230, 230, 230, 1); padding-left: 2vw;" variant="invert-solo" + :model-value="formattedLocation" flat > Date: Wed, 29 Nov 2023 17:19:06 +0700 Subject: [PATCH 2/4] fix: fixed minor bug --- src/components/DestinationInfoCard.vue | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/DestinationInfoCard.vue b/src/components/DestinationInfoCard.vue index b600c5c..a6b60b6 100644 --- a/src/components/DestinationInfoCard.vue +++ b/src/components/DestinationInfoCard.vue @@ -189,7 +189,7 @@ ย้อนกลับ - + เริ่มการนำทาง @@ -240,7 +240,9 @@ export default { return { showPopup: true, showRoute: false, - userLocation: null + userLocation: null, + isLocationRequested: false, + }; }, computed: { @@ -248,7 +250,9 @@ export default { return this.showRoute ? '45vh' : '60vh'; }, formattedLocation() { - if (this.userLocation) { + if (this.isLocationRequested && !this.userLocation) { + return 'Requesting location...'; + } else if (this.userLocation) { return `${this.userLocation.lat.toFixed(6)}, ${this.userLocation.lon.toFixed(6)}`; } return 'Location not available'; @@ -263,7 +267,11 @@ export default { this.getUserLocation(); this.showRoute = true; }, + enterRoute() { + console.log("Enter Route"); + }, getUserLocation() { + this.isLocationRequested = true; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(this.setLocation, this.handleLocationError); } else { From d75174d06462657101f139139fbf6d3c6ce43cd1 Mon Sep 17 00:00:00 2001 From: NekoVari Date: Wed, 29 Nov 2023 18:50:44 +0700 Subject: [PATCH 3/4] use openrouteservice api --- src/components/DestinationInfoCard.vue | 115 ++++++++++++++++--------- 1 file changed, 76 insertions(+), 39 deletions(-) diff --git a/src/components/DestinationInfoCard.vue b/src/components/DestinationInfoCard.vue index a6b60b6..b63e760 100644 --- a/src/components/DestinationInfoCard.vue +++ b/src/components/DestinationInfoCard.vue @@ -231,6 +231,7 @@ const detial = [