diff --git a/package.json b/package.json
index d962d5a..2d9140b 100644
--- a/package.json
+++ b/package.json
@@ -31,6 +31,7 @@
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
+ "@mdxeditor/editor": "^2.20.7",
"@popperjs/core": "^2.11.8",
"@uiw/react-markdown-editor": "^5.12.1",
"axios": "^1.6.8",
diff --git a/src/assets/styles/components/myButton.module.scss b/src/assets/styles/components/myButton.module.scss
index 47db7cc..1e50421 100644
--- a/src/assets/styles/components/myButton.module.scss
+++ b/src/assets/styles/components/myButton.module.scss
@@ -4,9 +4,19 @@
font-size: 15px;
height: 100%;
padding: .40em 1.2rem;
- color: white;
- background-color: rgb(150, 209, 158);
border-radius: 5px;
font-family: "Montserrat", sans-serif;
}
+ &__green {
+ color: white;
+ background-color: rgb(150, 209, 158);
+ }
+ &__white {
+ color: black;
+ background-color: white;
+ border: 1px solid rgba(0, 0, 0, 0.2);
+ &:hover {
+ border: 1px solid rgba(0, 0, 0, 0.3);
+ }
+ }
}
\ No newline at end of file
diff --git a/src/assets/styles/viewForm.module.scss b/src/assets/styles/viewForm.module.scss
index 8565ae0..55e441d 100644
--- a/src/assets/styles/viewForm.module.scss
+++ b/src/assets/styles/viewForm.module.scss
@@ -68,7 +68,7 @@
display: flex;
justify-content: space-between;
align-items: center;
- padding: 10px 20px;
+ padding: 8px 20px;
border: 2px solid rgb(220, 220, 220);
border-top: none;
}
diff --git a/src/components/MarkDown.jsx b/src/components/MarkDown.jsx
index b01cc71..45ce2b7 100644
--- a/src/components/MarkDown.jsx
+++ b/src/components/MarkDown.jsx
@@ -1,6 +1,7 @@
import React from 'react';
import MarkdownEditor from '@uiw/react-markdown-editor';
import classes from "../assets/styles/components/markDown.module.scss"
+import '@mdxeditor/editor/style.css';
const MarkDown = ({mkValue, setMkValue}) => {
return (
@@ -12,7 +13,6 @@ const MarkDown = ({mkValue, setMkValue}) => {
visibleDragbar={false}
/>
-
)
}
diff --git a/src/components/MyButton.jsx b/src/components/MyButton.jsx
index f8cc0d1..b9b60c2 100644
--- a/src/components/MyButton.jsx
+++ b/src/components/MyButton.jsx
@@ -7,12 +7,13 @@ const MyButton = (props) => {
diff --git a/src/pages/EnterAccount.jsx b/src/pages/EnterAccount.jsx
index 6436718..fb2a3da 100644
--- a/src/pages/EnterAccount.jsx
+++ b/src/pages/EnterAccount.jsx
@@ -108,6 +108,7 @@ const EnterAccount = () => {
@@ -139,6 +140,7 @@ const EnterAccount = () => {
createUser()}
/>
diff --git a/src/pages/Forms.jsx b/src/pages/Forms.jsx
index 49f4f7c..b502d22 100644
--- a/src/pages/Forms.jsx
+++ b/src/pages/Forms.jsx
@@ -91,7 +91,7 @@ const Forms = () => {
{/* */}
-
Загрузка...
: 'Создать'
diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx
index cd11c39..184e7f5 100644
--- a/src/pages/Home.jsx
+++ b/src/pages/Home.jsx
@@ -41,6 +41,7 @@ const Home = () => {
navigate(`/forms/${token}`)}
/>
diff --git a/src/pages/NewForm.jsx b/src/pages/NewForm.jsx
index 46cc9f4..37f66d1 100644
--- a/src/pages/NewForm.jsx
+++ b/src/pages/NewForm.jsx
@@ -235,12 +235,13 @@ const NewForm = () => {
}
click={() => updateTitleForm()}
+ class={"main__green"}
otherStyle={{paddingLeft: "0.9rem", paddingRight: "0.9rem"}}>
-
-
+
+
diff --git a/src/pages/ViewForm.jsx b/src/pages/ViewForm.jsx
index 77d3509..d81d972 100644
--- a/src/pages/ViewForm.jsx
+++ b/src/pages/ViewForm.jsx
@@ -5,8 +5,7 @@ import classes from "../assets/styles/viewForm.module.scss";
import { FormsData, TypeAnswerData, answersData, UserData } from "../context";
import GeneratingFormFields from "../components/GeneratingFormFields.jsx";
import MyButton from "../components/MyButton.jsx";
-import { listFormBlockApi, listFormBlockByTokenApi, saveAnswersApi } from "../hooks/api/formApi.js";
-import { listFormsApi } from "../hooks/api/listFormsApi.js";
+import { listFormBlockByTokenApi, saveAnswersApi } from "../hooks/api/formApi.js";
import { responseDataToListBlock } from "../hooks/sundry/parseListBlock.js";
const ViewForm = () => {
@@ -19,21 +18,22 @@ const ViewForm = () => {
const [cookies, setCookies, __] = useCookies(["user"]);
const [questions, setQuestions] = useState([]);
const [answers, setAnswers] = useState([]);
+ const [responseStatus, setResponseStatus] = useState(200);
useEffect(() => {
async function getForm() {
const responseBlocks = await listFormBlockByTokenApi(cookies.token, formId);
- if (responseBlocks.status === 200 && responseBlocks.data) {
+ if (responseBlocks.status === 200 && responseBlocks.data.blocks) {
const listBlocks = responseDataToListBlock(responseBlocks.data.blocks);
- setQuestions(listBlocks)
+ setQuestions(listBlocks);
setAnswers(listBlocks.map(item => (
{id: item.id, answer: []}
- )))
+ )));
}
else {
- console.log(responseBlocks)
+ setResponseStatus(responseBlocks.status)
}
};
@@ -70,7 +70,7 @@ const ViewForm = () => {
return (
- {questions ?
+ {questions.length ?
@@ -83,8 +83,8 @@ const ViewForm = () => {
-
- {
+
+ {
setAnswers([]);
navigate("/");
}}/>
@@ -93,7 +93,11 @@ const ViewForm = () => {
- Форма с идентификатором #{formId} отсутствует.
+
+ {responseStatus === 200 ?
+ `Форма с идентификатором #${formId} пустая.` :
+ `Форма с идентификатором #${formId} отсутствует.`}
+
}