-
Notifications
You must be signed in to change notification settings - Fork 1
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
v1 #42
base: main
Are you sure you want to change the base?
v1 #42
Conversation
so for the user id i set the local storage test email manually because my google Oauth does not work and i cant test completely in a user setting, so please verify if this works. Thank you! |
@@ -16,6 +17,8 @@ function App() { | |||
<Router> | |||
<Routes> | |||
<Route path='/' element={<Home/>} /> | |||
<Route path='/activities' element={<Activities/>} /> |
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.
Shouldn't be needed since everything is in the preferences route.
web/meetup-facilitator/src/App.jsx
Outdated
@@ -16,6 +17,8 @@ function App() { | |||
<Router> | |||
<Routes> | |||
<Route path='/' element={<Home/>} /> | |||
<Route path='/activities' element={<Activities/>} /> | |||
<Route path='/recommendation' element={<Recommendation/>}/> |
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.
Will need to make it /recommendation:group_id
like the others so we can pass through useParams()
.
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.
Additionally let's make it plural recommendations
to be consistent with the other pages. Together /recommendations/:group_id
@@ -59,7 +59,7 @@ function Preferences() { | |||
// TODO: make post request | |||
|
|||
|
|||
navigate('/'); | |||
navigate('/recommendation'); |
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.
Then this can be changed to /recommendation/${group_id}
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.
Additionally, let's make it plural recommendations
to be consistent with the other pages.
Couldn't test the actual recommendation returns but I trust that it works fine as you showed. The flow of the routes seems fine barring the missing url parameters. I noticed the extra links on the home page, which I'm guessing are there just from testing? But some link to routes that ultimately shouldn't exist (i.e., any of the individual preference components). |
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 job on this page! I have a number of comments but they should all be quick fixes. I noticed that during merging with main you might've overridden some of the API files, we'll need to remove those changes by resetting the branch to a previous commit, merging with main again while ensuring the overriding doesn't happen again, and then applying the latest changes again. We can do it together later.
@@ -59,7 +59,7 @@ function Preferences() { | |||
// TODO: make post request | |||
|
|||
|
|||
navigate('/'); | |||
navigate('/recommendation'); |
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.
Additionally, let's make it plural recommendations
to be consistent with the other pages.
web/meetup-facilitator/src/main.jsx
Outdated
import './index.css'; | ||
|
||
const apiKey ="AIzaSyABQ4Pci5rnkud1UShQlNtU7iGG7waWghU" |
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.
apiKey
needs to be removed and turned to an environment variable.
web/meetup-facilitator/src/main.jsx
Outdated
// If API key is available, dynamically load Google Maps API | ||
const script = document.createElement('script'); | ||
script.src = `https://maps.googleapis.com/maps/api/js?key=AIzaSyABQ4Pci5rnkud1UShQlNtU7iGG7waWghU&libraries=places`; | ||
script.async = true; | ||
script.defer = true; | ||
|
||
script.onload = renderApp; // Render the app once the Google Maps API script has loaded | ||
|
||
document.head.appendChild(script); |
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'm a little confused as to why we're using 2 different methods to load the Google Maps API throughout the app. Couldn't we have reused the same method we used for location preferences? Let's leave it for now though for the sake of time.
}; | ||
|
||
// Perform an API request to save the vote | ||
fetch(import.meta.env.VITE_SERVER + `groups/${group_id}/votes`, { |
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.
Let's end all the API calls with a slash /
for consistency and compatibility.
rec_id: { | ||
recommendation_id: selectedRecommendation.id, | ||
selected_time: selectedTime, | ||
}, | ||
user_id: userdata, | ||
group_id: group_id, |
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.
rec_id
is just the id of the recommendation, so selectedRecommendation.id
, and user_id
should be userdata.user_id
. We don't need to pass the group_id
since it's given in the URL. I had forgotten about the time in the Votes model, thanks for noticing, we will need to make a new field for it in the API model. Overall I think we only need rec_id
, selected_time
, and user_id
.
}) | ||
.then((response) => response.json()) | ||
.then((json) => { | ||
setRecommendations(json); |
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.
When parsing the json recommendations, I'm afraid it doesn't parse recursively, so the times
json array doesn't get parsed to an array and remains as a string. For this reason, we'll have to manually parse all the times
fields.
json.map((rec) => {
rec.times = JSON.parse(rec.times);
});
Something like this before setting the recommendations should do it.
web/meetup-facilitator/src/App.jsx
Outdated
@@ -16,6 +17,8 @@ function App() { | |||
<Router> | |||
<Routes> | |||
<Route path='/' element={<Home/>} /> | |||
<Route path='/activities' element={<Activities/>} /> | |||
<Route path='/recommendation' element={<Recommendation/>}/> |
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.
Additionally let's make it plural recommendations
to be consistent with the other pages. Together /recommendations/:group_id
No description provided.