fix: dependencies

legacy
Pierre-Louis Guhur 1 year ago
parent e96df837b3
commit 7bcf620f67

@ -1,35 +0,0 @@
{
"env": {
"browser": true,
"es6": true,
"node": true,
"commonjs": true
},
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"react"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"no-console": "off"
}
}

@ -1,23 +1,14 @@
import {useState} from 'react'
import { useState } from "react";
import ButtonWithConfirm from "./ButtonWithConfirm";
import {
Row,
Col,
Input,
InputGroup,
InputGroupAddon,
} from "reactstrap";
import {useTranslation} from "react-i18next";
import {
sortableHandle
} from "react-sortable-hoc";
import { Row, Col, Input, InputGroup, InputGroupAddon } from "reactstrap";
import { useTranslation } from "react-i18next";
import HelpButton from "@components/form/HelpButton";
const DragHandle = sortableHandle(({children}) => (
const DragHandle = ({ children }) => (
<span className="input-group-text indexNumber">{children}</span>
));
const CandidateField = ({label, candIndex, onDelete, ...inputProps}) => {
const {t} = useTranslation();
);
const CandidateField = ({ label, candIndex, onDelete, ...inputProps }) => {
const { t } = useTranslation();
return (
<Row>
@ -37,8 +28,11 @@ const CandidateField = ({label, candIndex, onDelete, ...inputProps}) => {
maxLength="250"
autoFocus
/>
<ButtonWithConfirm className="btn btn-primary border-light" label={label} onDelete={onDelete}>
</ButtonWithConfirm>
<ButtonWithConfirm
className="btn btn-primary border-light"
label={label}
onDelete={onDelete}
></ButtonWithConfirm>
</InputGroup>
</Col>
<Col xs="auto" className="align-self-center pl-0">
@ -50,6 +44,6 @@ const CandidateField = ({label, candIndex, onDelete, ...inputProps}) => {
</Col>
</Row>
);
}
};
export default CandidateField
export default CandidateField;

@ -1,72 +1,55 @@
import {useState, useEffect, createRef} from 'react'
import {useTranslation} from "react-i18next";
import {
Button,
Card,
CardBody
} from "reactstrap";
import {
faPlus,
} from "@fortawesome/free-solid-svg-icons";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import {
sortableContainer,
sortableElement,
sortableHandle
} from "react-sortable-hoc";
import arrayMove from "array-move"
import CandidateField from './CandidateField'
// const SortableItem = sortableElement(({className, ...childProps}) => <li className={className}><CandidateField {...childProps} /></li>);
//
// const SortableContainer = sortableContainer(({children}) => {
// return <ul className="sortable">{children}</ul>;
// });
const SortableItem = ({className, ...childProps}) => <li className={className}><CandidateField {...childProps} /></li>;
const SortableContainer = ({children}) => {
import { useState, useEffect, createRef } from "react";
import { useTranslation } from "react-i18next";
import { Button, Card, CardBody } from "reactstrap";
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import CandidateField from "./CandidateField";
const SortableItem = ({ className, ...childProps }) => (
<li className={className}>
<CandidateField {...childProps} />
</li>
);
const SortableContainer = ({ children }) => {
return <ul className="sortable">{children}</ul>;
};
const CandidatesField = ({onChange}) => {
const {t} = useTranslation();
const [candidates, setCandidates] = useState([])
const CandidatesField = ({ onChange }) => {
const { t } = useTranslation();
const [candidates, setCandidates] = useState([]);
const addCandidate = () => {
if (candidates.length < 1000) {
candidates.push({label: "", fieldRef: createRef()});
candidates.push({ label: "", fieldRef: createRef() });
setCandidates([...candidates]);
onChange(candidates)
onChange(candidates);
} else {
console.error("Too many candidates")
console.error("Too many candidates");
}
};
useEffect(() => {
addCandidate();
addCandidate();
}, [])
}, []);
const removeCandidate = index => {
const removeCandidate = (index) => {
if (candidates.length === 1) {
const newCandidates = []
newCandidates.push({label: "", fieldRef: createRef()});
newCandidates.push({label: "", fieldRef: createRef()});
const newCandidates = [];
newCandidates.push({ label: "", fieldRef: createRef() });
newCandidates.push({ label: "", fieldRef: createRef() });
setCandidates(newCandidates);
onChange(newCandidates)
}
else {
const newCandidates = candidates.filter((c, i) => i != index)
onChange(newCandidates);
} else {
const newCandidates = candidates.filter((c, i) => i != index);
setCandidates(newCandidates);
onChange(newCandidates);
}
};
const editCandidate = (index, label) => {
candidates[index].label = label
candidates[index].label = label;
setCandidates([...candidates]);
onChange(candidates);
};
@ -76,22 +59,21 @@ const CandidatesField = ({onChange}) => {
e.preventDefault();
if (index + 1 === candidates.length) {
addCandidate();
}
else {
} else {
candidates[index + 1].fieldRef.current.focus();
}
}
}
};
const onSortEnd = ({oldIndex, newIndex}) => {
setCandidates(arrayMove(candidates, oldIndex, newIndex));
const onSortEnd = ({ oldIndex, newIndex }) => {
setCandidates(candidates, oldIndex, newIndex);
};
return (
<>
<SortableContainer onSortEnd={onSortEnd}>
{candidates.map((candidate, index) => {
const className = "sortable"
const className = "sortable";
return (
<SortableItem
className={className}
@ -104,7 +86,7 @@ const CandidatesField = ({onChange}) => {
onKeyPress={(e) => handleKeyPress(e, index)}
innerRef={candidate.fieldRef}
/>
)
);
})}
</SortableContainer>
@ -120,9 +102,6 @@ const CandidatesField = ({onChange}) => {
</Button>
</>
);
};
}
export default CandidatesField
export default CandidatesField;

@ -1,9 +1,19 @@
module.exports = {
// https://www.i18next.com/overview/configuration-options#logging
debug: process.env.NODE_ENV === "development",
i18n: {
defaultLocale: "fr",
locales: ["en", "fr", "de", "es", "ru"],
ns: ["resource", "common", "error"],
defaultNS: "resource",
fallbackNS: ["common", "error"],
},
ns: ["resource", "common", "error"],
fallbackNS: ["common", "error"],
defaultNS: "resource",
defaultValue: "__STRING_NOT_TRANSLATED__",
/** To avoid issues when deploying to some paas (vercel...) */
localePath:
typeof window === "undefined"
? require("path").resolve("./public/locales")
: "/locales",
reloadOnPrerender: process.env.NODE_ENV === "development",
};

@ -3,35 +3,35 @@ const { i18n } = require("./next-i18next.config");
module.exports = {
i18n,
// See https://github.com/netlify/netlify-plugin-nextjs/issues/223
unstableNetlifyFunctionsSupport: {
"pages/index.jsx": {
includeDirs: ["public"],
},
"pages/faq.jsx": {
includeDirs: ["public"],
},
"pages/legal-notices.jsx": {
includeDirs: ["public"],
},
"pages/new/confirm/[pid].jsx": {
includeDirs: ["public"],
},
"pages/new.jsx": {
includeDirs: ["public"],
},
"pages/result/[pid]/[[...tid]].jsx": {
includeDirs: ["public"],
},
"pages/vote/[pid]/[[...tid]].jsx": {
includeDirs: ["public"],
},
"pages/vote/[pid]/confirm.jsx": {
includeDirs: ["public"],
},
"pages/privacy-policy.jsx": {
includeDirs: ["public"],
},
},
// unstableNetlifyFunctionsSupport: {
// "pages/index.jsx": {
// includeDirs: ["public"],
// },
// "pages/faq.jsx": {
// includeDirs: ["public"],
// },
// "pages/legal-notices.jsx": {
// includeDirs: ["public"],
// },
// "pages/new/confirm/[pid].jsx": {
// includeDirs: ["public"],
// },
// "pages/new.jsx": {
// includeDirs: ["public"],
// },
// "pages/result/[pid]/[[...tid]].jsx": {
// includeDirs: ["public"],
// },
// "pages/vote/[pid]/[[...tid]].jsx": {
// includeDirs: ["public"],
// },
// "pages/vote/[pid]/confirm.jsx": {
// includeDirs: ["public"],
// },
// "pages/privacy-policy.jsx": {
// includeDirs: ["public"],
// },
// },
pageExtensions: ["mdx", "jsx", "js", "ts", "tsx"],
webpack(config) {
config.module.rules.push({
@ -41,5 +41,5 @@ module.exports = {
return config;
},
target: "experimental-serverless-trace",
// target: "experimental-serverless-trace",
};

9317
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,6 +1,6 @@
{
"name": "mv-front-react",
"version": "1.1.0",
"version": "1.2.0",
"private": true,
"scripts": {
"dev": "next dev",
@ -9,38 +9,37 @@
"export": "next export"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.3",
"@fortawesome/fontawesome-svg-core": "^1.2.35",
"@fortawesome/free-brands-svg-icons": "^5.15.3",
"@fortawesome/free-solid-svg-icons": "^5.15.3",
"@fortawesome/react-fontawesome": "^0.1.14",
"@svgr/webpack": "^5.5.0",
"@fortawesome/fontawesome-free": "^6.2.1",
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-regular-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@next/font": "13.1.1",
"@svgr/webpack": "^6.5.1",
"@types/node": "18.11.18",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.10",
"array-move": "^3.0.1",
"bootstrap": "^4.6.0",
"bootstrap-scss": "^4.6.0",
"babel-eslint": "^10.1.0",
"bootstrap": "^5.2.3",
"bootstrap-sass": "^3.4.3",
"domexception": "^2.0.1",
"dotenv": "^8.6.0",
"eslint": "8.31.0",
"eslint-config-next": "13.1.1",
"form-data": "^4.0.0",
"handlebars": "^4.7.7",
"handlebars-i18next": "^1.0.1",
"i18next": "^20.2.2",
"i18next-chained-backend": "^2.1.0",
"i18next-fs-backend": "^1.1.1",
"i18next-http-backend": "^1.2.4",
"i18next-localstorage-backend": "^3.1.2",
"i18next-text": "^0.5.6",
"mailgun.js": "^3.3.2",
"next": "^10.2.0",
"next-i18next": "^8.2.0",
"next": "13.1.1",
"next-i18next": "^13.0.3",
"query-string": "^7.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-flags-select": "^2.1.2",
"react-i18next": "^11.8.15",
"react-multi-email": "^0.5.3",
"react-sortable-hoc": "^2.0.0",
"react-toastify": "^7.0.4",
"reactstrap": "^8.9.0",
"sass": "^1.32.13"
"react-multi-email": "^1.0.6",
"react-toastify": "^9.1.1",
"reactstrap": "^9.1.5",
"sass": "^1.57.1",
"typescript": "4.9.4"
}
}

@ -17,9 +17,9 @@ import {
CardBody,
} from "reactstrap";
import { ReactMultiEmail, isEmail } from "react-multi-email";
import "react-multi-email/style.css";
// import "react-multi-email/style.css";
import { toast, ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
// import "react-toastify/dist/ReactToastify.css";
import queryString from "query-string";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {

14565
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save