Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/app/components/site/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useAppSelector, selectors } from "../../state";
import {
isAdmin,
isAdminOrEventManager,
isContentEditor,
isEventLeader,
isStaff,
isTeacherOrAbove,
isTutorOrAbove,
} from "../../services";
Expand Down Expand Up @@ -66,13 +66,17 @@ export const NavigationBar = () => {
<LinkItem to="/safeguarding">Safeguarding</LinkItem>
</NavigationSection>

{(isStaff(user) || isEventLeader(user)) && (
{(isAdminOrEventManager(user) || isContentEditor(user) || isEventLeader(user)) && (
<NavigationSection title="Admin" svgIcon={<img src="/assets/Vector.svg" alt="Icon" className="svgIcon" />}>
{isStaff(user) && <LinkItem to="/admin">Admin tools</LinkItem>}
{(isAdminOrEventManager(user) || isContentEditor(user)) && <LinkItem to="/admin">Admin tools</LinkItem>}
{isAdmin(user) && <LinkItem to="/admin/usermanager">User manager</LinkItem>}
{(isEventLeader(user) || isAdminOrEventManager(user)) && <LinkItem to="/admin/events">Event admin</LinkItem>}
{isStaff(user) && <LinkItem to="/admin/stats">Site statistics</LinkItem>}
{isStaff(user) && <LinkItem to="/admin/content_errors">Content errors</LinkItem>}
{(isAdminOrEventManager(user) || isContentEditor(user)) && (
<LinkItem to="/admin/stats">Site statistics</LinkItem>
)}
{(isAdminOrEventManager(user) || isContentEditor(user)) && (
<LinkItem to="/admin/content_errors">Content errors</LinkItem>
)}
</NavigationSection>
)}
</NavBar>
Expand Down
4 changes: 4 additions & 0 deletions src/app/services/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ export function isEventManager(user?: UserRoleAndLoggedInStatus | null): boolean
return isDefined(user) && user.role === "EVENT_MANAGER" && (user.loggedIn ?? true);
}

export function isContentEditor(user?: UserRoleAndLoggedInStatus | null): boolean {
return isDefined(user) && user.role === "CONTENT_EDITOR" && (user.loggedIn ?? true);
}

export function isStaff(user?: UserRoleAndLoggedInStatus | null): boolean {
return (
isDefined(user) &&
Expand Down
Loading