From 642a3a48d75c6ef1f021e53ed8a2369827db2f1c Mon Sep 17 00:00:00 2001 From: AmirHossein Mahmoodi Date: Sun, 18 May 2025 16:00:19 +0330 Subject: [PATCH] formatting --- .../headerWithLogo/HaederBottom/index.jsx | 35 +++++++++++++------ .../headerWithLogo/HaederTop/index.jsx | 12 ------- .../dashboard/headerWithLogo/index.jsx | 4 +-- .../Sidebar/SidebarListItems.jsx | 12 +++++-- .../headerWithSidebar/Sidebar/SidebarMenu.jsx | 24 ++++++------- .../Sidebar/SidebarSubitems.jsx | 12 +++++-- .../dashboard/headerWithSidebar/index.jsx | 4 +-- 7 files changed, 58 insertions(+), 45 deletions(-) delete mode 100644 src/components/layouts/dashboard/headerWithLogo/HaederTop/index.jsx diff --git a/src/components/layouts/dashboard/headerWithLogo/HaederBottom/index.jsx b/src/components/layouts/dashboard/headerWithLogo/HaederBottom/index.jsx index 1ab9f22..3a1de86 100644 --- a/src/components/layouts/dashboard/headerWithLogo/HaederBottom/index.jsx +++ b/src/components/layouts/dashboard/headerWithLogo/HaederBottom/index.jsx @@ -1,26 +1,41 @@ "use client"; -import { Stack, Typography } from "@mui/material"; +import { Box, Stack, Typography } from "@mui/material"; import Image from "next/image"; import RmsLogo from "@/assets/images/rmsLogo.png"; +import HeaderLogo from "@/assets/images/headerLogo.png"; const HeaderBottom = () => { return ( theme.palette.primary2.main, }} - spacing={4} - alignItems={"center"} - direction={"row"} + spacing={2} > - - - theme.palette.primary2.contrastText }}> - سامانه جامع راهداری - - theme.palette.primary2.contrastText }}>rms.rmto.ir + + + + theme.palette.primary2.contrastText }}> + سامانه جامع راهداری + + theme.palette.primary2.contrastText }}>rms.rmto.ir + + + + theme.palette.primary.main, + borderRadius: 2, + borderStyle: "dashed", + }}> + + ); diff --git a/src/components/layouts/dashboard/headerWithLogo/HaederTop/index.jsx b/src/components/layouts/dashboard/headerWithLogo/HaederTop/index.jsx deleted file mode 100644 index 4926625..0000000 --- a/src/components/layouts/dashboard/headerWithLogo/HaederTop/index.jsx +++ /dev/null @@ -1,12 +0,0 @@ -import { Stack } from "@mui/material"; -import Image from "next/image"; -import HeaderLogo from "@/assets/images/headerLogo.png"; - -const HeaderTop = () => { - return ( - - - - ); -}; -export default HeaderTop; diff --git a/src/components/layouts/dashboard/headerWithLogo/index.jsx b/src/components/layouts/dashboard/headerWithLogo/index.jsx index 9b59fa6..af23434 100644 --- a/src/components/layouts/dashboard/headerWithLogo/index.jsx +++ b/src/components/layouts/dashboard/headerWithLogo/index.jsx @@ -1,11 +1,9 @@ -import { Box, Stack } from "@mui/material"; -import HeaderTop from "./HaederTop"; +import { Stack } from "@mui/material"; import HeaderBottom from "./HaederBottom"; const HeaderWithLogo = () => { return ( - ); diff --git a/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarListItems.jsx b/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarListItems.jsx index c61dbe3..5b6c9df 100644 --- a/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarListItems.jsx +++ b/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarListItems.jsx @@ -1,10 +1,12 @@ import { ExpandLess, ExpandMore } from "@mui/icons-material"; -import { Collapse, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Stack } from "@mui/material"; +import { Collapse, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Stack, useMediaQuery, useTheme } from "@mui/material"; import Link from "next/link"; import SidebarBadge from "./SidebarBadge"; import SidebarSubitems from "./SidebarSubitems"; -const SidebarListItems = ({ menuItem, dispatch }) => { +const SidebarListItems = ({ menuItem, dispatch, handleDrawerClose }) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down("md")); return ( <> @@ -17,6 +19,10 @@ const SidebarListItems = ({ menuItem, dispatch }) => { onClick={() => { if (menuItem.type !== "page") { dispatch({ type: "COLLAPSE_MENU", id: menuItem.id }); + } else { + if (isMobile) { + handleDrawerClose() + } } }} > @@ -56,7 +62,7 @@ const SidebarListItems = ({ menuItem, dispatch }) => { }} > {menuItem.Subitems.map((subitem, index) => { - return ; + return ; })} ) : null} diff --git a/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarMenu.jsx b/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarMenu.jsx index 3be25b1..8359ad9 100644 --- a/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarMenu.jsx +++ b/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarMenu.jsx @@ -54,16 +54,16 @@ function reducer(state, action) { return state.map((item) => item.hasSubitems ? { - ...item, - Subitems: item.Subitems.map((subitem) => - subitem.hasSubitems - ? { - ...subitem, - Subitems: toggleSubitems(subitem.Subitems, action.id), - } - : subitem - ), - } + ...item, + Subitems: item.Subitems.map((subitem) => + subitem.hasSubitems + ? { + ...subitem, + Subitems: toggleSubitems(subitem.Subitems, action.id), + } + : subitem + ), + } : item ); @@ -75,7 +75,7 @@ function reducer(state, action) { } } -const SidebarMenu = () => { +const SidebarMenu = ({ handleDrawerClose }) => { const { data: userPermissions } = usePermissions(); const [menuItems, dispatch] = useReducer(reducer, process.env.NODE_ENV == "production" ? pageMenu : pageMenuDev); const pathname = usePathname(); @@ -105,7 +105,7 @@ const SidebarMenu = () => { {userPermissions && ( {menuItems.map((menuItem) => { - return ; + return ; })} )} diff --git a/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarSubitems.jsx b/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarSubitems.jsx index ba0cd5f..7567889 100644 --- a/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarSubitems.jsx +++ b/src/components/layouts/dashboard/headerWithSidebar/Sidebar/SidebarSubitems.jsx @@ -1,9 +1,11 @@ import { ExpandLess, ExpandMore } from "@mui/icons-material"; -import { Box, Collapse, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Stack } from "@mui/material"; +import { Box, Collapse, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Stack, useMediaQuery, useTheme } from "@mui/material"; import Link from "next/link"; import SidebarBadge from "./SidebarBadge"; -const SidebarSubitems = ({ subitem, dispatch }) => { +const SidebarSubitems = ({ subitem, dispatch, handleDrawerClose }) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down("md")); return ( <> @@ -16,6 +18,10 @@ const SidebarSubitems = ({ subitem, dispatch }) => { onClick={() => { if (subitem.type !== "page") { dispatch({ type: "COLLAPSE_SUB_ITEMS", id: subitem.id }); + } else { + if (isMobile) { + handleDrawerClose() + } } }} > @@ -65,7 +71,7 @@ const SidebarSubitems = ({ subitem, dispatch }) => { }} > {subitem.Subitems.map((subSubitem, index) => { - return ; + return ; })} ) : null} diff --git a/src/components/layouts/dashboard/headerWithSidebar/index.jsx b/src/components/layouts/dashboard/headerWithSidebar/index.jsx index 1a35210..3ef1f41 100644 --- a/src/components/layouts/dashboard/headerWithSidebar/index.jsx +++ b/src/components/layouts/dashboard/headerWithSidebar/index.jsx @@ -10,7 +10,7 @@ import { headerMenu } from "@/core/utils/headerMenu"; import SidebarMenu from "./Sidebar/SidebarMenu"; const drawerWidth = 300; -const headersHeight = 136; +const headersHeight = 72; const Main = styled(Stack, { shouldForwardProp: (prop) => prop !== "open" })(({ theme, open }) => ({ flexGrow: 1, @@ -137,7 +137,7 @@ const HeaderWithSidebar = ({ children }) => { - + v{process.env.NEXT_PUBLIC_VERSION}