diff --git a/frontend/src/components/Header.jsx b/frontend/src/components/Header.jsx index b9f894a..be18fd8 100644 --- a/frontend/src/components/Header.jsx +++ b/frontend/src/components/Header.jsx @@ -1,5 +1,6 @@ import React from 'react'; -import { Group, Text, Avatar } from '@mantine/core'; +import { Group, Text } from '@mantine/core'; +import UserMenu from './UserMenu'; import WorkspaceSwitcher from './WorkspaceSwitcher'; import Settings from './Settings'; @@ -11,7 +12,7 @@ const Header = () => { - + diff --git a/frontend/src/components/UserMenu.jsx b/frontend/src/components/UserMenu.jsx new file mode 100644 index 0000000..d01a132 --- /dev/null +++ b/frontend/src/components/UserMenu.jsx @@ -0,0 +1,109 @@ +import React, { useState } from 'react'; +import { + Avatar, + Popover, + Stack, + UnstyledButton, + Group, + Text, + Divider, +} from '@mantine/core'; +import { IconUser, IconLogout, IconUserCircle } from '@tabler/icons-react'; +import { useAuth } from '../contexts/AuthContext'; + +const UserMenu = () => { + const [opened, setOpened] = useState(false); + const { logout } = useAuth(); + + const handleLogout = () => { + logout(); + }; + + return ( + + + setOpened((o) => !o)} + > + + + + + + + {/* User Info Section */} + + + + +
+ + John Doe + + + john.doe@example.com + +
+
+ + + + {/* Menu Items */} + console.log('Account settings')} + px="sm" + py="xs" + style={(theme) => ({ + borderRadius: theme.radius.sm, + '&:hover': { + backgroundColor: + theme.colorScheme === 'dark' + ? theme.colors.dark[5] + : theme.colors.gray[0], + }, + })} + > + + + Account Settings + + + + ({ + borderRadius: theme.radius.sm, + '&:hover': { + backgroundColor: + theme.colorScheme === 'dark' + ? theme.colors.dark[5] + : theme.colors.gray[0], + }, + })} + > + + + + Logout + + + +
+
+
+ ); +}; + +export default UserMenu;