diff --git a/client/src/App.tsx b/client/src/App.tsx index 309c1e6..5e4176b 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -11,6 +11,7 @@ import { Footer } from "./Navigation/Footer"; import { About } from "./About"; import { UserSettings } from "./Users/UserSettings"; import { UserContextProvider } from "./Users/UserContext"; +import OrganizationSettings from "./Organization/OrganizationSettings"; const App: React.FC = () => { return ( @@ -26,6 +27,10 @@ const App: React.FC = () => { + diff --git a/client/src/Navigation/DrawerMenu.tsx b/client/src/Navigation/DrawerMenu.tsx index c35ff28..f81b31d 100644 --- a/client/src/Navigation/DrawerMenu.tsx +++ b/client/src/Navigation/DrawerMenu.tsx @@ -1,12 +1,14 @@ -import React, { ReactElement, useState } from "react"; +import React, { ReactElement, useContext, useState } from "react"; import { DrawerIcon } from "../Icons/DrawerIcon"; import "./DrawerMenu.css"; import { LinkButton } from "../Buttons/Buttons"; import { DrawerCloseIcon } from "./DrawerCloseIcon"; import { NavLink } from "react-router-dom"; import LogoBold from "../Icons/TrackedIconBold.svg"; +import UserContext from "../Users/UserContext"; export const DrawerMenu: React.FC = (): ReactElement => { + const tsrUser = useContext(UserContext); const [drawerOpen, setDrawerOpen] = useState(false); const openDrawer = () => setDrawerOpen(true); const closeDrawer = () => setDrawerOpen(false); @@ -43,6 +45,26 @@ export const DrawerMenu: React.FC = (): ReactElement => { + {tsrUser ? ( + <> + + Organizations + {tsrUser.settings.organizations.map((org) => { + return ( + + {org.organizationDisplayName} + + ); + })} + + > + ) : ( + <>> + )} + Settings { + const tsrUser = useContext(UserContext); + const url = window.location.href; + const orgPath = url.length - 1; + const orgId = url[orgPath]; + + useEffect(() => { + if (tsrUser === undefined) { + return; + } + }, [tsrUser]); + + if (tsrUser === undefined) { + return <>>; + } + + if (tsrUser.settings.organizations === undefined) { + console.log("no orgs"); + } + + return ( + + {`${tsrUser.username} organization: ${orgId} settings`} + + + Role + + --- + Resourcer + + + + + ); +}; + +export default OrganizationSettings; diff --git a/client/src/Users/UserApi.ts b/client/src/Users/UserApi.ts index 9fc7bce..48d78ce 100644 --- a/client/src/Users/UserApi.ts +++ b/client/src/Users/UserApi.ts @@ -40,6 +40,7 @@ export interface TsrUser { } export const emptyTsrUser: TsrUser = { + // TODO shouldn't need userId: "", username: "", role: "USER",
Organizations
Settings