-
Notifications
You must be signed in to change notification settings - Fork 6
Election pages #88
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
base: main
Are you sure you want to change the base?
Election pages #88
Conversation
|
This looks awesome so far!
100%! I have a list of API endpoints from sean's PR, which I'll be adding to. But if you feel that an endpoint should exist, feel free to assume it exists & ask me for it.
Oh heck. There's a configuration in webpack that should address this issue if I recall correctly. I hope this isn't related to what you mentioned before about your ubuntu version not working nicely with webpack... I'll look into this & update you if I find anything!
For developing the backend, I'll be loading the database with mock data for my own testing. For developing the frontend, you'll want to write functions that don't actually make any web requests, but which respond with up-to-date data. The idea is that your mock data will be pretty low effort & you'll be able to confirm most of the behaviour of the application without being blocked by the backend working. After the backend is working, I'll have loaded some mock data into the db for testing, with which you can actually introduce the API calls. |
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.
lgtm!
So I got some JSON data from chat gpt and I tried to use the fields as specified in the database schema
Snippets from the JSON file |
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.
Sorry for the delay in reviewing! Feel free to annoy me and I'll happily throw you a review.
The pages all look really nice! The only important change is that multiple elections can be registered for at the same time.
An fyi that speeches will eventually be stored in html, but that's a problem for future us :)
if (userInfoStr) { | ||
setUserInfo(JSON.parse(userInfoStr)); | ||
} | ||
}, 100); // 100ms to let Page load login info |
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.
what's this 100ms wait for? I'd assume session storage doesn't need a timeout to be accessed?
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 copied it from the Profile page lol. Regardless, it's not needed here because the /register
page also deals with that. I'll remove it.
src/main/index.js
Outdated
@@ -25,7 +29,8 @@ const router = createHashRouter([ | |||
|
|||
{ path: '/about_elections', element: <AboutElections /> }, | |||
{ path: '/past_elections', element: <PastElections /> }, | |||
{ path: '/past_elections/:slug', element: <ElectionInfo /> } | |||
{ path: '/past_elections/:slug', element: <ElectionInfo /> }, | |||
{ path: '/register', element: <Register /> } |
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.
It's possible for multiple elections to exist at once. Right now there's actually the general & sfss council rep elections going on. Could we make it so that registering is elections/:slug/register
?
In this case, we'd also want to change the URL from /past_elections/
to /elections/
.
The backend will deal with the complexity of there being multiple elections run at once; you should just have to call the endpoints using the current election's slug.
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 think you reviewed outdated files. I already implemented the changes you suggested lol.
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.
so when the frontend calls for old election data, assuming the backend will sort elections in order and only send previous elections? Because I added some extra booleans in the json data to mimic that ( just for testing).
Will the endpoint only send previous elections or will it also include currently in progress ones?
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.
It's possible for multiple elections to exist at once. Right now there's actually the general & sfss council rep elections going on. Could we make it so that registering is elections/:slug/register?
Should this be linked through the list of elections? Like the list that contains old elections will also contain the currently in progress ones, but only let users register when they click on them?
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 the endpoint only send previous elections or will it also include currently in progress ones?
Up to you! You can give me whatever requests you think are easiest. I'd imagine we include all elections, including in-progress ones. However, we'd probably include a property in the json that says what stage an election is at (ended, voting, registration) so the frontend can display the information however you wish.
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.
only let users register when they click on them?
there will be a backend endpoint that looks something like POST /api/elections/:slug/register
, and a frontend page /elections/:slug/register
I imagine that when someone navigates to the election page /elections/:slug/register
you first check the endpoint GET /api/elections/:slug/info
, then display "sorry this election is no longer accepting nominations" if the election is no longer in the registration period. The result of the info
endpoint will say what the status of the election is.
added some mock elections to implement registration
Thought I'd make a draft of what I have so far:
register
andvote
(they dont point anywhere else, yet)