Skip to content

Commit

Permalink
feat: add admin link to profile dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismclarke committed Mar 3, 2022
1 parent 0a3a162 commit 3aac968
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 10 additions & 11 deletions src/components/ProfileModal/ProfileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { COMMUNITY_PAGES_PROFILE } from 'src/pages/PageList'
import { NavLink } from 'react-router-dom'
import Flex from 'src/components/Flex'
import theme from 'src/themes/styled.theme'
import { AuthWrapper } from '../Auth/AuthWrapper'

interface IProps {
username: string
Expand Down Expand Up @@ -87,17 +88,15 @@ export class ProfileModal extends React.Component<IProps> {
<Flex>Profile</Flex>
</ModalLink>
</Flex>
<Flex>
{COMMUNITY_PAGES_PROFILE.map(page => (
<ModalLink
key={page.path}
to={page.path}
data-cy={`menu-${page.title}`}
>
<Flex>{page.title}</Flex>
</ModalLink>
))}
</Flex>
{COMMUNITY_PAGES_PROFILE.map(page => (
<AuthWrapper roleRequired={page.requiredRole} key={page.path}>
<Flex>
<ModalLink to={page.path} data-cy={`menu-${page.title}`}>
<Flex>{page.title}</Flex>
</ModalLink>
</Flex>
</AuthWrapper>
))}
<Flex>
<ModalLink
onClick={() => this.logout()}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/PageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ export const COMMUNITY_PAGES: IPageMeta[] = [
events,
academy,
ResearchModule,
AdminModule,
]
export const COMMUNITY_PAGES_PROFILE: IPageMeta[] = [settings]
/** Additional pages to show in signed-in profile dropdown */
export const COMMUNITY_PAGES_PROFILE: IPageMeta[] = [settings, AdminModule]
export const ADMIN_PAGES: IPageMeta[] = [admin]
export const POLICY_PAGES: IPageMeta[] = [privacyPolicy, termsPolicy]
export const NO_HEADER_PAGES: IPageMeta[] = [
Expand Down

0 comments on commit 3aac968

Please sign in to comment.