diff --git a/frontend/src/components/AccountSettings.jsx b/frontend/src/components/AccountSettings.jsx new file mode 100644 index 0000000..191564b --- /dev/null +++ b/frontend/src/components/AccountSettings.jsx @@ -0,0 +1,150 @@ +import React from 'react'; +import { + Modal, + Badge, + Button, + Group, + Title, + Stack, + Accordion, + TextInput, + Text, + PasswordInput, + Box, +} from '@mantine/core'; +import { useAuth } from '../contexts/AuthContext'; + +const AccordionControl = ({ children }) => ( + + {children} + +); + +const ProfileSettings = ({ displayName, email }) => ( + + + + +); + +const SecuritySettings = () => ( + + + + + + Password must be at least 8 characters long and contain at least one + uppercase letter, one lowercase letter, one number, and one special + character. + + +); + +const DangerZone = () => ( + + + console.log('Delete Account')} + fullWidth + disabled + > + Delete Account + + + +); + +const AccountSettings = ({ opened, onClose }) => { + const { user } = useAuth(); + return ( + Account Settings} + centered + size="lg" + > + + + Changes are currently disabled + + + ({ + control: { + paddingTop: theme.spacing.md, + paddingBottom: theme.spacing.md, + }, + item: { + borderBottom: `1px solid ${ + theme.colorScheme === 'dark' + ? theme.colors.dark[4] + : theme.colors.gray[3] + }`, + '&[data-active]': { + backgroundColor: + theme.colorScheme === 'dark' + ? theme.colors.dark[7] + : theme.colors.gray[0], + }, + }, + chevron: { + '&[data-rotate]': { + transform: 'rotate(180deg)', + }, + }, + })} + > + + Profile + + + + + + + Security + + + + + + + Danger Zone + + + + + + + + + Cancel + + Save Changes + + + + ); +}; + +export default AccountSettings; diff --git a/frontend/src/components/UserMenu.jsx b/frontend/src/components/UserMenu.jsx index d01a132..bca0295 100644 --- a/frontend/src/components/UserMenu.jsx +++ b/frontend/src/components/UserMenu.jsx @@ -10,99 +10,108 @@ import { } from '@mantine/core'; import { IconUser, IconLogout, IconUserCircle } from '@tabler/icons-react'; import { useAuth } from '../contexts/AuthContext'; +import AccountSettings from './AccountSettings'; const UserMenu = () => { + const [accountSettingsOpened, setAccountSettingsOpened] = useState(false); const [opened, setOpened] = useState(false); - const { logout } = useAuth(); + const { user, 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], - }, - })} + <> + + + setOpened((o) => !o)} > - - - Account Settings - - + + + - ({ - borderRadius: theme.radius.sm, - '&:hover': { - backgroundColor: - theme.colorScheme === 'dark' - ? theme.colors.dark[5] - : theme.colors.gray[0], - }, - })} - > - - - - Logout - + + + {/* User Info Section */} + + + + + + + {user.displayName || user.email} + + - - - - + + + + {/* Menu Items */} + { + setAccountSettingsOpened(true); + setOpened(false); + }} + 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 + + + + + + + + setAccountSettingsOpened(false)} + /> + > ); };