import Image from 'next/image'; import {useTranslation} from 'next-i18next'; import {CSSProperties, useEffect, useState} from 'react'; import {faArrowRight} from '@fortawesome/free-solid-svg-icons'; import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; import {Col, Container, Row} from 'reactstrap'; import Button from '@components/Button'; import Share from '@components/Share'; import ErrorMessage from '@components/Error'; import {BallotPayload, ErrorPayload} from '@services/api'; import {AppTypes, useAppContext} from '@services/context'; import {displayRef, getLocaleShort, isEnded} from '@services/utils'; import {getUrl, RouteTypes} from '@services/routes'; import Logo from './Logo'; import {FORM_FEEDBACK, MAJORITY_JUDGMENT_LINK} from '@services/constants'; import urne from '../public/urne.svg'; import star from '../public/star.svg'; import logo from '../public/logo-red-blue.svg'; import Link from 'next/link'; import {useRouter} from 'next/router'; export interface WaitingBallotInterface { ballot?: BallotPayload; error?: ErrorPayload; } const ButtonResults = ({election}) => { const {t} = useTranslation(); const router = useRouter(); const locale = getLocaleShort(router); if (!election.hideResults || isEnded(election.date_end)) { return (
); } else { return null; } }; const DiscoverMajorityJudgment = () => { const {t} = useTranslation(); return (
{t('vote.discover-mj')}

{t('vote.discover-mj-desc')}

{t('common.about')}
); }; const SupportBetterVote = () => { const {t} = useTranslation(); return (
{t('vote.support-better-vote')}

{t('vote.support-desc')}

{t('common.donation')}
); }; const Thanks = () => { const {t} = useTranslation(); return ( <>
{t('vote.thanks')}

{t('vote.form-desc')}

); }; const Info = ({ballot, error}: WaitingBallotInterface) => { const {t} = useTranslation(); const [ballotProperties, setBallot] = useState({ display: 'none', }); useEffect(() => { setTimeout(() => { setBallot({display: 'grid'}); }, 4500); }, []); if (!ballot) return null; if (error) { return {error.detail[0].msg}; } return (

{t('vote.success-ballot')}

); }; const AnimationBallot = () => { const [_, dispatch] = useAppContext(); const [urneProperties, setUrne] = useState({ width: 0, height: 0, marginBottom: 0, }); const [starProperties, setStar] = useState({ width: 0, height: 0, marginLeft: 100, marginBottom: 0, }); const [urneContainerProperties, setUrneContainer] = useState({ height: '100vh', }); useEffect(() => { dispatch({type: AppTypes.FULLPAGE, value: true}); setUrne((urne) => ({ ...urne, width: 300, height: 300, })); setTimeout(() => { setStar((star) => ({ ...star, width: 150, height: 150, marginLeft: -150, marginBottom: 300, })); }, 1000); setTimeout(() => { setUrneContainer((urneContainer) => ({ ...urneContainer, height: 250, })); setStar((star) => ({ ...star, width: 100, height: 100, marginLeft: -100, marginBottom: 200, })); setUrne((urne) => ({ ...urne, width: 200, height: 200, })); }, 3000); }, []); return (
urne
urne
); }; export default ({ballot, error}: WaitingBallotInterface) => { return ( ); };