-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add boardgames, lecture proposal form, dark mode #13
base: develop
Are you sure you want to change the base?
Conversation
…inside the container
queryKey: [zosiaApiRoutes.addLectureDurations, lectureType], | ||
queryFn: async ({ queryKey }) => { | ||
const lecture = queryKey[1]; | ||
if (lecture === "") { |
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.
We should validate outside of the query function; the query function is only for calling an API.
const lecture = queryKey[1]; | ||
if (lecture === "") { | ||
return Promise.resolve<LectureDurations>({ | ||
durations: ["Please choose lecture type first!"], |
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.
That is especially weird because, in fact, we have an error, and outside of it, we think it is a valid response
|
||
const onCheckboxChange = (boardGameId: number, checked: boolean) => { | ||
if (checked) { | ||
setVotes([...votes, boardGameId]); |
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.
Theoretically, it would be better to use functional setState in both cases, it may cause less bugs
setVotes([...votes, boardGameId]); | |
setVotes(oldVotes => ([...oldVotes, boardGameId])); |
} | ||
}; | ||
|
||
const isVoteLimitReached = votes.length >= 3; |
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.
Is this also validated on backend?
* This approach is inspired by this blogpost: | ||
* https://hangindev.com/blog/avoid-flash-of-default-theme-an-implementation-of-dark-mode-in-react-app | ||
*/ | ||
export const themeInitScript = ` |
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 not a fan of this approach. Isn't file app/server/templates/base.html
the one to which we will inject this code? Can't we add this code there?
This PR contains: