diff --git a/src/auth/login.js b/src/auth/login.js index 41631506..f26028a7 100644 --- a/src/auth/login.js +++ b/src/auth/login.js @@ -28,7 +28,7 @@ async function submitLoginResponse(event) { const data = await response.json(); if (data.uid) { sessionStorage.setItem('userId', data.uid); - window.location.href = '/src/index.html'; + window.location.href = '/src/pages/home.html'; } else if (data.alert) { alert(data.alert); } else { diff --git a/src/auth/userID.js b/src/auth/userID.js index 41056eab..d9c9d31b 100644 --- a/src/auth/userID.js +++ b/src/auth/userID.js @@ -1,7 +1,7 @@ window.onload = () => { const userId = sessionStorage.getItem('userId'); if (!userId) { - window.location.href = '/src/login.html'; + window.location.href = '/src/pages/login.html'; } else { fetch(`http://localhost:5501/get-username?uid=${userId}`) .then(resp => resp.json()) diff --git a/src/favourite.js b/src/favourite.js index 4a97cb63..83758563 100644 --- a/src/favourite.js +++ b/src/favourite.js @@ -1,9 +1,19 @@ window.onload = () => { const userId = sessionStorage.getItem('userId'); if (!userId) { - window.location.href = '/src/login.html'; + window.location.href = '/src/pages/login.html'; } else { - fetch(`http://localhost:5501/api/user_restaurants?userID=${userId}`) + fetch(`http://localhost:5501/get-username?uid=${userId}`) + .then(resp => resp.json()) + .then(data => { + // Assuming 'data' has a 'username' property with the user's name + const username = data.username; + const usernameElement = document.querySelector('.user-disp'); + // Replace the placeholder text with the actual username + usernameElement.textContent = `Welcome Back, ${username}.`; + + return fetch(`http://localhost:5501/api/user_restaurants?userID=${userId}`) + }) .then(resp => resp.json()) .then(restaurants => { const container = document.querySelector('.row.justify-content-center'); // The container where the rows will be appended diff --git a/src/index.html b/src/index.html new file mode 100644 index 00000000..abbbdf32 --- /dev/null +++ b/src/index.html @@ -0,0 +1,67 @@ + + + + + + + + + + + What to Eat + + + + + + +
+
+
+
+
+

Chi-She-Mo

+

Simplify Food.

+ + + +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/src/landing.html b/src/landing.html deleted file mode 100644 index cefebe4c..00000000 --- a/src/landing.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - What to Eat - - - - - -
-
-
-
-
-

Chi-She-Mo

-

Simplify Food.

- - - -
-
-
-
- - - - - - \ No newline at end of file diff --git a/src/pages/about.html b/src/pages/about.html index ee882ba7..3ecd96fd 100644 --- a/src/pages/about.html +++ b/src/pages/about.html @@ -19,7 +19,7 @@
+
@@ -50,7 +51,7 @@

Chi_She_Mo

Hello {user},

Revisit your favourite restaurants here:

- +
@@ -77,6 +78,16 @@

Revisit your favourite restaurants here:

- + + + + \ No newline at end of file diff --git a/src/pages/home.html b/src/pages/home.html new file mode 100644 index 00000000..8095e63f --- /dev/null +++ b/src/pages/home.html @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + What to Eat + + + + + + + +
+
+
+

Welcome Back, {user}.

+

What shall we eat today?

+
+
+
+
+ + logo + +
+
+ + +
+
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+ +
+ +
+ + +
+ +
+
+ +

Here's what we found.

+
+
+ +
+
+
+
+ + Name + +
+ + Ratings: + 5.0 +
+
+
+
+
+ +
+
+
+
+ + Name + +
+ + Ratings: + 5.0 +
+
+
+
+
+ +
+
+
+
+ + Name + +
+ + Ratings: + 5.0 +
+
+
+
+
+ +
+
+
+
+ + Name + +
+ + Ratings: + 5.0 +
+
+
+
+
+ +
+
+
+
+ + Name + +
+ + Ratings: + 5.0 +
+
+
+
+
+ + +
+ + +
+
+
+
+
+ + + + + + + + + diff --git a/src/pages/index.html b/src/pages/index.html deleted file mode 100644 index 7bc98859..00000000 --- a/src/pages/index.html +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - - - - - What to Eat - - - - - - -
-
-
-

Welcome Back, {user}.

-

What shall we eat today?

-
-
-
-
- - logo - -
-
- -
-
-
-
- -
-
-
- - -
-
-
- -
-
- -
- -
- - -
- -
-
- -

Here's what we found.

-
-
- -
-
-
-
- - Name - -
- - Ratings: - 5.0 -
-
-
-
-
- -
-
-
-
- - Name - -
- - Ratings: - 5.0 -
-
-
-
-
- -
-
-
-
- - Name - -
- - Ratings: - 5.0 -
-
-
-
-
- -
-
-
-
- - Name - -
- - Ratings: - 5.0 -
-
-
-
-
- -
-
-
-
- - Name - -
- - Ratings: - 5.0 -
-
-
-
-
- - -
- - -
-
-
-
- - - - - - - - \ No newline at end of file diff --git a/src/pages/login.html b/src/pages/login.html index 87cbbae2..89ddc874 100644 --- a/src/pages/login.html +++ b/src/pages/login.html @@ -1,16 +1,16 @@ - - - - - - - - Login - + + + + + + + + Login + - + -
@@ -48,19 +47,17 @@

Login

-
Email
-
Password
-

Not a member? Sign Up here

+

Not a member? Sign Up here

@@ -69,17 +66,17 @@
Password
- - + - - + + +