add validation and basic api && change design sidebar

This commit is contained in:
ehsanahmadi456
2025-04-01 15:38:07 +03:30
parent b09957f97c
commit 13a9de2438
8 changed files with 41 additions and 12 deletions
+1
View File
@@ -6,6 +6,7 @@ function LogoutOrangeP() {
height="20"
viewBox="0 0 20 20"
fill="none"
className="min-w-[20px] min-h-[20px] max-w-[20px] max-h-[20px]"
>
<path
d="M14.5334 12.1837L16.6668 10.0503L14.5334 7.91699"
+8 -1
View File
@@ -1,8 +1,15 @@
import { styleDefault } from "@/mui";
import { Box, Button, Modal } from "@mui/material";
import CloseModalD from "@/components/icons/CloseModalD";
import { removeToken } from "@/utils";
function ModalLogout({ open, handleClose }) {
const logout = () => {
removeToken();
window.location.pathname = '/login'
handleClose();
};
return (
<Modal open={open} onClose={handleClose}>
<Box
@@ -31,7 +38,7 @@ function ModalLogout({ open, handleClose }) {
</Button>
<Button
variant="contained"
onClick={handleClose}
onClick={logout}
className="!py-[4px] md:!py-[6px] !min-h-[32px] md:!min-h-[39px] lg:!min-h-[46px] lg:!py-[8px] !px-[10px] md:!px-[14px] lg:!px-[18px] !rounded-[4px] !text-[#EFEFEF] !text-[12px] md:!text-[14px] lg:!text-[16px] !font-medium"
>
خروج
+3 -3
View File
@@ -43,14 +43,14 @@ function Sidebar({ active, setActive, open, setOpen }) {
<Links open={open} setActive={setActive} />
</div>
<div
className={`w-full flex justify-center overflow-hidden transition-all duration-500 ${
open ? "!max-w-full" : "!max-w-0"
className={`w-full flex logout-btn justify-center overflow-hidden transition-all duration-500 ${
open ? "!max-w-full" : "!max-w-[36px]"
}`}
>
<Button
variant="text"
onClick={handleOpen}
className="!flex !w-fit !items-center !justify-center !gap-[10px] !py-[8px] !px-[16px] !text-[#F17732] !text-[16px] !font-medium"
className="!flex !w-fit !items-center !justify-start !gap-[10px] !py-[8px] !px-[16px] !text-[#F17732] !text-[16px] !font-medium"
>
<LogoutOrangeP />
خروج از حساب
@@ -24,13 +24,12 @@ function ModalAddCard() {
const updateNum = (value, type, name) => {
const parseValue = +value;
const { max } = validate_phone_number;
const validateValue = parseValue > max ? data[name].value : value;
changeData(validateValue, name);
changeData(parseValue, name);
};
const isValidData = data.card && data.shaba && data.value && data.value.value;
return (
<>
{/* Button Modal */}
@@ -69,6 +68,7 @@ function ModalAddCard() {
<Button
variant="contained"
onClick={handleClose}
disabled={!isValidData}
className="!min-w-[134px] !rounded-[4px] !h-[40px] md:!h-[44px] lg:!h-[48px] !text-[#EFEFEF] !text-[16px] !font-medium"
>
ذخیره