diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..e2432ed --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,26 @@ +{ + "env": { + "browser": true, + "es6": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended" + ], + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" + }, + "parserOptions": { + "ecmaFeatures": { + "jsx": true + }, + "ecmaVersion": 2018, + "sourceType": "module" + }, + "plugins": [ + "react" + ], + "rules": { + } +} \ No newline at end of file diff --git a/src/App.jsx b/src/App.jsx index 3d27c78..f934cd1 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,19 +1,19 @@ -import React from 'react'; +import React from "react"; -import Routes from './Routes'; -import Header from './components/layouts/Header'; -import Footer from './components/layouts/Footer'; -import AppContextProvider from './AppContext'; +import Routes from "./Routes"; +import Header from "./components/layouts/Header"; +import Footer from "./components/layouts/Footer"; +import AppContextProvider from "./AppContext"; function App() { return ( - -
-
- -
-
+ +
+
+ +
+
); } diff --git a/src/AppContext.jsx b/src/AppContext.jsx index 37c11ba..ac40b6c 100644 --- a/src/AppContext.jsx +++ b/src/AppContext.jsx @@ -1,7 +1,6 @@ import React, { createContext, Suspense } from "react"; -import {BrowserRouter as Router} from 'react-router-dom'; -import Loader from './components/loader'; - +import { BrowserRouter as Router } from "react-router-dom"; +import Loader from "./components/loader"; export const AppContext = createContext(); @@ -16,12 +15,12 @@ const AppContextProvider = ({ children }) => { } }; return ( - } > - - - {children} - - + }> + + + {children} + + ); }; diff --git a/src/Routes.jsx b/src/Routes.jsx index 60ca18e..5ba8853 100644 --- a/src/Routes.jsx +++ b/src/Routes.jsx @@ -10,7 +10,6 @@ import UnknownElection from "./components/views/UnknownElection"; import CreateSuccess from "./components/views/CreateSuccess"; import VoteSuccess from "./components/views/VoteSuccess"; - function Routes() { return (
@@ -19,8 +18,18 @@ function Routes() { - } /> - } /> + ( + + )} + /> + ( + + )} + /> diff --git a/src/Util.jsx b/src/Util.jsx index e4b800d..3b55945 100644 --- a/src/Util.jsx +++ b/src/Util.jsx @@ -1,34 +1,26 @@ -import i18n from './i18n.jsx'; +import i18n from "./i18n.jsx"; const colors = [ - '#015411', - '#019812', - '#6bca24', - '#ffb200', - '#ff5d00', - '#b20616', - '#6f0214', + "#015411", + "#019812", + "#6bca24", + "#ffb200", + "#ff5d00", + "#b20616", + "#6f0214" ]; const gradeNames = [ - 'Excellent', - 'Very good', - 'Good', - 'Fair', - 'Passable', - 'Insufficient', - 'To reject', + "Excellent", + "Very good", + "Good", + "Fair", + "Passable", + "Insufficient", + "To reject" ]; -const gradeValues = [ - 6, - 5, - 4, - 3, - 2, - 1, - 0 -]; +const gradeValues = [6, 5, 4, 3, 2, 1, 0]; export const grades = gradeNames.map((name, i) => ({ label: name, diff --git a/src/components/CopyField.jsx b/src/components/CopyField.jsx index fc9150f..34478a1 100644 --- a/src/components/CopyField.jsx +++ b/src/components/CopyField.jsx @@ -1,7 +1,6 @@ -import React from 'react'; -import {Button} from 'reactstrap'; -import {FontAwesomeIcon} from '@fortawesome/react-fontawesome'; - +import React from "react"; +import { Button } from "reactstrap"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; const CopyField = props => { const ref = React.createRef(); @@ -13,10 +12,10 @@ const CopyField = props => { const input = ref.current; input.focus(); input.select(); - document.execCommand('copy'); + document.execCommand("copy"); }; - const {t, value, icon} = props; + const { t, value, icon } = props; return (
@@ -33,9 +32,10 @@ const CopyField = props => {
diff --git a/src/components/banner/Helloasso.jsx b/src/components/banner/Helloasso.jsx index 7dfa6ee..cf36b9c 100644 --- a/src/components/banner/Helloasso.jsx +++ b/src/components/banner/Helloasso.jsx @@ -1,17 +1,23 @@ -import React from 'react'; -import i18n from '../../i18n' +import React from "react"; +import i18n from "../../i18n"; +const Helloasso = props => { + const locale = + i18n.language.substring(0, 2).toLowerCase() === "fr" ? "fr" : "en"; + const linkHelloAssoBanner = + locale === "fr" + ? "https://www.helloasso.com/associations/mieux-voter/formulaires/1/widget" + : "https://www.helloasso.com/associations/mieux-voter/formulaires/1/widget/en"; - -const Helloasso = (props) => { - const locale=i18n.language.substring(0,2).toLowerCase()==="fr"?"fr":"en"; - const linkHelloAssoBanner=(locale==="fr")?"https://www.helloasso.com/associations/mieux-voter/formulaires/1/widget":"https://www.helloasso.com/associations/mieux-voter/formulaires/1/widget/en"; - - return ( - - support us on helloasso - ); + return ( + + support us on helloasso + + ); }; - -export default Helloasso; \ No newline at end of file +export default Helloasso; diff --git a/src/components/banner/Paypal.jsx b/src/components/banner/Paypal.jsx index 38b9945..0ac022a 100644 --- a/src/components/banner/Paypal.jsx +++ b/src/components/banner/Paypal.jsx @@ -1,29 +1,43 @@ -import React from 'react'; -import i18n from '../../i18n' -import {withTranslation} from 'react-i18next'; +import React from "react"; +import i18n from "../../i18n"; +import { withTranslation } from "react-i18next"; import { faPaypal } from "@fortawesome/free-brands-svg-icons"; -import {FontAwesomeIcon} from "@fortawesome/react-fontawesome"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +const Paypal = props => { + const { t } = props; + let localeStringShort = i18n.language.substring(0, 2); + let localeStringComplete = + localeStringShort.toLowerCase() + "_" + localeStringShort.toUpperCase(); + if (localeStringComplete === "en_EN") { + localeStringComplete = "en_US"; + } + const pixelLink = + "https://www.paypal.com/" + localeStringComplete + "/i/scr/pixel.gif"; -const Paypal = (props) => { - const {t} = props; - let localeStringShort=i18n.language.substring(0,2); - let localeStringComplete=localeStringShort.toLowerCase()+"_"+localeStringShort.toUpperCase(); - if(localeStringComplete==="en_EN"){ - localeStringComplete="en_US"; - } - const pixelLink="https://www.paypal.com/"+localeStringComplete+"/i/scr/pixel.gif"; - - return ( -
-
- - - - -
); + return ( +
+
+ + + + +
+
+ ); }; - -export default withTranslation()(Paypal); \ No newline at end of file +export default withTranslation()(Paypal); diff --git a/src/components/layouts/Footer.jsx b/src/components/layouts/Footer.jsx index 82098fb..fa90cf7 100644 --- a/src/components/layouts/Footer.jsx +++ b/src/components/layouts/Footer.jsx @@ -1,7 +1,7 @@ -import React, {Component} from 'react'; -import {withTranslation} from 'react-i18next'; -import {Link} from 'react-router-dom'; -import Paypal from '../banner/Paypal'; +import React, { Component } from "react"; +import { withTranslation } from "react-i18next"; +import { Link } from "react-router-dom"; +import Paypal from "../banner/Paypal"; class Footer extends Component { constructor(props) { @@ -10,28 +10,30 @@ class Footer extends Component { } render() { - const linkStyle = {whiteSpace: 'nowrap'}; - const {t} = this.props; + const linkStyle = { whiteSpace: "nowrap" }; + const { t } = this.props; return (