Prevent voting when poll is locked

This commit is contained in:
Luke Vella 2022-05-12 13:16:06 +01:00
parent 46efb0fa48
commit 5f653ff593

View file

@ -72,7 +72,7 @@ const Poll: React.VoidFunctionComponent<PollProps> = ({ pollId }) => {
const [didUsePagination, setDidUsePagination] = React.useState(false);
const [shouldShowNewParticipantForm, setShouldShowNewParticipantForm] =
React.useState(!userAlreadyVoted);
React.useState(!userAlreadyVoted && !poll.closed);
const pollWidth =
sidebarWidth + options.length * columnWidth + actionColumnWidth;
@ -198,7 +198,7 @@ const Poll: React.VoidFunctionComponent<PollProps> = ({ pollId }) => {
) : null}
</div>
</div>
{shouldShowNewParticipantForm ? (
{shouldShowNewParticipantForm && !poll.closed ? (
<ParticipantRowForm
className="border-t bg-slate-100 bg-opacity-0"
onSubmit={(data) => {