import {useTranslation} from "next-i18next"; import {useState} from "react"; import { faExclamationTriangle, faCheck, } from "@fortawesome/free-solid-svg-icons"; import {Button, Modal, ModalHeader, ModalBody, ModalFooter} from "reactstrap"; import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; const ConfirmModal = ({tabIndex, title, candidates, grades, isTimeLimited, start, finish, emails, restrictResult, className, confirmCallback}) => { const [visibled, setVisibility] = useState(false); const {t} = useTranslation(); const toggle = () => setVisibility(!visibled) return (
{t("Confirm your vote")}
{t("Question of the election")}
{title}
{t("Candidates/Proposals")}
    {candidates.map((candidate, i) => { if (candidate.label !== "") { return (
  • {candidate.label}
  • ); } else { return
  • ; } })}
{t("Dates")}
{t("The election will take place from")}{" "} {start.toLocaleDateString()}, {t("at")}{" "} {start.toLocaleTimeString()} {" "} {t("to")}{" "} {finish.toLocaleDateString()}, {t("at")}{" "} {finish.toLocaleTimeString()}
{t("Grades")}
{grades.map((mention, i) => { return i < grades.length ? ( {mention.label} ) : ( ); })}
{t("Voters' list")}
{emails.length > 0 ? ( emails.join(", ") ) : (

{t("The form contains no address.")}
{t( "The election will be opened to anyone with the link" )}

)}
{restrictResult ? (
{t("Results available at the close of the vote")}

{t( "The results page will not be accessible until the end date is reached." )}{" "} ({finish.toLocaleDateString()} {t("at")}{" "} {finish.toLocaleTimeString()})

) : (
{t("Results available at any time")}
)}
) } export default ConfirmModal