This commit is contained in:
parent
1e1bdceb2c
commit
cb7d0587e8
@ -31,6 +31,7 @@
|
|||||||
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
"@fortawesome/free-solid-svg-icons": "^6.5.1",
|
||||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||||
|
"@mdxeditor/editor": "^2.20.7",
|
||||||
"@popperjs/core": "^2.11.8",
|
"@popperjs/core": "^2.11.8",
|
||||||
"@uiw/react-markdown-editor": "^5.12.1",
|
"@uiw/react-markdown-editor": "^5.12.1",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.6.8",
|
||||||
|
@ -4,9 +4,19 @@
|
|||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: .40em 1.2rem;
|
padding: .40em 1.2rem;
|
||||||
color: white;
|
|
||||||
background-color: rgb(150, 209, 158);
|
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
font-family: "Montserrat", sans-serif;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -68,7 +68,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 10px 20px;
|
padding: 8px 20px;
|
||||||
border: 2px solid rgb(220, 220, 220);
|
border: 2px solid rgb(220, 220, 220);
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import MarkdownEditor from '@uiw/react-markdown-editor';
|
import MarkdownEditor from '@uiw/react-markdown-editor';
|
||||||
import classes from "../assets/styles/components/markDown.module.scss"
|
import classes from "../assets/styles/components/markDown.module.scss"
|
||||||
|
import '@mdxeditor/editor/style.css';
|
||||||
|
|
||||||
const MarkDown = ({mkValue, setMkValue}) => {
|
const MarkDown = ({mkValue, setMkValue}) => {
|
||||||
return (
|
return (
|
||||||
@ -12,7 +13,6 @@ const MarkDown = ({mkValue, setMkValue}) => {
|
|||||||
visibleDragbar={false}
|
visibleDragbar={false}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,12 +7,13 @@ const MyButton = (props) => {
|
|||||||
<div className={classes.main}>
|
<div className={classes.main}>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class={props.class}
|
className={classes[props.class]}
|
||||||
onClick={props.click}
|
onClick={props.click}
|
||||||
data-bs-target={props.target}
|
data-bs-target={props.target}
|
||||||
data-bs-toggle={props.toggle}
|
data-bs-toggle={props.toggle}
|
||||||
data-bs-dismiss={props.dismiss}
|
data-bs-dismiss={props.dismiss}
|
||||||
style={{backgroundColor: props.backgroundColor, ...props.otherStyle}}>
|
style={{backgroundColor: props.backgroundColor, ...props.otherStyle}}
|
||||||
|
>
|
||||||
{props.text}
|
{props.text}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,6 +108,7 @@ const EnterAccount = () => {
|
|||||||
<div className={classes.content__wrapper__login__footer}>
|
<div className={classes.content__wrapper__login__footer}>
|
||||||
<MyButton
|
<MyButton
|
||||||
text={"Войти"}
|
text={"Войти"}
|
||||||
|
class={"main__green"}
|
||||||
otherStyle={{height: "50%", width: "20%"}}
|
otherStyle={{height: "50%", width: "20%"}}
|
||||||
click={logInToAccount}
|
click={logInToAccount}
|
||||||
/>
|
/>
|
||||||
@ -139,6 +140,7 @@ const EnterAccount = () => {
|
|||||||
<div className={classes.content__wrapper__register__footer}>
|
<div className={classes.content__wrapper__register__footer}>
|
||||||
<MyButton
|
<MyButton
|
||||||
text={"Создать"}
|
text={"Создать"}
|
||||||
|
class={"main__green"}
|
||||||
otherStyle={{ height: "100%", width: "20%" }}
|
otherStyle={{ height: "100%", width: "20%" }}
|
||||||
click={() => createUser()}
|
click={() => createUser()}
|
||||||
/>
|
/>
|
||||||
|
@ -91,7 +91,7 @@ const Forms = () => {
|
|||||||
<div className={classes.wrapper}>
|
<div className={classes.wrapper}>
|
||||||
<div className={classes.panel}>
|
<div className={classes.panel}>
|
||||||
{/* <MyInput placeholder={'Поиск...'}/> */}
|
{/* <MyInput placeholder={'Поиск...'}/> */}
|
||||||
<MyButton click={createForm} otherStyle={{width: '200px'}} text={
|
<MyButton click={createForm} class={"main__green"} otherStyle={{width: '200px'}} text={
|
||||||
stateLoading ? <div class="spinner-border text-light" role="status">
|
stateLoading ? <div class="spinner-border text-light" role="status">
|
||||||
<span class="visually-hidden">Загрузка...</span>
|
<span class="visually-hidden">Загрузка...</span>
|
||||||
</div> : 'Создать'
|
</div> : 'Создать'
|
||||||
|
@ -41,6 +41,7 @@ const Home = () => {
|
|||||||
<div className={classes.content__search__wrapper}>
|
<div className={classes.content__search__wrapper}>
|
||||||
<MyButton
|
<MyButton
|
||||||
text={"Найти форму"}
|
text={"Найти форму"}
|
||||||
|
class={"main__green"}
|
||||||
click={() => navigate(`/forms/${token}`)}
|
click={() => navigate(`/forms/${token}`)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -235,12 +235,13 @@ const NewForm = () => {
|
|||||||
<MyButton
|
<MyButton
|
||||||
text={<i class="fa-solid fa-floppy-disk"></i>}
|
text={<i class="fa-solid fa-floppy-disk"></i>}
|
||||||
click={() => updateTitleForm()}
|
click={() => updateTitleForm()}
|
||||||
|
class={"main__green"}
|
||||||
otherStyle={{paddingLeft: "0.9rem", paddingRight: "0.9rem"}}>
|
otherStyle={{paddingLeft: "0.9rem", paddingRight: "0.9rem"}}>
|
||||||
</MyButton>
|
</MyButton>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.header__listBtn}>
|
<div className={classes.header__listBtn}>
|
||||||
<MyButton text={'Предпросмотр'} backgroundColor={'rgb(225, 225, 225)'} toggle={"modal"} target={"#previewModal"}/>
|
<MyButton text={'Предпросмотр'} class={"main__white"} toggle={"modal"} target={"#previewModal"}/>
|
||||||
<MyButton text={'Опубликовать'} click={location.state ? updateFormByForms : saveForm}/>
|
<MyButton text={'Опубликовать'} class={"main__green"} click={location.state ? updateFormByForms : saveForm}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.content}>
|
<div className={classes.content}>
|
||||||
|
@ -5,8 +5,7 @@ import classes from "../assets/styles/viewForm.module.scss";
|
|||||||
import { FormsData, TypeAnswerData, answersData, UserData } from "../context";
|
import { FormsData, TypeAnswerData, answersData, UserData } from "../context";
|
||||||
import GeneratingFormFields from "../components/GeneratingFormFields.jsx";
|
import GeneratingFormFields from "../components/GeneratingFormFields.jsx";
|
||||||
import MyButton from "../components/MyButton.jsx";
|
import MyButton from "../components/MyButton.jsx";
|
||||||
import { listFormBlockApi, listFormBlockByTokenApi, saveAnswersApi } from "../hooks/api/formApi.js";
|
import { listFormBlockByTokenApi, saveAnswersApi } from "../hooks/api/formApi.js";
|
||||||
import { listFormsApi } from "../hooks/api/listFormsApi.js";
|
|
||||||
import { responseDataToListBlock } from "../hooks/sundry/parseListBlock.js";
|
import { responseDataToListBlock } from "../hooks/sundry/parseListBlock.js";
|
||||||
|
|
||||||
const ViewForm = () => {
|
const ViewForm = () => {
|
||||||
@ -19,21 +18,22 @@ const ViewForm = () => {
|
|||||||
const [cookies, setCookies, __] = useCookies(["user"]);
|
const [cookies, setCookies, __] = useCookies(["user"]);
|
||||||
const [questions, setQuestions] = useState([]);
|
const [questions, setQuestions] = useState([]);
|
||||||
const [answers, setAnswers] = useState([]);
|
const [answers, setAnswers] = useState([]);
|
||||||
|
const [responseStatus, setResponseStatus] = useState(200);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getForm() {
|
async function getForm() {
|
||||||
const responseBlocks = await listFormBlockByTokenApi(cookies.token, formId);
|
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);
|
const listBlocks = responseDataToListBlock(responseBlocks.data.blocks);
|
||||||
|
|
||||||
setQuestions(listBlocks)
|
setQuestions(listBlocks);
|
||||||
setAnswers(listBlocks.map(item => (
|
setAnswers(listBlocks.map(item => (
|
||||||
{id: item.id, answer: []}
|
{id: item.id, answer: []}
|
||||||
)))
|
)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(responseBlocks)
|
setResponseStatus(responseBlocks.status)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ const ViewForm = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.main}>
|
<div className={classes.main}>
|
||||||
{questions ?
|
{questions.length ?
|
||||||
<div className={classes.wrapper}>
|
<div className={classes.wrapper}>
|
||||||
<div className={classes.form}>
|
<div className={classes.form}>
|
||||||
<div className={classes.form__header}>
|
<div className={classes.form__header}>
|
||||||
@ -83,8 +83,8 @@ const ViewForm = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.footer}>
|
<div className={classes.footer}>
|
||||||
<MyButton text={"Отправить"} click={saveAnswers}/>
|
<MyButton text={"Отправить"} class={"main__green"} click={saveAnswers}/>
|
||||||
<MyButton text={"Отмена"} backgroundColor={"rgb(180, 180, 180)"} click={() => {
|
<MyButton text={"Отмена"} class={"main__white"} click={() => {
|
||||||
setAnswers([]);
|
setAnswers([]);
|
||||||
navigate("/");
|
navigate("/");
|
||||||
}}/>
|
}}/>
|
||||||
@ -93,7 +93,11 @@ const ViewForm = () => {
|
|||||||
<div className={classes.wrapper}>
|
<div className={classes.wrapper}>
|
||||||
<div className={classes.form}>
|
<div className={classes.form}>
|
||||||
<div className={classes.form__unexists}>
|
<div className={classes.form__unexists}>
|
||||||
<span>Форма с идентификатором #{formId} отсутствует.</span>
|
<span>
|
||||||
|
{responseStatus === 200 ?
|
||||||
|
`Форма с идентификатором #${formId} пустая.` :
|
||||||
|
`Форма с идентификатором #${formId} отсутствует.`}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>}
|
</div>}
|
||||||
|
Loading…
Reference in New Issue
Block a user