-
Notifications
You must be signed in to change notification settings - Fork 27
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 checkbox to ballot for reading instructions #410
Conversation
{votingMethod == 'STAR_PR' && <StarPRBallotView/>} | ||
{votingMethod == 'Plurality' && <PluralityBallotView/>} | ||
{(votingMethod == 'RankedRobin' || votingMethod == 'IRV') && <RankedBallotView/>} | ||
{votingMethod == 'Approval' && <ApprovalBallotView/>} |
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.
Nice, looks much cleaner
const { id } = useParams(); | ||
const [pages, setPages] = useState(makePages()) | ||
const navigate = useNavigate(); | ||
const [currentPage, setCurrentPage] = useState(0) | ||
|
||
const setInstructionsRead = () => { | ||
pages[currentPage].instructionsRead = true; |
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.
How does this work? pages should be immutable as a state
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.
Yeah, that operation alone won't trigger a refresh so that's why I call setPages
It's a bit hacky, but the alternative is to have a separate useState where I represent instructionsRead as an array and I'd need to do the same trick anyway
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.
Looks good!
Description
Screenshots / Videos (frontend only)
2023-12-08.13-59-46.mp4
Related Issues
fixes #405