feat : dynamic profile api and add logout btn
This commit is contained in:
@@ -4,6 +4,8 @@ import Button from "../../../../components/button";
|
||||
import { IoCopy } from "react-icons/io5";
|
||||
import Alert from "../../../../components/alert/Alert";
|
||||
import ProgressSpace from "../../../../components/progressSpace";
|
||||
import toast from "react-hot-toast";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
|
||||
const ModalConfigDetails = ({
|
||||
isOpen,
|
||||
@@ -11,13 +13,27 @@ const ModalConfigDetails = ({
|
||||
isDisabled,
|
||||
dateBuy,
|
||||
nameConfig,
|
||||
isShowTraffic,
|
||||
textCopy
|
||||
}: {
|
||||
isOpen: boolean;
|
||||
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
||||
isDisabled: boolean;
|
||||
dateBuy: string;
|
||||
nameConfig: string;
|
||||
isShowTraffic: boolean;
|
||||
textCopy: string;
|
||||
}) => {
|
||||
const navigate = useNavigate()
|
||||
const copyToClipboard = async (textToCopy: string) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(textToCopy);
|
||||
toast.success("متن با موفقیت کپی شد!");
|
||||
} catch (err) {
|
||||
toast.error(`Failed to copy: , ${err}`);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<MuiModal
|
||||
isOpenModal={isOpen}
|
||||
@@ -38,17 +54,17 @@ const ModalConfigDetails = ({
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<Button extra="!m-0 !px-2 !py-1.5 flex flex-row-reverse justify-center items-center gap-1 shadow-md shadow-white">
|
||||
<Button onClick={() => copyToClipboard(textCopy)} extra="!m-0 !px-2 !py-1.5 flex flex-row-reverse justify-center items-center gap-1 shadow-md shadow-white">
|
||||
کپی
|
||||
<IoCopy />
|
||||
</Button>
|
||||
<Button extra="!m-0 !px-2 !py-1.5 shadow-md shadow-white">
|
||||
<Button onClick={()=> navigate('/tutorial')} extra="!m-0 !px-2 !py-1.5 shadow-md shadow-white">
|
||||
آموزش
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{!isDisabled && (
|
||||
{!isDisabled || isShowTraffic && (
|
||||
<div className="w-full h-full">
|
||||
<ProgressSpace startSpace={100} endSpace={200} />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user