Skip to content
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

Merged
merged 11 commits into from
Dec 9, 2023

Conversation

ArendPeter
Copy link
Member

Description

  • Added checkbox to ballot
  • Blur instructions when box isn't checked
  • Changed bubbles to ovals
  • Created a BallotContext

Screenshots / Videos (frontend only)

2023-12-08.13-59-46.mp4

Related Issues

fixes #405

frontend/src/components/Election/Voting/VotePage.tsx Outdated Show resolved Hide resolved
frontend/src/components/Election/Voting/VotePage.tsx Outdated Show resolved Hide resolved
{votingMethod == 'STAR_PR' && <StarPRBallotView/>}
{votingMethod == 'Plurality' && <PluralityBallotView/>}
{(votingMethod == 'RankedRobin' || votingMethod == 'IRV') && <RankedBallotView/>}
{votingMethod == 'Approval' && <ApprovalBallotView/>}
Copy link
Collaborator

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;
Copy link
Collaborator

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

Copy link
Member Author

@ArendPeter ArendPeter Dec 8, 2023

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

Copy link
Collaborator

@mikefranze mikefranze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@ArendPeter ArendPeter merged commit 9530747 into Equal-Vote:main Dec 9, 2023
3 checks passed
@ArendPeter ArendPeter deleted the checkbox branch December 9, 2023 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement ballot checkbox
2 participants