-
Notifications
You must be signed in to change notification settings - Fork 5
/
Navigation.tsx
104 lines (100 loc) · 2.71 KB
/
Navigation.tsx
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { ROLES } from 'api/src/lib/constants'
import Nav from 'react-bootstrap/Nav'
import { useAuth } from 'web/src/auth'
import { NavLink, routes } from '@redwoodjs/router'
const Navigation = () => {
const { hasRole } = useAuth()
const canViewAdminTabs =
hasRole(ROLES.USDR_ADMIN) || hasRole(ROLES.ORGANIZATION_ADMIN)
return (
<div className="tabs-wrapper row">
<Nav variant="tabs" defaultActiveKey="/">
<Nav.Item>
<NavLink
to={routes.uploads()}
activeClassName="active"
className="nav-link"
>
Uploads
</NavLink>
</Nav.Item>
{canViewAdminTabs && (
<Nav.Item>
<NavLink
to={routes.agencies()}
activeClassName="active"
className="nav-link"
>
Agencies
</NavLink>
</Nav.Item>
)}
{canViewAdminTabs && (
<Nav.Item>
<NavLink
to={routes.subrecipients()}
activeClassName="active"
className="nav-link"
>
Subrecipients
</NavLink>
</Nav.Item>
)}
{canViewAdminTabs && (
<>
<Nav.Item>
<NavLink
to={routes.users()}
activeClassName="active"
className="nav-link"
>
Users
</NavLink>
</Nav.Item>
<Nav.Item>
<NavLink
to={routes.reportingPeriods()}
activeClassName="active"
className="nav-link"
>
Reporting Periods
</NavLink>
</Nav.Item>
</>
)}
{hasRole(ROLES.USDR_ADMIN) && (
<>
<Nav.Item>
<NavLink
to={routes.organizations()}
activeClassName="active"
className="nav-link"
>
Organizations
</NavLink>
</Nav.Item>
<Nav.Item>
<NavLink
to={routes.outputTemplates()}
activeClassName="active"
className="nav-link"
>
Output Templates
</NavLink>
</Nav.Item>
<Nav.Item>
<NavLink
to={routes.treasuryReportGenerationDeveloperTools()}
activeClassName="active"
className="nav-link"
>
Treasury Report Generation Developer Tool
</NavLink>
</Nav.Item>
</>
)}
</Nav>
</div>
)
}
export default Navigation