From 0e1dc49f59cfc2ddd6a9abc22d3322c38aaa753e Mon Sep 17 00:00:00 2001 From: kuwsh1n Date: Wed, 3 Jul 2024 16:26:24 +0300 Subject: [PATCH] ticket 16, 4, 18, 19, 20, 21, 22 --- package.json | 4 + src/App.jsx | 14 +- src/assets/styles/adminPanel.module.scss | 6 +- .../styles/components/answerModal.module.scss | 20 +++ .../bodyModal/editToken.module.scss | 5 + .../bodyModal/qrCodeToken.module.scss | 8 + .../styles/generatingFormFields.module.scss | 10 +- src/assets/styles/newArticle.module.scss | 2 +- src/components/AnswerModal.jsx | 9 +- src/components/DefaultModal.jsx | 3 +- src/components/GeneratingFormFields.jsx | 21 ++- src/components/MyInput.jsx | 26 +++- src/components/MyQrCode.jsx | 11 ++ src/components/TextEditor.jsx | 38 ++++- src/components/bodyModal/EditToken.jsx | 14 ++ .../bodyModal/EditUserAdminPanel.jsx | 15 +- src/components/bodyModal/QrCodeToken.jsx | 14 ++ src/hooks/api/adminApi.js | 42 ------ src/hooks/api/answersApi.js | 4 +- src/hooks/api/articleApi.js | 14 +- src/hooks/api/enterAccountApi.js | 4 +- src/hooks/api/formApi.js | 18 +-- src/hooks/api/listFormsApi.js | 43 ++++-- src/hooks/api/profileApi.js | 33 +++- src/hooks/sundry/parseListBlock.js | 8 +- src/pages/AdminPanel.jsx | 91 ++++++++--- src/pages/AnswersForm.jsx | 24 ++- src/pages/Articles.jsx | 19 ++- src/pages/Forms.jsx | 67 ++++++--- src/pages/NewArticle.jsx | 49 +++++- src/pages/NewForm.jsx | 94 ++++++++++-- src/pages/Profile.jsx | 17 ++- src/pages/TokensForm.jsx | 142 ++++++++++++++---- src/pages/ViewArticle.jsx | 15 +- src/pages/ViewForm.jsx | 16 +- src/router/protectedRouting.js | 4 + webpack.config.js | 1 + 37 files changed, 708 insertions(+), 217 deletions(-) create mode 100644 src/assets/styles/components/bodyModal/editToken.module.scss create mode 100644 src/assets/styles/components/bodyModal/qrCodeToken.module.scss create mode 100644 src/components/MyQrCode.jsx create mode 100644 src/components/bodyModal/EditToken.jsx create mode 100644 src/components/bodyModal/QrCodeToken.jsx delete mode 100644 src/hooks/api/adminApi.js diff --git a/package.json b/package.json index e91a7f4..08d58e7 100644 --- a/package.json +++ b/package.json @@ -38,10 +38,14 @@ "@uiw/react-markdown-editor": "^5.12.1", "axios": "^1.6.8", "bootstrap": "^5.3.3", + "inputmask": "^5.0.9", + "primereact": "^10.6.6", + "qrcode": "^1.5.3", "react": "^18.2.0", "react-bootstrap": "^2.10.1", "react-cookie": "^7.1.4", "react-dom": "^18.2.0", + "react-qr-code": "^2.0.15", "react-router-dom": "^6.22.1" } } diff --git a/src/App.jsx b/src/App.jsx index 42f840b..c2a7d91 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect, useLayoutEffect } from "react"; +import React, { useState, useEffect, useLayoutEffect, useRef } from "react"; import { Outlet, useNavigate } from "react-router-dom"; import { FormsData, UserData, TypeAnswerData, answersData } from "./context"; import { useCookies } from "react-cookie"; @@ -20,6 +20,9 @@ const App = () => { const navigate = useNavigate(); const [forms, setForms] = useState([]); const [user, setUser] = useState(false); + globalRender(window.location.pathname, user, navigate); + + const userRef = useRef(false) const [answersList, setAnswersList] = useState([]); const [listTypeAnswer, setListTypeAnswer] = useState([ {id: 1, text: 'Краткий ответ', typeTag: InputText}, @@ -37,13 +40,16 @@ const App = () => { useEffect(() => { async function verifyUser() { const response = await verifyUserApi(cookies.token); + console.log("verifyUser App") if (response.status === 200) { setUser(response.data); - globalRender(window.location.pathname, response.data, navigate); + userRef.current = response.data + // globalRender(window.location.pathname, response.data, navigate); } else { - globalRender(window.location.pathname, false, navigate); + // globalRender(window.location.pathname, false, navigate); + setUser(false); } } @@ -51,7 +57,7 @@ const App = () => { }, []); return ( - + { return ( @@ -45,13 +46,15 @@ const AnswerModal = ({
Вопрос + + setFile(event.target.value)} + onChange={e => addFiles(e.target.files)} >
diff --git a/src/components/DefaultModal.jsx b/src/components/DefaultModal.jsx index a839f27..f08be0d 100644 --- a/src/components/DefaultModal.jsx +++ b/src/components/DefaultModal.jsx @@ -5,14 +5,13 @@ import MyButton from "./MyButton.jsx"; const DefaultModal = ({ name, - postfix, btn, BodyModal }) => { return (