From e3455e3e6d23ca76a81cc6069e3ce54fbcf37630 Mon Sep 17 00:00:00 2001 From: kuwsh1n Date: Sat, 27 Apr 2024 12:49:35 +0300 Subject: [PATCH] fix ticket 14 --- .../styles/components/myButton.module.scss | 3 ++- .../styles/components/myInput.module.scss | 4 ++-- src/assets/styles/forms.module.scss | 2 +- src/assets/styles/newForm.module.scss | 24 +------------------ src/hooks/api/formApi.js | 6 ++--- src/pages/Forms.jsx | 11 +++++---- src/pages/NewForm.jsx | 11 +++++---- 7 files changed, 21 insertions(+), 40 deletions(-) diff --git a/src/assets/styles/components/myButton.module.scss b/src/assets/styles/components/myButton.module.scss index 1e50421..e2d45c6 100644 --- a/src/assets/styles/components/myButton.module.scss +++ b/src/assets/styles/components/myButton.module.scss @@ -1,5 +1,6 @@ .main { - height: 100%; + // height: 100%; + max-height: 40px; button { font-size: 15px; height: 100%; diff --git a/src/assets/styles/components/myInput.module.scss b/src/assets/styles/components/myInput.module.scss index df57d08..3e39702 100644 --- a/src/assets/styles/components/myInput.module.scss +++ b/src/assets/styles/components/myInput.module.scss @@ -1,11 +1,11 @@ .main { - height: 100%; + max-height: 40px; input { border: 1px solid rgb(180, 180, 180); height: 100%; border-radius: 5px; font-family: "Montserrat", sans-serif; - padding: 0 3px; + padding: .40em 3px; color: rgb(40, 40, 40); font-size: 15px; } diff --git a/src/assets/styles/forms.module.scss b/src/assets/styles/forms.module.scss index f9dc24c..12664be 100644 --- a/src/assets/styles/forms.module.scss +++ b/src/assets/styles/forms.module.scss @@ -14,7 +14,7 @@ height: 10%; display: flex; justify-content: space-between; - align-items: center; + align-items: end; padding: 0 5%; } diff --git a/src/assets/styles/newForm.module.scss b/src/assets/styles/newForm.module.scss index e860114..afd128c 100644 --- a/src/assets/styles/newForm.module.scss +++ b/src/assets/styles/newForm.module.scss @@ -10,7 +10,6 @@ } .header { - // text-align: right; display: flex; justify-content: space-between; width: 100%; @@ -26,55 +25,34 @@ 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; - } } &__title { 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; + width: 30%; } } diff --git a/src/hooks/api/formApi.js b/src/hooks/api/formApi.js index 1ecffb3..30c6de4 100644 --- a/src/hooks/api/formApi.js +++ b/src/hooks/api/formApi.js @@ -33,11 +33,11 @@ async function addFormBlockApi(token, formId, data) { } }; -async function updateBlockApi(token, blockId, data) { +async function updateBlockApi(token, formId, data) { try { - const response = await axios.post(`https://api.minerva.krbl.ru/formBuilder/edit/${blockId}/set`, + const response = await axios.post(`https://api.minerva.krbl.ru/formBuilder/edit/${formId}/set`, { - "data": data + data: data }, { headers: { diff --git a/src/pages/Forms.jsx b/src/pages/Forms.jsx index d57e9ca..fdecb80 100644 --- a/src/pages/Forms.jsx +++ b/src/pages/Forms.jsx @@ -13,7 +13,7 @@ const Forms = () => { const {forms, setForms} = useContext(FormsData); const {user, setUser} = useContext(UserData); const [stateLoading, setStateLoading] = useState(false); - const [removeIdForm, setRemoveIdForm] = useState(false); + const [currentRemoveForm, setCurrentRemoveForm] = useState(false); const [searchForm, setSearchForm] = useState(""); const [cookies, _, __] = useCookies(["user"]); @@ -120,14 +120,15 @@ const Forms = () => {
  • openFormView(item.id)}>Открыть
  • navigate(`/forms/${item.id}/answers`)}>Ответы
  • copyLinkToFormView(item.id)}>Скопировать ссылку
  • -
  • setRemoveIdForm(item.id)}>Удалить
  • +
  • setCurrentRemoveForm({id: item.id, title: item.title})}>Удалить
  • ?`} + message={`Вы хотетите удалить форму <${currentRemoveForm.title}>?`} action={{ - execute: () => removeForm(removeIdForm), - cancel: () => setRemoveIdForm(false) + execute: () => removeForm(currentRemoveForm.id), + // cancel: () => setCurrentRemoveForm(false) + cancel: () => {} }} /> diff --git a/src/pages/NewForm.jsx b/src/pages/NewForm.jsx index 664c8f1..00ec8e8 100644 --- a/src/pages/NewForm.jsx +++ b/src/pages/NewForm.jsx @@ -9,7 +9,7 @@ import { FormsData, TypeAnswerData } from "../context"; import { listFormsApi, updateTitleFormApi } from "../hooks/api/listFormsApi.js"; import { saveFormApi, addFormBlockApi, listFormBlockApi, updateBlockApi, updateOrderBlockApi } from "../hooks/api/formApi.js"; import { responseDataToListBlock } from "../hooks/sundry/parseListBlock.js"; -import { parseVKlinkVideo } from "../hooks/sundry/parseLinkVideo.js"; +import MyInput from "../components/MyInput.jsx"; const NewForm = () => { const navigate = useNavigate(); @@ -65,6 +65,7 @@ const NewForm = () => { const responseBlock = await listFormBlockApi(cookies.token, formId); if (responseBlock.status === 200 && responseBlock.data && responseForms.status === 200) { + console.log(responseDataToListBlock(responseBlock.data)) setListBlock(responseDataToListBlock(responseBlock.data)); const title = responseForms.data.find(item => item.id === formId).title setNewTitleForm(title); @@ -102,7 +103,6 @@ const NewForm = () => { async function updateBlock() { const data = { - id: stateModal, question: question, comment: comment, file: file, @@ -112,7 +112,8 @@ const NewForm = () => { typeAnswer: currentTypeAnswer, } - const response = await updateBlockApi(cookies.token, stateModal, data); + const response = await updateBlockApi(cookies.token, formId, data); + console.log(response) if (response.status === 200) { setListBlock(listBlock.map(item => { @@ -219,11 +220,11 @@ const NewForm = () => {
    Дедлайн выполнения - setDatetime(event.target.value)}/> +
    Название формы - setNewTitleForm(event.target.value)}/> +