diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b3f2801 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM node:21-alpine +WORKDIR /frontend +COPY package.json . +RUN npm install +COPY . . +EXPOSE 3000 +CMD ["npm", "run", "start:dev"] \ No newline at end of file diff --git a/package.json b/package.json index 81cdf77..a28e97a 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,11 @@ "@fortawesome/free-solid-svg-icons": "^6.5.1", "@fortawesome/react-fontawesome": "^0.2.0", "@popperjs/core": "^2.11.8", + "axios": "^1.6.8", "bootstrap": "^5.3.3", "react": "^18.2.0", "react-bootstrap": "^2.10.1", + "react-cookie": "^7.1.4", "react-dom": "^18.2.0", "react-router-dom": "^6.22.1" } diff --git a/src/App.jsx b/src/App.jsx index 97e9778..3582df4 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -1,7 +1,9 @@ import React, { useState, useEffect, useLayoutEffect } from "react"; import { Outlet, useNavigate } from "react-router-dom"; import { FormsData, UserData, TypeAnswerData } from "./context"; +import { useCookies } from "react-cookie"; import { globalRender } from "./router/protectedRouting.js"; +import { verifyUserApi } from "./hooks/api/enterAccountApi.js" import classes from "./assets/styles/app.module.scss" import NavBar from "./components/NavBar.jsx"; import 'bootstrap/dist/css/bootstrap.min.css'; @@ -30,6 +32,24 @@ const App = () => { ]); // useEffect(() => globalRender(window.location.pathname, user, navigate)); + const [cookies, _, __] = useCookies(["user"]); + + useEffect(() => { + async function verifyUser() { + const response = await verifyUserApi(cookies.token); + + if (response) { + if (response.status === 200) { + setUser(response.data); + } + else { + console.log(response) + } + } + } + + verifyUser() + }, []) return ( diff --git a/src/assets/styles/newForm.module.scss b/src/assets/styles/newForm.module.scss index 2b1fa98..3562399 100644 --- a/src/assets/styles/newForm.module.scss +++ b/src/assets/styles/newForm.module.scss @@ -12,9 +12,38 @@ .header { text-align: right; display: flex; - justify-content: end; + justify-content: space-between; width: 100%; height: 8%; + &__date { + width: 30%; + height: 100%; + &__item { + width: 100%; + height: 100%; + display: flex; + justify-content: space-between; + align-items: center; + position: relative; + span { + position: absolute; + height: 100%; + font-size: 8px; + font-family: "Montserrat", sans-serif; + top: -40%; + left: 2%; + } + input { + display: block; + height: 100%; + font-size: 15px; + font-family: "Montserrat", sans-serif; + border: 1px solid rgb(200, 200, 200); + padding: 1%; + border-radius: 5px; + } + } + } &__listBtn { display: flex; justify-content: space-between; diff --git a/src/components/AnswerModal.jsx b/src/components/AnswerModal.jsx index 4ab7422..5068641 100644 --- a/src/components/AnswerModal.jsx +++ b/src/components/AnswerModal.jsx @@ -5,9 +5,9 @@ import MyButton from "./MyButton.jsx" const AnswerModal = ({ cleanStates, currentTypeAnswer, - updateAnswerByForm, + updateBlock, stateModal, - saveStates, + addFormBlock, question, file, listTypeAnswer, @@ -16,17 +16,14 @@ const AnswerModal = ({ currentOptionAnswer, setCurrentOptionAnswer, comment, - datetime, mandatory, setMandatory, addOptionAnswer, setQuestion, setComment, - setDatetime, setCurrentTypeAnswer, setFile }) => { - return ( -
- Дедлайн выполнения - setDatetime(event.target.value)}/> -
diff --git a/src/components/GeneratingFormFields.jsx b/src/components/GeneratingFormFields.jsx index 250ea53..cd2aaef 100644 --- a/src/components/GeneratingFormFields.jsx +++ b/src/components/GeneratingFormFields.jsx @@ -1,9 +1,9 @@ import React, { useState } from "react"; import classes from "../assets/styles/generatingFormFields.module.scss"; -const GeneratingFormFields = ({newForm, listTypeAnswer, answers, updateAnswersForm}) => { +const GeneratingFormFields = ({listBlock, listTypeAnswer, answers, updateAnswersForm}) => { return ( - newForm.map((item, i) => + listBlock.map((item, i) =>

{i + 1}) {item.question}

diff --git a/src/components/NavBar.jsx b/src/components/NavBar.jsx index 0d0fb5e..304db25 100644 --- a/src/components/NavBar.jsx +++ b/src/components/NavBar.jsx @@ -16,7 +16,7 @@ const NavBar = ({navigate, auth, setAuth}) => {
{auth ?
- navigate("/profile")}>Профиль ({auth.name}) + navigate("/profile")}>Профиль ({auth.login})
:
navigate("/enter")}>Вход diff --git a/src/components/PreviewModal.jsx b/src/components/PreviewModal.jsx index 30e8026..bded6a8 100644 --- a/src/components/PreviewModal.jsx +++ b/src/components/PreviewModal.jsx @@ -2,7 +2,7 @@ import React from "react"; import classes from "../assets/styles/components/previewModal.module.scss"; import GeneratingFormFields from "./GeneratingFormFields.jsx"; -const PreviewModal = ({newForm, listTypeAnswer}) => { +const PreviewModal = ({listBlock, listTypeAnswer}) => { return (