Skip to content

Commit

Permalink
Add not able to vote on confirmation modal
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed Oct 22, 2024
1 parent 5af2740 commit 1010e38
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/components/Process/ConfirmVoteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,32 @@ export const ConfirmVoteModal = ({ elections, answers }: QuestionsConfirmationPr
</ModalHeader>
<ModalBody display='flex' flexDirection='column' gap={5} p={0} mb={2}>
<Text>{t('process.spreadsheet.confirm.description')}</Text>
{Object.values(elections).map(({ election, voted, isAbleToVote }) => {
{Object.values(elections).map(({ election, isAbleToVote }) => {

Check failure on line 20 in src/components/Process/ConfirmVoteModal.tsx

View workflow job for this annotation

GitHub Actions / build-stg

Argument of type '({ election, isAbleToVote }: { election: any; isAbleToVote: any; }) => Element' is not assignable to parameter of type '(value: unknown, index: number, array: unknown[]) => Element'.
const canAbstain =
election.resultsType.name === ElectionResultsTypeNames.MULTIPLE_CHOICE &&
election.resultsType.properties.canAbstain
const eAnswers = answers[election.id]
if (!isAbleToVote) {
return (
<Flex
flexDirection='column'
maxH='200px'
overflowY='scroll'
boxShadow='rgba(128, 128, 128, 0.42) 1px 1px 1px 1px'
px={2}
borderRadius='lg2'
>
<Box py={2}>
<Text fontWeight='bold' whiteSpace='nowrap' mb={1}>
{election.title.default}
</Text>
<Text fontWeight='bold' whiteSpace='nowrap' mb={1}>
{t('vote.not_able_to_vote')}
</Text>
</Box>
</Flex>
)
}
return (
<>
<Flex
Expand Down
1 change: 1 addition & 0 deletions src/i18n/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const translations = (t: TFunction<string, string>) => ({
voted_description: t('cc.vote.voted_description').toString(),
voted_description_multielection: t('cc.vote.voted_description_multielection').toString(),
voted_title: t('cc.vote.voted_title').toString(),
not_able_to_vote: t('cc.vote.not_able_to_vote').toString(),
},
empty: t('cc.empty').toString(),
errors: {
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"button_update": "Torna a enviar el vot",
"confirm": "Confirma les teves seleccions:",
"sign": "Signa abans de votar",
"not_able_to_vote": "No pots votar en aquest procés",
"voted_description": "Per verificar el teu vot, pots utilitzar aquesta identificació única: {{ id }}",
"voted_description_multielection": "Per verificar el teu vot, pots utilitzar aquestes identificacions úniques: {{ ids }}",
"voted_title": "El teu vot s'ha registrat amb èxit!"
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"button_update": "Reenviar voto",
"confirm": "Confirma tus selecciones:",
"sign": "Firma antes de votar",
"not_able_to_vote": "No puedes votar en este proceso",
"voted_description": "Para verificar tu voto, puedes utilizar este identificador único: {{ id }}",
"voted_description_multielection": "Para verificar tu voto, puedes utilizar estos identificadores únicos: {{ ids }}",
"voted_title": "¡Tu voto se ha registrado con éxito!"
Expand Down

0 comments on commit 1010e38

Please sign in to comment.