-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add folder to dispatch routing element and created a Layout to handle…
… BackArrow
- Loading branch information
Showing
6 changed files
with
43 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Link from 'next/link'; | ||
import type { ReactNode } from 'react'; | ||
import React from 'react'; | ||
|
||
import { UserContext } from 'src/contexts/userContext'; | ||
import BackArrow from 'src/svg/back-arrow.svg'; | ||
import { UserType } from 'types/user.type'; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
export default function Layout({ children }: Props) { | ||
const { user } = React.useContext(UserContext); | ||
const isModerator = user !== null && user.type <= UserType.MEDIATOR; | ||
|
||
if (!isModerator) { | ||
return <h1>Vous n'avez pas accès à cette page, vous devez être modérateur.</h1>; | ||
} | ||
return ( | ||
<div> | ||
<Link href="/admin/newportal/create"> | ||
<div style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}> | ||
<BackArrow /> | ||
<h1 style={{ marginLeft: '10px' }}>Créer du contenu libre</h1> | ||
</div> | ||
</Link> | ||
{children} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters