Commit 4aeea9b3 by asranov0003

feat: add delete account modal

parent 16152596
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
"selectDates": "Select dates", "selectDates": "Select dates",
"selectAppAndDates": "Select App & Dates", "selectAppAndDates": "Select App & Dates",
"from": "From", "from": "From",
"to": "To" "to": "To",
"confirm": "Confirm",
"password": "Password",
"passwordPlaceholder": "Enter your password"
}, },
"auth": { "auth": {
"entrance": "Sign In", "entrance": "Sign In",
...@@ -155,7 +158,8 @@ ...@@ -155,7 +158,8 @@
"cancel": "Cancel", "cancel": "Cancel",
"delete": "Delete", "delete": "Delete",
"search": "Search", "search": "Search",
"save": "Save" "save": "Save",
"confirm": "Confirm"
}, },
"notFound": { "notFound": {
"code": "404", "code": "404",
......
...@@ -8,7 +8,10 @@ ...@@ -8,7 +8,10 @@
"selectDates": "Выбрать даты", "selectDates": "Выбрать даты",
"selectAppAndDates": "Выбрать приложение и даты", "selectAppAndDates": "Выбрать приложение и даты",
"from": "От", "from": "От",
"to": "До" "to": "До",
"confirm": "Подтвердить",
"password": "Пароль",
"passwordPlaceholder": "Введите ваш пароль"
}, },
"auth": { "auth": {
"entrance": "Вход", "entrance": "Вход",
...@@ -150,7 +153,8 @@ ...@@ -150,7 +153,8 @@
"logout": "Выйти", "logout": "Выйти",
"cancel": "Отмена", "cancel": "Отмена",
"search": "Поиск", "search": "Поиск",
"save": "Сохранить" "save": "Сохранить",
"confirm": "Подтвердить"
}, },
"notFound": { "notFound": {
"code": "404", "code": "404",
......
...@@ -13,9 +13,12 @@ import { logout } from "../../stores/slices/authSlice"; ...@@ -13,9 +13,12 @@ import { logout } from "../../stores/slices/authSlice";
import CModal from "../../components/CModal"; import CModal from "../../components/CModal";
import CButton from "../../components/CButton"; import CButton from "../../components/CButton";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import CInput from "../../components/CInput";
const Settings: React.FC = () => { const Settings: React.FC = () => {
const [isOpenLogoutModal, setIsOpenLogoutModal] = useState(false); const [isOpenLogoutModal, setIsOpenLogoutModal] = useState(false);
const [isOpenDeleteAccountModal, setIsOpenDeleteAccountModal] =
useState(false);
const { language, changeLanguage } = useLanguage(); const { language, changeLanguage } = useLanguage();
const { t } = useTranslation(); const { t } = useTranslation();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
...@@ -24,6 +27,10 @@ const Settings: React.FC = () => { ...@@ -24,6 +27,10 @@ const Settings: React.FC = () => {
setIsOpenLogoutModal((prev) => !prev); setIsOpenLogoutModal((prev) => !prev);
}; };
const toggleDeleteAccountModal = () => {
setIsOpenDeleteAccountModal((prev) => !prev);
};
return ( return (
<div className="settings"> <div className="settings">
<h3 className="settings__title">{t("settings.title")}</h3> <h3 className="settings__title">{t("settings.title")}</h3>
...@@ -60,7 +67,10 @@ const Settings: React.FC = () => { ...@@ -60,7 +67,10 @@ const Settings: React.FC = () => {
<h3>{t("settings.account")}</h3> <h3>{t("settings.account")}</h3>
<div className="settings__content__action"> <div
className="settings__content__action"
onClick={toggleDeleteAccountModal}
>
<FiUserMinus className="settings__content__action__icon" />{" "} <FiUserMinus className="settings__content__action__icon" />{" "}
{t("settings.deleteAccount")} {t("settings.deleteAccount")}
</div> </div>
...@@ -97,6 +107,28 @@ const Settings: React.FC = () => { ...@@ -97,6 +107,28 @@ const Settings: React.FC = () => {
</div> </div>
} }
/> />
<CModal
isOpen={isOpenDeleteAccountModal}
onToggle={toggleDeleteAccountModal}
content={
<div className="modal__box">
<h3 className="modal__box__title">{t("common.confirm")}</h3>
<CInput
placeholder={t("common.passwordPlaceholder")}
label={t("common.password")}
type="password"
/>
<div className="modal__box__actions">
<CButton
title={t("button.cancel")}
onClick={toggleDeleteAccountModal}
/>
<CButton title={t("button.confirm")} variant="danger" />
</div>
</div>
}
/>
</div> </div>
); );
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment