Skip to content

Commit

Permalink
fix: new default value, rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Nomandes committed Dec 22, 2023
1 parent d2d66eb commit cf9b373
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function ImportRetroMenuItem() {
participants: {},
waitingList: {},
isVotingEnabled: false,
cardVotingLimit: Number.MAX_VALUE,
cardVotingLimit: 1,
timerStatus: TimerStatus.STOPPED,
timerDuration: 0,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export function ManageVotesDialog({ isOpen, close }: DialogProps) {
handleCardVotingLimitChanged,
} = useRetroContext();
const [voteCount, setVoteCount] = useState(retroState.maxVoteCount);
const [isVotingPerCardLimited, setIsVotingPerCardLimited] = useState(true);
const [isMaxVotesPerCardLimited, setIsMaxVotesPerCardLimited] = useState(
retroState.cardVotingLimit === 1
);

function handleCancel() {
setVoteCount(retroState.maxVoteCount);
Expand All @@ -39,13 +41,13 @@ export function ManageVotesDialog({ isOpen, close }: DialogProps) {
}

function handleVotingLimitChange(event: ChangeEvent<HTMLInputElement>) {
setIsVotingPerCardLimited(event.target.checked);
setIsMaxVotesPerCardLimited(event.target.checked);
}

function handleStart() {
handleChangeMaxVote(voteCount);
handleIsVotingEnabledChanged(true);
handleCardVotingLimitChanged(isVotingPerCardLimited ? 1 : Number.MAX_VALUE);
handleCardVotingLimitChanged(isMaxVotesPerCardLimited ? 1 : Number.MAX_VALUE);
close();
}

Expand Down Expand Up @@ -85,7 +87,9 @@ export function ManageVotesDialog({ isOpen, close }: DialogProps) {
Everybody has <strong>{voteCount}</strong> votes
</Typography>
<FormControlLabel
control={<Checkbox checked={isVotingPerCardLimited} onChange={handleVotingLimitChange} />}
control={
<Checkbox checked={isMaxVotesPerCardLimited} onChange={handleVotingLimitChange} />
}
label="Maximum one vote per card"
/>
</DialogContent>
Expand Down
1 change: 0 additions & 1 deletion packages/frontend/src/retro/context/RetroContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ export function RetroContextProvider(props: RetroContextProviderProps) {
}

function handleCardVotingLimitChanged(limit: number) {
console.log("Voting changed to ", limit);
dispatchAndBroadcast({ type: "CARD_VOTING_LIMIT_CHANGED", limit });
}

Expand Down

0 comments on commit cf9b373

Please sign in to comment.