refactor: remove unused components and files related to date filtering and doctor search
- Deleted Date.js and FilterDate.js components as they are no longer needed. - Removed SearchDoctor.js component which was responsible for searching doctors. - Cleaned up the Head component by removing references to the deleted Date and SearchDoctor components. - Removed TurnsPage component and its associated List component, which were not utilized. - Deleted Cards and Table components from the list directory as they were not in use. - Removed user account related components including Tab, Head, and Form components. - Cleaned up bank account components including List, Item, and modal components. - Removed representation adapters and related functions that were not in use.
This commit is contained in:
@@ -8,10 +8,8 @@ import ProfileD from "@/components/icons/ProfileD";
|
||||
import NotificationD from "@/components/icons/NotificationD";
|
||||
import { Button } from "@mui/material";
|
||||
import ArrowLeftSideBar from "@/components/icons/ArrowLeftSideBar";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useState } from "react";
|
||||
import ModalLogout from "../../../app/component/ModalLogout";
|
||||
import Cookies from "js-cookie";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
function List({
|
||||
value,
|
||||
@@ -20,44 +18,13 @@ function List({
|
||||
setIsTurnsDetails,
|
||||
setIsOpenSide,
|
||||
}) {
|
||||
const router = useRouter();
|
||||
const [hasRepresentationRole, setHasRepresentationRole] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const userInfo = Cookies.get("userInfo");
|
||||
if (userInfo) {
|
||||
try {
|
||||
const parsedUserInfo = JSON.parse(userInfo);
|
||||
const roles = parsedUserInfo?.roles || {};
|
||||
const hasRole = Object.values(roles).includes("representation");
|
||||
setHasRepresentationRole(hasRole);
|
||||
} catch (error) {
|
||||
console.error("Error parsing userInfo:", error);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
|
||||
const baseListMenu = [
|
||||
const listMenu = [
|
||||
{ name: "حساب کاربری", icon: <ProfileD active={value === 0} />, action: "tab" },
|
||||
{ name: "نوبت های من", icon: <CalndarD active={value === 1} />, action: "tab" },
|
||||
{ name: "تراکنش های من", icon: <CardD active={value === 2} />, action: "tab" },
|
||||
];
|
||||
|
||||
// اگر نقش representation دارد، داشبورد نماینده را اضافه کن
|
||||
if (hasRepresentationRole) {
|
||||
baseListMenu.push({
|
||||
name: "داشبورد نماینده",
|
||||
icon: <ProfileD active={value === 3} />,
|
||||
action: "navigate",
|
||||
path: "/panel/dashboard"
|
||||
});
|
||||
}
|
||||
|
||||
const listMenu = [
|
||||
...baseListMenu,
|
||||
{ name: "نظرات من", icon: <MessageD active={value === hasRepresentationRole ? 4 : 3} />, action: "tab" },
|
||||
{ name: "پیام ها", icon: <NotificationD active={value === hasRepresentationRole ? 5 : 4} />, action: "tab" },
|
||||
{ name: "خروج", icon: <LogoutD active={value === hasRepresentationRole ? 6 : 5} />, action: "logout" },
|
||||
{ name: "نظرات من", icon: <MessageD active={value === 3} />, action: "tab" },
|
||||
{ name: "پیام ها", icon: <NotificationD active={value === 4} />, action: "tab" },
|
||||
{ name: "خروج", icon: <LogoutD active={value === 5} />, action: "logout" },
|
||||
];
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
@@ -70,8 +37,6 @@ function List({
|
||||
|
||||
if (item.action === "logout") {
|
||||
handleOpen();
|
||||
} else if (item.action === "navigate") {
|
||||
router.push(item.path);
|
||||
} else {
|
||||
setValue(idx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user