From cb030a01d2a3c4c077482ff22a7fd4418ccc5814 Mon Sep 17 00:00:00 2001 From: DmitriyA Date: Wed, 16 Jul 2025 10:22:06 -0400 Subject: [PATCH] added profile page and logout --- src/App.jsx | 1 + src/Components/Layout/Dashboard.jsx | 19 +++++++-- src/Components/UI/ProfileMenu.jsx | 66 +++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 3 deletions(-) create mode 100644 src/Components/UI/ProfileMenu.jsx diff --git a/src/App.jsx b/src/App.jsx index 2406af5..bbc0c28 100755 --- a/src/App.jsx +++ b/src/App.jsx @@ -5,6 +5,7 @@ import LoginModal from "./Components/UI/LoginModal"; import { lightTheme, darkTheme } from "./Style/theme"; import Logo from './assets/images/logo.svg?react'; import { checkAuth } from "./Components/UI/auth"; +import axios from "axios"; function App() { const [authState, setAuthState] = useState({ diff --git a/src/Components/Layout/Dashboard.jsx b/src/Components/Layout/Dashboard.jsx index 48ac303..baf6004 100755 --- a/src/Components/Layout/Dashboard.jsx +++ b/src/Components/Layout/Dashboard.jsx @@ -8,9 +8,9 @@ import useSidebarResize from "../hooks/useSidebarResize"; import TabContent from "../hooks/TabContent"; import menuData from "../TreeChart/menuData.json"; import SidebarMenuWrapper from "./SidebarMenuWrapper"; -import MetricTabContent from "./MetricTabContent" +import MetricTabContent from "./MetricTabContent"; +import ProfileMenu from "../UI/ProfileMenu"; -// Стилизованные компоненты const DashboardContainer = styled(Box)(({ theme }) => ({ display: 'flex', height: '100vh', @@ -37,7 +37,7 @@ const Content = styled(Box)(({ theme }) => ({ color: theme.palette.custom.modalText, })); -const Dashboard = ({ isDarkMode, setIsDarkMode, user }) => { +const Dashboard = ({ isDarkMode, setIsDarkMode, user, onLogout }) => { const { tabs, activeTab, handleOpenTab, handleCloseTab, setActiveTab } = useTabs("Главная"); const [tabContent, setTabContent] = useState({}); const [treeData1, setTreeData1] = useState(menuData); @@ -133,6 +133,19 @@ const Dashboard = ({ isDarkMode, setIsDarkMode, user }) => { return ( + + theme.zIndex.tooltip + 10, + pointerEvents: 'auto' + }} + > + + + {/* Сайдбар */} { + const [anchorEl, setAnchorEl] = useState(null); + const open = Boolean(anchorEl); + + const handleOpen = (event) => { + setAnchorEl(event.currentTarget); + }; + + const handleClose = () => { + setAnchorEl(null); + }; + + const handleLogoutClick = () => { + handleClose(); + onLogout(); + }; + + return ( + <> + + + + {user?.login?.[0]?.toUpperCase() || '?'} + + + + + + + {user?.login || 'Неизвестный'} + + + + Выйти + + + + ); +}; + +export default ProfileMenu;