diff --git a/src/assets/icons/tgSettingsIcon.svg b/src/assets/icons/tgSettingsIcon.svg new file mode 100644 index 00000000..fb867cb5 --- /dev/null +++ b/src/assets/icons/tgSettingsIcon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/pages/PartnerSettings/PartnerSettings.jsx b/src/pages/PartnerSettings/PartnerSettings.jsx index 1ece3338..e23dd8c1 100644 --- a/src/pages/PartnerSettings/PartnerSettings.jsx +++ b/src/pages/PartnerSettings/PartnerSettings.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import React, { useEffect, useState } from "react"; import { apiRequest } from "@api/request"; @@ -11,6 +11,7 @@ import { Navigation } from "@components/Navigation/Navigation"; import { ProfileBreadcrumbs } from "@components/ProfileBreadcrumbs/ProfileBreadcrumbs"; import { ProfileHeader } from "@components/ProfileHeader/ProfileHeader"; +import tgSettingsIcon from "assets/icons/tgSettingsIcon.svg"; import astral from "assets/images/logo/astralLogo.png"; import kontur from "assets/images/logo/konturLogo.png"; @@ -18,6 +19,7 @@ import "./partnerSettings.scss"; export const PartnerSettings = () => { const { showNotification } = useNotification(); + const [tgToken, setTgToken] = useState(); const [inputsValue, setInputsValue] = useState({ name: "", oldPassword: "", @@ -30,6 +32,15 @@ export const PartnerSettings = () => { }); const [loader, setLoader] = useState(false); + const [tgLoader, setTgLoader] = useState(false); + + useEffect(() => { + apiRequest("/user-tg-bot/get-token", { + method: "GET" + }).then((data) => { + setTgToken(data.token); + }); + }, []); const setSettings = () => { if (inputsValue.name.length < 2) { @@ -80,6 +91,24 @@ export const PartnerSettings = () => { }); }); }; + + const handleCopy = async () => { + try { + await navigator.clipboard.writeText(tgToken); + showNotification({ + show: true, + text: "Телеграм токен успешно скопирован", + type: "success" + }); + } catch (err) { + showNotification({ + show: true, + text: "Ошибка копирования", + type: "error" + }); + } + }; + return (
@@ -183,6 +212,34 @@ export const PartnerSettings = () => { использования персональных данных
+ +
+

Телеграмм бот

+ +

Тelegram токен

+
+ {tgToken} +
+ +
+ {tgLoader ? ( + + ) : ( + + Скопировать + + )} +
+
+ + + + Ссылка на телеграм бот с инструкцией +
+
{/*

Документы и отчеты

Изменить провадера ЭДО

diff --git a/src/pages/PartnerSettings/partnerSettings.scss b/src/pages/PartnerSettings/partnerSettings.scss index cb1bbaa4..d5ae0f00 100644 --- a/src/pages/PartnerSettings/partnerSettings.scss +++ b/src/pages/PartnerSettings/partnerSettings.scss @@ -29,13 +29,14 @@ font-size: 15px; line-height: 18px; color: #000000; - margin: 15px 0 10px 0; + margin: 30px 0 10px 0; } &__input { display: flex; flex-direction: column; row-gap: 5px; + input { padding: 5px 10px; background: #eff2f7; @@ -46,6 +47,16 @@ outline: none; } + span { + padding: 5px 10px; + background: #eff2f7; + border-radius: 8px; + height: 35px; + border: none; + font-size: 15px; + outline: none; + } + .error { color: red; font-size: 12px; @@ -65,6 +76,18 @@ line-height: 18px; color: #000000; font-weight: 300; + + &-tg { + font-size: 15px; + font-weight: 400; + line-height: 18px; + + img { + width: 40px; + height: 40px; + margin-right: 20px; + } + } } &__buttons { @@ -140,6 +163,8 @@ display: flex; flex-direction: row; margin-top: 50px; + column-gap: 40px; + justify-content: center; } &__report,