From e7db7c705b47299d02a2151c059d2f9167413b57 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Mon, 15 Jun 2026 22:21:09 +0330 Subject: [PATCH] feat(dashboard): loading spinner and success toast on profile save MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ثبت اطلاعات button gave no feedback. Show a spinner while saving (both POST and PATCH) and a 'اطلاعات با موفقیت ثبت شد' toast on success, for the info tab and the medical-history sub-tabs. Co-Authored-By: Claude Opus 4.8 --- .../dashboard/userAccount/detailUser/index.js | 2 ++ .../detailUser/information/ButtonSendData.js | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/components/dashboard/userAccount/detailUser/index.js b/components/dashboard/userAccount/detailUser/index.js index 99468eb..069dee1 100644 --- a/components/dashboard/userAccount/detailUser/index.js +++ b/components/dashboard/userAccount/detailUser/index.js @@ -13,6 +13,7 @@ import FamilyHistory from "./familyHistory"; import Relatives from "./relatives"; import { removeAdditionalKeysDashboard } from "@/helper"; import Cookies from "js-cookie"; +import { toast } from "react-toastify"; import LoadingComponent from "@/app/component/LoadingComponent"; function DetailUser({ user, isTurnsDetails, setIsTurnsDetails }) { @@ -43,6 +44,7 @@ function DetailUser({ user, isTurnsDetails, setIsTurnsDetails }) { ) .then(() => { setLoading(false); + toast.success("اطلاعات با موفقیت ثبت شد"); }) .catch(() => { setLoading(false); diff --git a/components/dashboard/userAccount/detailUser/information/ButtonSendData.js b/components/dashboard/userAccount/detailUser/information/ButtonSendData.js index cebd7d1..77f1f0d 100644 --- a/components/dashboard/userAccount/detailUser/information/ButtonSendData.js +++ b/components/dashboard/userAccount/detailUser/information/ButtonSendData.js @@ -5,8 +5,9 @@ import { removeAdditionalKeysDashboard, } from "@/helper"; import { request } from "@/services/response"; -import { Button } from "@mui/material"; +import { Button, CircularProgress } from "@mui/material"; import Cookies from "js-cookie"; +import { toast } from "react-toastify"; function ButtonSendData({ loading, @@ -51,6 +52,7 @@ function ButtonSendData({ uuid: response.uuid, }); setLoading(false); + toast.success("اطلاعات با موفقیت ثبت شد"); }) .catch(() => { setLoading(false); @@ -73,6 +75,7 @@ function ButtonSendData({ ) .then(() => { setLoading(false); + toast.success("اطلاعات با موفقیت ثبت شد"); }) .catch((err) => handleErrReq(err)); }; @@ -96,8 +99,14 @@ function ButtonSendData({ !mt-[32px] sm:!mt-[38px] md:!mt-[43px] lg:!mt-[48px] !px-[16px] sm:!px-[19px] md:!px-[22px] lg:!px-[24px] `} > - ثبت اطلاعات - + {loading ? ( + + ) : ( + <> + ثبت اطلاعات + + + )} ); }