diff --git a/www/src/components/auth/AuthButton.tsx b/www/src/components/auth/AuthButton.tsx index 89973744..f8097f6d 100644 --- a/www/src/components/auth/AuthButton.tsx +++ b/www/src/components/auth/AuthButton.tsx @@ -2,14 +2,7 @@ import { useAuth0 } from '@auth0/auth0-react'; import { Button } from '@material-ui/core'; import React, { FC } from 'react'; -const LogoutButton: FC = () => { - const { logout } = useAuth0(); - return ( - - ); -}; +import UserProfile from './UserProfile'; const LoginButton: FC = () => { const { loginWithRedirect } = useAuth0(); @@ -24,7 +17,7 @@ const AuthButton: FC = () => { const { isAuthenticated } = useAuth0(); if (isAuthenticated) { - return ; + return ; } return ; diff --git a/www/src/components/auth/UserProfile.tsx b/www/src/components/auth/UserProfile.tsx new file mode 100644 index 00000000..ff6e68ef --- /dev/null +++ b/www/src/components/auth/UserProfile.tsx @@ -0,0 +1,71 @@ +import { useAuth0 } from '@auth0/auth0-react'; +import { IconButton, Menu, MenuItem, Typography } from '@material-ui/core'; +import { makeStyles } from '@material-ui/core/styles'; +import { AccountCircle } from '@material-ui/icons'; +import React, { FC, useRef, useState } from 'react'; + +const UserProfile: FC = () => { + const classes = useStyles(); + const userProfileIcon = useRef(null); + const [isMenuOpen, setIsMenuOpen] = useState(false); + const { logout } = useAuth0(); + const { user } = useAuth0(); + const ccid = user?.email?.split('@')[0] ?? ''; + + return ( + <> + { + setIsMenuOpen(true); + }} + > + + + setIsMenuOpen(false)} + className={classes.menu} + > + Signed in as: {ccid} + logout()} className={classes.menu_text} style={{ marginBottom: '100px' }}> + Settings + + logout()} className={classes.menu_text}> + Log out + + + + ); +}; + +const useStyles = makeStyles((theme) => ({ + menu: { + '& .MuiPaper-root': { + backgroundColor: theme.palette.primary.dark, + }, + }, + menu_text: { + color: theme.palette.text.secondary, + fontSize: 20, + fontWeight: 500, + padding: '15px', + }, +})); + +export default UserProfile;