-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathAdminContainer.jsx
More file actions
executable file
·35 lines (33 loc) · 1.07 KB
/
AdminContainer.jsx
File metadata and controls
executable file
·35 lines (33 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import React, { useState } from 'react';
import MenuBar from '../globalStyles/MenuBar';
import AuthContext from '../../AuthContext';
import { MenuTabs } from '../globalStyles/MenuTabs';
import UserProfilesContainer from './UserProfilesContainer';
import AdminSettings from './AdminSettings';
const AdminContainer = () => {
const [adminView, setView] = useState('settings');
let currentView =
adminView === 'settings' ? <AdminSettings /> : <UserProfilesContainer />;
return (
<AuthContext.Consumer>
{context => {
return context.role === 'ADMIN' ? (
<div className="adminContainer">
<MenuBar
selectedTab={adminView}
tabOptions={MenuTabs.ManageAccountTabs}
setView={setView}
className="adminContainerMenuBar"
/>
{currentView}
</div>
) : (
<div className="permissionDeniedWarning">
You do not have permissions to view this page
</div>
);
}}
</AuthContext.Consumer>
);
};
export default AdminContainer;