diff --git a/src/App.jsx b/src/App.jsx index dfe1af0..abbe919 100755 --- a/src/App.jsx +++ b/src/App.jsx @@ -121,12 +121,11 @@ function App() { overflow: "hidden", bgcolor: "background.default" }}> - - - setIsDarkMode(!isDarkMode)} - sx={{ position: "absolute", top: 10, right: 10 }} + )} diff --git a/src/Components/Layout/Dashboard.jsx b/src/Components/Layout/Dashboard.jsx index a747672..5df3408 100755 --- a/src/Components/Layout/Dashboard.jsx +++ b/src/Components/Layout/Dashboard.jsx @@ -41,22 +41,20 @@ const MainContent = styled(Box)(({ theme }) => ({ flexGrow: 1, display: 'flex', flexDirection: 'column', - padding: theme.spacing(2.5), // 20px + padding: theme.spacing(2.5), overflow: 'auto', backgroundColor: theme.palette.background.default, })); const Content = styled(Box)(({ theme }) => ({ backgroundColor: theme.palette.custom.modalBackground, - //padding: theme.spacing(2.5), borderRadius: '10px', - //boxShadow: theme.shadows[2], maxWidth: '100%', overflow: 'auto', color: theme.palette.custom.modalText, })); -const Dashboard = () => { +const Dashboard = ({ isDarkMode, setIsDarkMode }) => { const { tabs, activeTab, handleOpenTab, handleCloseTab, setActiveTab } = useTabs("Главная"); const { sidebarWidth, startResizing } = useSidebarResize(290); const [tabContent, setTabContent] = useState({}); @@ -112,31 +110,49 @@ const Dashboard = () => { startResizing={startResizing} collapsed={collapsed} setCollapsed={setCollapsed} + isDarkMode={isDarkMode} + setIsDarkMode={setIsDarkMode} /> {/* Основной контент */} - - {/* Вкладки */} - - - {/* Контент вкладки */} - - + {/* Вкладки*/} + + - - + + + {/* Остальной контент */} + + {/* Контент вкладки */} + + + + + ); }; diff --git a/src/Components/Layout/SidebarMenu.jsx b/src/Components/Layout/SidebarMenu.jsx index af22fb1..ca4fc59 100644 --- a/src/Components/Layout/SidebarMenu.jsx +++ b/src/Components/Layout/SidebarMenu.jsx @@ -17,6 +17,7 @@ import MenuItem from "./SidebarMenuComponents/MenuItem"; import SidebarFooter from "./SidebarMenuComponents/SidebarFooter"; import { statusManager1 } from "../TreeChart/dataUtils"; + const SidebarResizer = styled('div')(({ theme }) => ({ width: "5px", cursor: "ew-resize", @@ -32,10 +33,10 @@ const SidebarResizer = styled('div')(({ theme }) => ({ zIndex: 2 })); -const SidebarMenu = ({ data, onOpenTab, sidebarWidth, startResizing, collapsed, setCollapsed }) => { +const SidebarMenu = ({ data, onOpenTab, sidebarWidth, startResizing, collapsed, setCollapsed, isDarkMode, setIsDarkMode }) => { const [hovered, setHovered] = useState(false); const [menuData, setMenuData] = useState(data); - const contentCache = useRef({}); + const contentCache = useRef({}); useEffect(() => { if (data) { @@ -51,14 +52,14 @@ const SidebarMenu = ({ data, onOpenTab, sidebarWidth, startResizing, collapsed, const handleSelectItem = (id, title, children) => { onOpenTab(id, title); - + contentCache.current = tabContent({ items: children }, contentCache.current); if (contentCache.current[id]) { onOpenTab(id, title, contentCache.current[id].content); } }; - + const drawerWidth = collapsed ? 64 : sidebarWidth; @@ -149,9 +150,13 @@ const SidebarMenu = ({ data, onOpenTab, sidebarWidth, startResizing, collapsed, {/* Футер */} - {!collapsed && ( - - )} + + + {/* Ресайзер */} diff --git a/src/Components/Layout/SidebarMenuComponents/SidebarFooter.jsx b/src/Components/Layout/SidebarMenuComponents/SidebarFooter.jsx index 0d4d4e4..54a2b7b 100644 --- a/src/Components/Layout/SidebarMenuComponents/SidebarFooter.jsx +++ b/src/Components/Layout/SidebarMenuComponents/SidebarFooter.jsx @@ -1,9 +1,13 @@ import React from "react"; +import { Brightness4, Brightness7 } from "@mui/icons-material"; +import { IconButton, Tooltip } from "@mui/material"; import { List, ListItem, ListItemText, - styled + styled, + Switch, + Box } from "@mui/material"; const FooterList = styled(List)(({ theme }) => ({ @@ -18,31 +22,57 @@ const FooterListItem = styled(ListItem)(({ theme }) => ({ backgroundColor: theme.palette.custom.sidebarHover, }, padding: theme.spacing(1, 2), + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center' })); -const SidebarFooter = () => { +const SidebarFooter = ({ collapsed, isDarkMode, setIsDarkMode }) => { return ( - - - - - + {!collapsed && ( + + + + )} + + {!collapsed && ( + + )} + + + + setIsDarkMode(!isDarkMode)} + sx={{ color: 'custom.sidebarText' }} + > + {isDarkMode ? : } + + + {!collapsed && ( + setIsDarkMode(!isDarkMode)} + size="small" + /> + )} + ); }; -export default SidebarFooter; \ No newline at end of file +export default SidebarFooter; diff --git a/src/Components/UI/MUItabs.jsx b/src/Components/UI/MUItabs.jsx index 0ea89aa..4a03b60 100644 --- a/src/Components/UI/MUItabs.jsx +++ b/src/Components/UI/MUItabs.jsx @@ -16,7 +16,7 @@ const StyledTab = styled(Tab)(({ theme }) => ({ const CustomTabs = ({ tabs, activeTab, onTabClick, onCloseTab }) => { const handleMouseDown = (e, id) => { - if (e.button === 1) { // Middle mouse button + if (e.button === 1) { e.preventDefault(); onCloseTab(id); } diff --git a/src/Components/hooks/TabContent.jsx b/src/Components/hooks/TabContent.jsx index bdb6226..3ab4279 100644 --- a/src/Components/hooks/TabContent.jsx +++ b/src/Components/hooks/TabContent.jsx @@ -6,7 +6,7 @@ const TabContent = ({ activeTab, statusHistories, treeData1, tabContent, handleO if (activeTab === "Главная") { return (
-

Общий мониторинг состояния системы

+

Общий мониторинг состояния системы