diff --git a/src/components/DetailsCard/styles/__title/details-card__title.css b/src/components/DetailsCard/styles/__title/details-card__title.css index 2ffd6809..2dfbec25 100644 --- a/src/components/DetailsCard/styles/__title/details-card__title.css +++ b/src/components/DetailsCard/styles/__title/details-card__title.css @@ -1,5 +1,4 @@ .details-card__title { margin: 0; - margin-bottom: 16px; padding: 0; } diff --git a/src/components/DetailsCard/svg/PlusMinus.css b/src/components/DetailsCard/svg/PlusMinus.css index f65b1564..bdcf8992 100644 --- a/src/components/DetailsCard/svg/PlusMinus.css +++ b/src/components/DetailsCard/svg/PlusMinus.css @@ -1,6 +1,6 @@ .plus-minus { - width: 32px; - height: 32px; + width: 29px; + height: 29px; } .plus-minus line { diff --git a/src/modules/Faq/Faq.css b/src/modules/Faq/Faq.css index e40e81c6..5f177836 100644 --- a/src/modules/Faq/Faq.css +++ b/src/modules/Faq/Faq.css @@ -22,6 +22,7 @@ .faq__text { width: 100%; margin: -4px 0 0; + margin-top: 16px; padding: 0 240px 0 0; font-size: 18px; line-height: 28px; diff --git a/src/modules/HelpToShelter/ApiHelpToShelter.js b/src/modules/HelpToShelter/ApiHelpToShelter.js new file mode 100644 index 00000000..f5e51478 --- /dev/null +++ b/src/modules/HelpToShelter/ApiHelpToShelter.js @@ -0,0 +1,24 @@ +import { baseUrl } from '../../utils/constants'; + +// eslint-disable-next-line +export const donateToShelter = async (id, amount) => { + try { + const response = await fetch(`${baseUrl}/v1/payments/shelters/${id}/donate/`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + amount + }) + }); + + if (response.ok) { + const data = await response.json(); + return data.payment_confirm_url; + } + throw new Error('Ошибка при отправке запроса'); + } catch (error) { + throw new Error('Ошибка:', error); + } +}; diff --git a/src/modules/HelpToShelter/HelpToShelter.jsx b/src/modules/HelpToShelter/HelpToShelter.jsx index 64e8e513..60cd70c0 100644 --- a/src/modules/HelpToShelter/HelpToShelter.jsx +++ b/src/modules/HelpToShelter/HelpToShelter.jsx @@ -1,16 +1,30 @@ import React from 'react'; -import { useOutletContext } from 'react-router-dom'; +import { useOutletContext, useParams } from 'react-router-dom'; import './HelpToShelter.css'; import { Button } from '../../ui'; import DeclarationInput from '../../ui/DeclarationInput/DeclarationInput'; import * as regex from '../../utils/regex'; import * as errorMessage from '../../utils/errorMessage'; import useInput from '../../hooks/useInput'; +import { donateToShelter } from './ApiHelpToShelter'; const HelpToShelter = () => { + const { id } = useParams(); const materialAid = useInput('', { notEmpty: true, maxLength: 12, regex: regex.NUMBER }, errorMessage.DONATION_AMOUNT); const { isOwner, isAuth, isShelterOwner } = useOutletContext(); + const handleDonate = async () => { + if (materialAid.value !== '') { + const donationAmount = parseInt(materialAid.value, 10); + try { + const paymentConfirmUrl = await donateToShelter(id, donationAmount); + window.open(paymentConfirmUrl, '_blank'); + } catch (error) { + throw new Error(error.message); + } + } + }; + return (
{ !isOwner && ( @@ -26,7 +40,13 @@ const HelpToShelter = () => { placeholder='1000' /> )} - + )}
diff --git a/src/pages/AddShelterPage/components/ShelterStep.jsx b/src/pages/AddShelterPage/components/ShelterStep.jsx index e5740f2a..75208ef2 100644 --- a/src/pages/AddShelterPage/components/ShelterStep.jsx +++ b/src/pages/AddShelterPage/components/ShelterStep.jsx @@ -63,9 +63,15 @@ const ShelterStep = ({ handleBack, setShelter }) => { } }, [isInvalid]); - // добавить маску для полей времени работы приюта useEffect(() => { - const maskOptions = { mask: '00:00' }; + const maskOptions = { + mask: 'HH:MM', + blocks: { + HH: { mask: IMask.MaskedRange, from: 0, to: 23 }, + MM: { mask: IMask.MaskedRange, from: 0, to: 59 } + } + }; + document.querySelectorAll('.add-shelter-form__time-input').forEach((el) => { IMask(el, maskOptions); }); diff --git a/src/pages/AddShelterPage/styles/add-shelter-form/__time-input/add-shelter-form__time-input.scss b/src/pages/AddShelterPage/styles/add-shelter-form/__time-input/add-shelter-form__time-input.scss index 16006b60..097097d5 100644 --- a/src/pages/AddShelterPage/styles/add-shelter-form/__time-input/add-shelter-form__time-input.scss +++ b/src/pages/AddShelterPage/styles/add-shelter-form/__time-input/add-shelter-form__time-input.scss @@ -1,7 +1,7 @@ .add-shelter-form__time-input { width: 77px; margin: 0; - padding: 10.5px 16px; + padding: 10.5px 15px; font-size: 16px; line-height: 19px; font-weight: 400; diff --git a/src/pages/RegisterPage/RegisterPage.scss b/src/pages/RegisterPage/RegisterPage.scss index 2cebdd46..cfbdd6fb 100644 --- a/src/pages/RegisterPage/RegisterPage.scss +++ b/src/pages/RegisterPage/RegisterPage.scss @@ -51,6 +51,7 @@ margin-right: 12px; background-repeat: no-repeat; background-position: center; + background-color: var(--color-text-light); @media (min-width: 768px) { height: 20px; diff --git a/src/ui/AddPhotoBlock/AddPhotoBlock.jsx b/src/ui/AddPhotoBlock/AddPhotoBlock.jsx index 8937b1fa..3bf1692e 100644 --- a/src/ui/AddPhotoBlock/AddPhotoBlock.jsx +++ b/src/ui/AddPhotoBlock/AddPhotoBlock.jsx @@ -1,8 +1,11 @@ import React, { useState } from 'react'; +import Question from '../../modules/NestedRoutesMenu/svg/Question'; +import Tooltip from '../Tooltip/Tooltip'; import './AddPhotoBlock.scss'; const AddPhotoBlock = ({ photo, setPhoto, name, sizeLimit, labelText }) => { const [errorText, setErrorText] = useState(''); + const [showTooltip, setShowTooltip] = useState(false); const handlePhoto = (e) => { const [loadingFile] = e.target.files; @@ -26,7 +29,22 @@ const AddPhotoBlock = ({ photo, setPhoto, name, sizeLimit, labelText }) => { return (
- +