From 7f2ed9f4c2342c75f6434f609284b65e6ca81a36 Mon Sep 17 00:00:00 2001 From: Clement G Date: Sat, 2 May 2020 16:43:13 +0200 Subject: [PATCH] feat(create-election-success) : improve layout/ux and add tool for send by mail (front only) --- public/locale/i18n/fr/resource.json | 9 ++- src/components/CopyField.jsx | 17 +++- src/components/banner/Facebook.jsx | 29 +++++++ src/components/views/CreateSuccess.jsx | 107 +++++++++++++++---------- 4 files changed, 116 insertions(+), 46 deletions(-) create mode 100644 src/components/banner/Facebook.jsx diff --git a/public/locale/i18n/fr/resource.json b/public/locale/i18n/fr/resource.json index 04965b0..4a26ee6 100644 --- a/public/locale/i18n/fr/resource.json +++ b/public/locale/i18n/fr/resource.json @@ -94,5 +94,12 @@ "Results available at the close of the vote": "Résultats disponibles à la clôture du vote", "The results page will not be accessible until all participants have voted.":"La page de résultats ne sera pas accessible tant que tous les participants n'auront pas voté.", "The results page will not be accessible until the end date is reached.": "La page de résultats ne sera pas accessible tant que la date de fin ne sera pas atteinte.", - "No one will be able to see the result until the end date is reached or until all participants have voted.": "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é." + "No one will be able to see the result until the end date is reached or until all participants have voted.": "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é.", + "Send me this link" : "Envoyez moi ce lien", + "Send me these links" : "Envoyez moi ces liens", + "Open" : "Ouvrir", + "Voting address" : "Adresse du vote", + "Results address" : "Adresse des résultats", + "Share election Facebook" : "Partager le vote sur Facebook" + } diff --git a/src/components/CopyField.jsx b/src/components/CopyField.jsx index 7f45127..0baf445 100644 --- a/src/components/CopyField.jsx +++ b/src/components/CopyField.jsx @@ -16,7 +16,7 @@ const CopyField = props => { document.execCommand("copy"); }; - const { t, value, icon } = props; + const { t, value, iconCopy, iconOpen } = props; return (
@@ -31,14 +31,25 @@ const CopyField = props => {
+
+ + + {t("Open")} + +
); }; diff --git a/src/components/banner/Facebook.jsx b/src/components/banner/Facebook.jsx new file mode 100644 index 0000000..e710a23 --- /dev/null +++ b/src/components/banner/Facebook.jsx @@ -0,0 +1,29 @@ +/* eslint react/prop-types: 0 */ +import React from "react"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faFacebookSquare } from "@fortawesome/free-brands-svg-icons"; + +const Facebook = props => { + const handleClick = () => { + const url = + "https://www.facebook.com/sharer.php?u=" + + props.url + + "&t=" + + props.title; + window.open( + url, + "", + "menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700" + ); + }; + return ( + + ); +}; + +export default Facebook; + +//i diff --git a/src/components/views/CreateSuccess.jsx b/src/components/views/CreateSuccess.jsx index 49aafe4..23a4a3a 100644 --- a/src/components/views/CreateSuccess.jsx +++ b/src/components/views/CreateSuccess.jsx @@ -1,16 +1,17 @@ /* eslint react/prop-types: 0 */ import React, { Component } from "react"; import { Col, Container, Row } from "reactstrap"; -import { Link } from "react-router-dom"; -import { withTranslation, Trans } from "react-i18next"; +import { withTranslation } from "react-i18next"; import { faCopy, - faUsers, - faExclamationTriangle + faExclamationTriangle, + faPaperPlane, + faExternalLinkAlt } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { AppContext } from "../../AppContext"; import CopyField from "../CopyField"; +import Facebook from "../banner/Facebook"; class CreateSuccess extends Component { static contextType = AppContext; @@ -44,58 +45,80 @@ class CreateSuccess extends Component { ) : ( <> -

- {t("You can now share the election link to participants:")} -

- +

{t("Voting address")}

+ ); - return (

{t("Successful election creation!")}

- - {electionLink} - -

- {t("Here is the link for the results in real time:")} -

- + {this.props.invitationOnly ? null : ( + + )}
- -
-

- - {t("Keep these links carefully")} -

-

- - Warning: you will have no other choices to recover the - links, and we will not be able to share them with you. For - example, you can bookmark them in your browser. - -

+ + {electionLink} + +

{t("Results address")}

+ +
+ + {t("Keep these links carefully")} +
+ + {/*
+ + +
*/} - - - - - {t("Participate now!")} - - + );