From e7356b3c3c934deaa73b2aca01f67e414d94ec85 Mon Sep 17 00:00:00 2001 From: SRP-mango Date: Thu, 14 Sep 2023 23:57:18 +0700 Subject: [PATCH 01/73] hide search bar after search --- src/views/Home.vue | 53 ++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index 27f4625..03a2106 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -14,30 +14,36 @@ - - + +
+ +
+ + mdi-crosshairs-gps +
-
- -
+
+ +
{ - // Extract latitude and longitude from the selected result const lat = parseFloat(result.lat); const lon = parseFloat(result.lon); - - // Update the center coordinates to move the camera to the selected location center.value = [lon, lat]; + hideSearchResults.value = true; }; const performSearch = async () => { @@ -100,14 +107,14 @@ const performSearch = async () => { `https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(searchQuery.value)}` ); - // Process the search results and limit to, let's say, 5 results searchResults.value = response.data.slice(0, 5); + + hideSearchResults.value = false; } catch (error) { console.error("Error fetching search results:", error); } }; - //Show API const handleMapClick = async event => { const clickedCoordinate = event.coordinate; From cab24874f74713586277cb087a827c18d82bc58d Mon Sep 17 00:00:00 2001 From: SRP-mango Date: Fri, 15 Sep 2023 01:36:47 +0700 Subject: [PATCH 02/73] toggle search bar --- src/views/Home.vue | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/src/views/Home.vue b/src/views/Home.vue index 03a2106..e392d98 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -20,6 +20,7 @@ v-model="searchQuery" @keyup.enter="performSearch" @input="performSearch" + @click="toggleSearchBar()" density="compact" variant="solo" prepend-inner-icon="mdi-magnify" @@ -37,13 +38,28 @@ -
-
    -
  • - {{ result.display_name }} -
  • -
-
+ + + + + + + mdi-map-marker + + {{ result.display_name }} + + + { + showSearchBar.value = !showSearchBar.value; +}; const moveToLocation = (result) => { const lat = parseFloat(result.lat); const lon = parseFloat(result.lon); center.value = [lon, lat]; - hideSearchResults.value = true; + showSearchBar.value = false; }; const performSearch = async () => { @@ -108,8 +126,6 @@ const performSearch = async () => { ); searchResults.value = response.data.slice(0, 5); - - hideSearchResults.value = false; } catch (error) { console.error("Error fetching search results:", error); } From eb55b258d96054bab8f2c8c37cc865175b156642 Mon Sep 17 00:00:00 2001 From: NekoVari Date: Sun, 24 Sep 2023 18:35:25 +0700 Subject: [PATCH 03/73] BUG register API --- src/views/Login.vue | 2 +- src/views/Register.vue | 32 ++++++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index dc7363e..a97e54f 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -45,7 +45,7 @@ export default { }, methods: { login() { - if (this.input.username !== '' || this.input.password !== '') { + if (this.input.username !== '' && this.input.password !== '') { console.log('Authenticated: Checking with Backend'); } else { console.log('Username and Password cannot be empty'); diff --git a/src/views/Register.vue b/src/views/Register.vue index 9ce0491..02c35c2 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -21,7 +21,7 @@ - สมัครสมาชิค + สมัครสมาชิค @@ -47,15 +47,39 @@ }; }, methods: { - login() { - if (this.input.username !== '' || this.input.password !== '') { + register() { + if (this.input.username !== '' && ((this.input.password !='') && (this.input.password == this.input.passwordConfirm))) { console.log('Authenticated: Checking with Backend'); + fetch("http://localhost:5000/api/users/create", { + method: "POST", + body: JSON.stringify({ + username: username, + password: password, + email: "", + isGoogleAccount: false + }) + }) + .then((res) => { + if(res.ok){ + return res.json() + } + else{ + return res.json().then(data => {throw Error(`${data.registerStatus}`) }); + } + }) + .then((data) => { + console.log(data.registerStatus) + this.$router.push({name : 'login'}) + }) + .catch((err) =>{ + console.log(err) + }) + console.log("fisnished fetch"); } else { console.log('Username and Password cannot be empty'); } } } }; - \ No newline at end of file From 004c9a697c0908b12a44af2431a26a789e3106a9 Mon Sep 17 00:00:00 2001 From: NekoVari Date: Wed, 27 Sep 2023 00:47:59 +0700 Subject: [PATCH 04/73] create login and register functionable --- src/views/Login.vue | 26 ++++++++++++++++++++++++++ src/views/Register.vue | 9 ++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index a97e54f..9853b5d 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -47,6 +47,32 @@ export default { login() { if (this.input.username !== '' && this.input.password !== '') { console.log('Authenticated: Checking with Backend'); + fetch(`http://localhost:5000/api/users/login`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + username: this.input.username, + password: this.input.password, + }), + }) + .then((res) => { + if (res.ok) { + return res.json(); + } else { + throw Error(`Login failed (${res.status})`); + } + }) + .then((data) => { + console.log(data.loginStatus); + sessionStorage.setItem('current_user', data.userName); + this.$router.push({ name: 'home' }); + }) + .catch((err) => { + console.log(err); + // Handle the error, e.g., display an error message to the user + }); } else { console.log('Username and Password cannot be empty'); } diff --git a/src/views/Register.vue b/src/views/Register.vue index 02c35c2..563711a 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -52,10 +52,13 @@ console.log('Authenticated: Checking with Backend'); fetch("http://localhost:5000/api/users/create", { method: "POST", + headers: { + 'Content-Type': 'application/json', + }, body: JSON.stringify({ - username: username, - password: password, - email: "", + username: this.input.username, + password: this.input.password, + email: "asdf", isGoogleAccount: false }) }) From a371a8442676d83c5fef6935531bc48278e3e921 Mon Sep 17 00:00:00 2001 From: NekoVari Date: Wed, 27 Sep 2023 00:58:43 +0700 Subject: [PATCH 05/73] fix login bug --- src/views/Login.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index 9853b5d..c2cfabd 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -65,8 +65,8 @@ export default { } }) .then((data) => { - console.log(data.loginStatus); - sessionStorage.setItem('current_user', data.userName); + console.log(data.success); + sessionStorage.setItem('current_user', data.user.username); this.$router.push({ name: 'home' }); }) .catch((err) => { From 01011763e7bf37b88c56d813ce99e00a975bf2e2 Mon Sep 17 00:00:00 2001 From: SRP-mango Date: Sat, 30 Sep 2023 11:18:27 +0700 Subject: [PATCH 06/73] toggle destination card (not finished) --- src/components/DestinationInfoCard.vue | 32 ++++++++++++++++++------ src/components/Popup.vue | 3 +++ src/views/Home.vue | 34 +++++++++++++++++--------- 3 files changed, 50 insertions(+), 19 deletions(-) diff --git a/src/components/DestinationInfoCard.vue b/src/components/DestinationInfoCard.vue index 53601d4..c453c03 100644 --- a/src/components/DestinationInfoCard.vue +++ b/src/components/DestinationInfoCard.vue @@ -1,16 +1,10 @@ - - + + + + + \ No newline at end of file diff --git a/src/views/Setting.vue b/src/views/Setting.vue index a652aa6..6fd6a0b 100644 --- a/src/views/Setting.vue +++ b/src/views/Setting.vue @@ -6,7 +6,7 @@

ลงชื่อเข้าใช้เพื่อบันทึกการตั้งค่าอย่างปลอดภัย

ลงชื่อเข้าใช้ - สมัครสมาชิค + สมัครสมาชิก From 930eb2dbde75fdc479bc7f3908316c1722006ed4 Mon Sep 17 00:00:00 2001 From: T-angmo Date: Sun, 1 Oct 2023 02:03:16 +0700 Subject: [PATCH 09/73] Update Login --- src/views/Login.vue | 101 ++++++++++++++++++++++++++++++++++------- src/views/Register.vue | 8 ++-- 2 files changed, 89 insertions(+), 20 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index 605ee9e..d97a1a5 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -3,31 +3,78 @@ - - -
- - -
-
- - -
- -
-
+
+
+ ยินดีต้อนรับกลับสู่ +
Little Lines
+
+
+ +
+ + + + + + + +
- ลงชื่อเข้าใช้ - ฉันต้องการสมัครสมาชิก + + + + ลงชื่อเข้าใช้ + + + + ลงชื่อเข้าใช้ด้วย Google + + + + ฉันต้องการสมัครสมาชิก + + + +
+ + + + \ No newline at end of file diff --git a/src/views/Register.vue b/src/views/Register.vue index a67fd5e..3c4db0b 100644 --- a/src/views/Register.vue +++ b/src/views/Register.vue @@ -15,7 +15,7 @@