diff --git a/src/components/elements/AppRoutes.jsx b/src/components/elements/AppRoutes.jsx index bff9f447..1fd225d0 100644 --- a/src/components/elements/AppRoutes.jsx +++ b/src/components/elements/AppRoutes.jsx @@ -23,6 +23,7 @@ import ContactPage from 'components/pages/ContactPage'; import PrivacyPage from 'components/pages/PrivacyPolicyPage'; import ContactSuccessPage from 'components/pages/ContactSuccessPage'; import TermsPage from 'components/pages/TermsPage'; +import AccountSettingsPage from 'components/pages/AccountSettingsPage'; // Elements import RequireAuth from 'components/elements/RequireAuth'; @@ -94,6 +95,7 @@ function AppRoutes() { element={} /> } /> + } /> ); } diff --git a/src/components/elements/DropdownMenu.jsx b/src/components/elements/DropdownMenu.jsx index 5b4a8647..9e200e3f 100644 --- a/src/components/elements/DropdownMenu.jsx +++ b/src/components/elements/DropdownMenu.jsx @@ -3,6 +3,24 @@ import { Link } from 'react-router-dom'; import { navStyleClasses } from 'styles/navbar'; import DownArrowIcon from 'components/elements/DownArrowIcon'; +function DropDownAction({ value, label, route, action }) { + if (action) { + return ( + {label} + ) + } else { + return ( + + {label} + + ) + } +} + function DropdownMenu({ label, options }) { return (
@@ -22,16 +40,15 @@ function DropdownMenu({ label, options }) { className={navStyleClasses.navSelectMenu} aria-labelledby="dropdownMenuButton2" > - {options.map(({ value, label, route }) => { + {options.map(({ value, label, route, action }) => { return (
  • - - {label} - + label={label} + route={route} + action={action} + />
  • ) })} diff --git a/src/components/elements/NavigationBar.jsx b/src/components/elements/NavigationBar.jsx index 22f12b2e..5a67e786 100644 --- a/src/components/elements/NavigationBar.jsx +++ b/src/components/elements/NavigationBar.jsx @@ -13,7 +13,10 @@ import { NAVBAR_EVENT_OPTIONS } from 'constants/navbar'; function NavigationBar() { const auth = useAuth(); const [colorTheme, setTheme] = useDarkMode(); - const signOut = () => auth.signOutCurrentUser(); + const authLinks = [ + { label: 'Settings', value: 'settings', route: '/account-settings' }, + { label: 'Sign Out', value: 'sign-out', action: () => auth.signOutCurrentUser() }, + ] return ( <> @@ -44,12 +47,14 @@ function NavigationBar() { alt="logo" />
    -
    - {auth.currentUser.isAuthenticated - ? - : Sign In + +
    + { auth.currentUser.isAuthenticated + ? + :
    Sign In
    }
    +
    - + +
    + +
    diff --git a/src/components/pages/AccountSettingsPage.jsx b/src/components/pages/AccountSettingsPage.jsx new file mode 100644 index 00000000..3c9008a6 --- /dev/null +++ b/src/components/pages/AccountSettingsPage.jsx @@ -0,0 +1,15 @@ +import React from 'react'; +import { useAuth } from 'hooks/authentication'; + +function AccountSettingsPage() { + const auth = useAuth(); + + return ( +
    +

    Email

    +

    {auth.currentUser.email}

    +
    + ); +} + +export default AccountSettingsPage;