Skip to content

Commit 0f9d0fd

Browse files
committed
#2128 a different implementation of tabs
1 parent 15a6d7a commit 0f9d0fd

1 file changed

Lines changed: 17 additions & 11 deletions

File tree

src/frontend/src/pages/AdminToolsPage/AdminToolsPage.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,22 @@ const AdminToolsPage: React.FC = () => {
4646

4747
const defaultTab = isUserAdmin || isUserHead ? 'user-management' : 'finance-configuration';
4848

49-
const tabs = [
50-
{ tabUrlValue: 'user-management', tabName: 'User Management', roles: ['head', 'admin'] },
51-
{ tabUrlValue: 'project-configuration', tabName: 'Project Configuration', roles: ['head', 'admin'] },
52-
{ tabUrlValue: 'finance-configuration', tabName: 'Finance Configuration', roles: ['financeLead', 'admin'] },
53-
{ tabUrlValue: 'miscellaneous', tabName: 'Miscellaneous', roles: ['admin'] }
54-
];
55-
56-
const userRole = isUserAdmin ? 'admin' : isUserHead ? 'head' : isUserFinanceLead ? 'financeLead' : 'user';
57-
58-
const filteredTabs = tabs.filter((tab) => tab.roles.includes(userRole));
49+
const tabs = [];
50+
51+
if (isUserHead || isUserAdmin) {
52+
tabs.push({ tabUrlValue: 'user-management', tabName: 'User Management' });
53+
tabs.push({ tabUrlValue: 'project-configuration', tabName: 'Project Configuration' });
54+
}
55+
if (isUserAdmin || isUserFinanceLead) {
56+
tabs.push({ tabUrlValue: 'finance-configuration', tabName: 'Finance Configuration' });
57+
}
58+
if (isUserAdmin) {
59+
tabs.push({ tabUrlValue: 'miscellaneous', tabName: 'Miscellaneous' });
60+
}
61+
// { tabUrlValue: 'user-management', tabName: 'User Management', roles: ['head', 'admin'] },
62+
// { tabUrlValue: 'project-configuration', tabName: 'Project Configuration', roles: ['head', 'admin'] },
63+
// { tabUrlValue: 'finance-configuration', tabName: 'Finance Configuration', roles: ['financeLead', 'admin'] },
64+
// { tabUrlValue: 'miscellaneous', tabName: 'Miscellaneous', roles: ['admin'] }
5965

6066
const showUserManagement = () => {
6167
return isUserAdmin ? <TeamsTools /> : <AdminToolsUserManagement />;
@@ -71,7 +77,7 @@ const AdminToolsPage: React.FC = () => {
7177
tabs={
7278
<NERTabs
7379
setTab={setTabIndex}
74-
tabsLabels={filteredTabs}
80+
tabsLabels={tabs}
7581
baseUrl={routes.ADMIN_TOOLS}
7682
defaultTab={defaultTab}
7783
id="admin-tabs"

0 commit comments

Comments
 (0)