Skip to content

Commit

Permalink
voting modal
Browse files Browse the repository at this point in the history
  • Loading branch information
gerouvi committed May 28, 2024
1 parent 3b43233 commit c3fd746
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/components/Process/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const ProcessHeader = () => {
h1: <Text as='h1' color='#FF6320' fontSize='32px' fontWeight='extrabold' mt={10} />,
}}
/>
{!voted && <Text>Tria individualment els candidats que vols votar, o bé, vota en blanc.</Text>}
{!voted && <Text>{t('process.helper_candidates')}</Text>}
</Flex>
</Box>
</Box>
Expand Down
53 changes: 43 additions & 10 deletions src/components/Process/View.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { Box, Link, Text } from '@chakra-ui/react'
import { Box, Link, Modal, ModalBody, ModalContent, ModalOverlay, Spinner, Text, VStack } from '@chakra-ui/react'
import { Wallet } from '@ethersproject/wallet'
import { QuestionsFormProvider } from '@vocdoni/chakra-components'
import { useClient, useElection } from '@vocdoni/react-providers'
import { ArchivedElection, VocdoniSDKClient } from '@vocdoni/sdk'
import { useEffect } from 'react'
import { Trans, useTranslation } from 'react-i18next'
import { ConfirmVoteModal } from './ConfirmVoteModal'
import Header from './Header'
import { Questions } from './Questions'
import { SuccessVoteModal } from './SuccessVoteModal'

export const ProcessView = () => {
const { connected, election, client: electionClient, setClient: setElectionClient, voted } = useElection()
const {
connected,
election,
client: electionClient,
setClient: setElectionClient,
voted,
loading: { voting },
} = useElection()
const { env, setClient, client, setSigner } = useClient()

const shouldRender = !(election instanceof ArchivedElection)
Expand Down Expand Up @@ -65,21 +73,46 @@ export const ProcessView = () => {
{voted && (
<Box mb={20}>
<Text textAlign='center' mb={5}>
Ajuda'ns a conèixer-te millor!{' '}
<Link href='https://form.jotform.com/241433006383347' target='_blank' color='#FF6320'>
respon aquestes preguntes
</Link>
<Trans
i18nKey='process.omnium_link.you_know'
components={{
link: <Link href='https://form.jotform.com/241433006383347' target='_blank' color='#FF6320' />,
}}
/>
</Text>

<Text textAlign='center'>
Inscriu-te a l'Assemblea General de Valls{' '}
<Link href='https://form.jotform.com/241163398249362' target='_blank' color='#FF6320'>
aquí
</Link>
<Trans
i18nKey='process.omnium_link.assembly'
components={{
link: <Link href='https://form.jotform.com/241163398249362' target='_blank' color='#FF6320' />,
}}
/>
</Text>
</Box>
)}
<VotingVoteModal />
<SuccessVoteModal />
</>
)
}
const VotingVoteModal = () => {
const { t } = useTranslation()
const {
loading: { voting },
} = useElection()

return (
<Modal isOpen={voting} onClose={() => {}}>
<ModalOverlay />
<ModalContent>
<VStack>
<Spinner color='#FF6320' mb={5} w={10} h={10} />
</VStack>
<ModalBody>
<Text>{t('process.voting')}</Text>
</ModalBody>
</ModalContent>
</Modal>
)
}
20 changes: 11 additions & 9 deletions src/i18n/locales/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"confirm": "Confirma les teves seleccions:",
"sign": "Signa abans de votar",
"voted_description": "Per verificar el teu vot, pots utilitzar aquesta identificació única: {{ id }}",
"voted_title": "El teu vot ha estat registrat correctament. Els resultats electorals es coneixeran el 28 de juny durant l’Assemblea General a Valls."
"voted_title": "Els resultats electorals es coneixeran el 28 de juny durant l’Assemblea General a Valls."
}
},
"copy": {
Expand Down Expand Up @@ -107,8 +107,7 @@
},
"menu": {
"burger_aria_label": "menú d'usuari",
"connect": "Connectar",
"logout": "Tancar sessió"
"connect": "Connectar"
},
"process": {
"census_strategies": {
Expand Down Expand Up @@ -136,21 +135,24 @@
"one_of_them": "(Almenys un d'ells)"
},
"helper": "Un cop completat, recordeu prémer el botó “Finalitzar la votació” que es troba al final d’aquesta pàgina i confirmeu l’elecció.",
"helper_candidates": "Tria individualment els candidats que vols votar, o bé, vota en blanc.",
"helper_error_one": "Has de contestar totes les votacions per poder finalitzar el procés. N'has respost {{ count }} de {{ count2 }}",
"helper_error_many": "Has de contestar totes les votacions per poder finalitzar el procés. N'has respost {{ count }} de {{ count2 }}",
"helper_error_other": "Has de contestar totes les votacions per poder finalitzar el procés. N'has respost {{ count }} de {{ count2 }}",
"is_invalid": "Aquest procés té dades no vàlides i per tant no pot carregar-se",
"mark_all": "Votar tota la llista Òmnium 2026",
"omnium_link": {
"assembly": "Inscriu-te a l'Assemblea General de Valls <link>aquí</link>",
"you_know": "Ajuda'ns a conèixer-te millor! <link>respon aquestes preguntes</link>"
},
"share_title": "Comparteix a {{ network }}",
"spreadsheet": {
"confirm": {
"abstain_count_one": "",
"abstain_count_many": "",
"abstain_count_other": "",
"blank_vote": "",
"header": "Confirma el teu vot",
"description": "Estas a un pas de finalitzar la teva votació. Aquestes són les opcions que has triat:",
"option": "<strong>Opció:</strong> {{ answer }}",
"options": "<strong>Selecció:</strong> {{ answers }}",
"header": "Confirma el teu vot",
"question": "<strong><span>{{ question }}</span>:</strong> {{ answer }}"
}
},
Expand All @@ -162,11 +164,11 @@
"upcoming": "Previst"
},
"success_modal": {
"btn": "Finalitzar",
"text": "<p>El teu vot ha estat registrat correctament</p><p>Ajuda'ns a conèixer-te millor!</p>",
"title": "Vot emès correctament!"
},
"voters": "Votants"
"voters": "Votants",
"voting": "Estem processant el teu vot. Aquest procés trigarà uns segons. Si us plau, no actualitzis aquesta pàgina."
},
"process_actions": {
"cancel": "Cancel·la",
Expand Down
17 changes: 10 additions & 7 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@
},
"menu": {
"burger_aria_label": "menú de usuario",
"connect": "Conectar",
"logout": "Cerrar sesión"
"connect": "Conectar"
},
"process": {
"census_strategies": {
Expand Down Expand Up @@ -136,20 +135,24 @@
"one_of_them": "(Al menos uno de ellos)"
},
"helper": "Una vez completado, recuerden presionar el botón 'Finalizar la votación' que se encuentra al final de esta página y confirmar la elección.",
"helper_candidates": "",
"helper_error_one": "Has de contestar todas las votaciones para poder finalizar el proceso. Has respondido {{count}} de {{count2}}.",
"helper_error_many": "Has de contestar todas las votaciones para poder finalizar el proceso. Has respondido {{count}} de {{count2}}.",
"helper_error_other": "Has de contestar todas las votaciones para poder finalizar el proceso. Has respondido {{count}} de {{count2}}.",
"is_invalid": "Este proceso tiene datos no válidos y no se puede cargar",
"mark_all": "Votar tota la llista Òmnium 2026",
"omnium_link": {
"assembly": "",
"you_know": ""
},
"share_title": "Compartir en {{ network }}",
"spreadsheet": {
"confirm": {
"abstain_count_one": "",
"abstain_count_many": "",
"abstain_count_other": "",
"blank_vote": "",
"description": "Confrima tu voto",
"option": "<strong>Opción {{ number }}:</strong> {{ answer }}",
"options": "<strong>Selección:</strong> {{ answers }}",
"header": "",
"question": "<strong>Pregunta {{ number }}:</strong> {{ answer }}"
}
},
Expand All @@ -161,11 +164,11 @@
"upcoming": "Próximo"
},
"success_modal": {
"btn": "Finalizar",
"text": "<p>Gracias por tu voto. Vuelve a la página principal para seguir y consultar los resultados finales cuando estén disponibles.</p>",
"title": "Voto emitido correctamente!"
},
"voters": "Votantes"
"voters": "Votantes",
"voting": ""
},
"process_actions": {
"cancel": "Cancelar proceso",
Expand Down

1 comment on commit c3fd746

@github-actions
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.