mirror of
https://github.com/siv-org/siv.git
synced 2026-05-03 03:00:59 -04:00
/vote submitted: respect type: 'ranked-choice-irv' in Unlocked & Encrypted widgets
This commit is contained in:
@@ -6,13 +6,15 @@ import { Label, TitleDescriptionQuestion } from './Item'
|
||||
import { Item as ItemType } from './storeElectionInfo'
|
||||
import { State } from './vote-state'
|
||||
|
||||
export const defaultRankingsAllowed = 3
|
||||
|
||||
export const RankedChoiceItem = ({
|
||||
description,
|
||||
dispatch,
|
||||
id = 'vote',
|
||||
options,
|
||||
question,
|
||||
rankings_allowed = 4,
|
||||
rankings_allowed = defaultRankingsAllowed,
|
||||
state,
|
||||
title,
|
||||
}: ItemType & {
|
||||
|
||||
@@ -3,6 +3,7 @@ import { flatten } from 'lodash-es'
|
||||
import Link from 'next/link'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
import { defaultRankingsAllowed } from '../RankedChoiceItem'
|
||||
import { State } from '../vote-state'
|
||||
import { DetailedEncryptionReceipt } from './DetailedEncryptionReceipt'
|
||||
import { EncryptedVote } from './EncryptedVote'
|
||||
@@ -21,15 +22,15 @@ export function SubmittedScreen({
|
||||
// Widen the page for the tables
|
||||
useEffect(() => {
|
||||
const mainEl = document.getElementsByTagName('main')[0]
|
||||
if (mainEl) {
|
||||
mainEl.style.maxWidth = '880px'
|
||||
}
|
||||
if (mainEl) mainEl.style.maxWidth = '880px'
|
||||
})
|
||||
|
||||
const columns = flatten(
|
||||
state.ballot_design?.map(({ id, multiple_votes_allowed }) => {
|
||||
return multiple_votes_allowed
|
||||
? new Array(multiple_votes_allowed).fill('').map((_, index) => `${id || 'vote'}_${index + 1}`)
|
||||
state.ballot_design?.map(({ id, multiple_votes_allowed, type }) => {
|
||||
return multiple_votes_allowed || type === 'ranked-choice-irv'
|
||||
? new Array(multiple_votes_allowed || defaultRankingsAllowed)
|
||||
.fill('')
|
||||
.map((_, index) => `${id || 'vote'}_${index + 1}`)
|
||||
: id || 'vote'
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user