From f2459e7886e292f96df0f16de1feacdd7057a32e Mon Sep 17 00:00:00 2001 From: jimmys-box <89916651+jimmys-box@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:56:49 +0100 Subject: [PATCH] dev: --- pages/new/index.js | 317 ++++++++++++++++++++++++++++++++++++-- styles/scss/_newVote.scss | 33 ++++ 2 files changed, 338 insertions(+), 12 deletions(-) diff --git a/pages/new/index.js b/pages/new/index.js index 7062d54..6b71f82 100644 --- a/pages/new/index.js +++ b/pages/new/index.js @@ -15,6 +15,7 @@ import { Button, Card, CardBody, + Modal, ModalHeader, ModalBody, CustomInput } from "reactstrap"; import { ReactMultiEmail, isEmail } from "react-multi-email"; import "react-multi-email/style.css"; @@ -28,6 +29,7 @@ import { faCheck, faCogs, faExclamationTriangle, + faArrowLeft } from "@fortawesome/free-solid-svg-icons"; import { useAppContext } from "@services/context"; import { createElection } from "@services/api"; @@ -37,7 +39,7 @@ import Loader from "@components/wait"; import CandidatesField from "@components/form/CandidatesField"; import ConfirmModal from "@components/form/ConfirmModal"; import config from "../../next-i18next.config.js"; -import Modal from '../../components/Modal' + // Error messages const AT_LEAST_2_CANDIDATES_ERROR = "Please add at least 2 candidates."; @@ -190,7 +192,8 @@ const CreateElection = (props) => { } ); }; - + const [visibled, setVisibility] = useState(false); + const toggle = () => setVisibility(!visibled) const handleSendNotReady = (msg) => { toast.error(t(msg), { position: toast.POSITION.TOP_CENTER, @@ -231,15 +234,12 @@ const CreateElection = (props) => {

Confirmation

- + - - - @@ -299,13 +299,306 @@ const CreateElection = (props) => { + + + + + + +
Retour aux candidats
+ + + + +

Les candidats

+ + + +

Paramètres du vote

+ + + +

Confirmation

+ + +
+
+ +
+ + + + + +

Personne ne pourra voir le résultat tant que la date de fin n’est pas atteinte ou que tous les participants n’ont pas voté.

+ + + {/* */} + + + {/* + + */} +
+
+ + + + + + + + + + + +
+ + + - {t("Starting date")} + + + { + setStart( + new Date( + timeMinusDate(start) + + new Date(e.target.valueAsNumber).getTime() + ) + ); + }} + /> + + + + + + + + + - {t("Ending date")} + + + { + setFinish( + new Date( + timeMinusDate(finish) + + new Date(e.target.valueAsNumber).getTime() + ) + ); + }} + /> + + + + + +
+
+ + + {t("Grades")} + + + + + + + {t( + "You can select here the number of grades for your election" + )} +
+ {t("For example:")}{" "} + + {" "} + {t("5 = Excellent, Very good, Good, Fair, Passable")} + +
+ + + {grades.map((mention, i) => { + return ( + + {mention.label} + + ); + })} + +
+
+ + + {t("Participants")} + + + { + return isEmail(email); // return boolean + }} + getLabel={(email, index, removeEmail) => { + return ( +
+ {email} + removeEmail(index)} + > + × + +
+ ); + }} + /> +
+ + {t( + "If you list voters' emails, only them will be able to access the election" + )} + +
+ +
+
+
+
- + @@ -328,7 +621,7 @@ const CreateElection = (props) => { - + {/* @@ -580,7 +873,7 @@ const CreateElection = (props) => { -
+
*/}
@@ -601,10 +894,10 @@ const CreateElection = (props) => { confirmCallback={handleSubmit} /> ) : ( - - + + {t("Confirm")} - + )}
diff --git a/styles/scss/_newVote.scss b/styles/scss/_newVote.scss index e328661..b006013 100644 --- a/styles/scss/_newVote.scss +++ b/styles/scss/_newVote.scss @@ -229,6 +229,39 @@ input[type="file"] { display: flex; align-content: center; } +.settings-modal { + background-color: #17048e; + background-image: url('/back.svg'); + max-width: 100vw; + height: 100%; + margin: 0; + padding: 0px; +} +.settings-modal .modal-content { + background: transparent; +} +.settings-modal-body { + background: white; + width: 80%; + margin: auto; +} +.settings-modal-body .col { + margin: auto; +} +.custom-switch { +text-align: right; +} +.modal.fade .modal-dialog { + transition: none; +} +.fade { + + transition: none; +} +.btn-return-candidates { + color: white; + cursor: pointer; +} @media screen and (max-width: 619px) { .stepForm { width: auto;