-
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.
Merge pull request #892 from parlemonde/hotfix/bug-freecontent-nav
hotfix add index at contenu-libre
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { useRouter } from 'next/router'; | ||
import React from 'react'; | ||
|
||
import { Base } from 'src/components/Base'; | ||
import { StepsButton } from 'src/components/StepsButtons'; | ||
import { ActivityContext } from 'src/contexts/activityContext'; | ||
import { UserContext } from 'src/contexts/userContext'; | ||
import { VillageContext } from 'src/contexts/villageContext'; | ||
import { ActivityType } from 'types/activity.type'; | ||
import { UserType } from 'types/user.type'; | ||
|
||
const ContenuLibre = () => { | ||
const router = useRouter(); | ||
const { createNewActivity } = React.useContext(ActivityContext); | ||
const { user } = React.useContext(UserContext); | ||
const { selectedPhase } = React.useContext(VillageContext); | ||
|
||
const isModerator = user !== null && user.type <= UserType.MEDIATOR; | ||
|
||
const onNext = () => { | ||
const success = createNewActivity(ActivityType.CONTENU_LIBRE, selectedPhase); | ||
if (success) { | ||
router.push('/contenu-libre/1'); | ||
} | ||
}; | ||
|
||
if (!isModerator) { | ||
return <h1>Vous n'avez pas accès à cette page, vous devez être modérateur.</h1>; | ||
} | ||
|
||
return ( | ||
<Base> | ||
<div style={{ width: '100%', padding: '0.5rem 1rem 1rem 1rem' }}> | ||
<div className="width-900"> | ||
<h1 style={{ marginTop: '0.5rem' }}>Publication de contenu libre</h1> | ||
<p className="text"> | ||
Dans cette activité, nous vous proposons de créer une publication libre. Vous pourrez ensuite partager cette publication et décider de | ||
l'épingler dans le fil d'actualité. | ||
</p> | ||
<StepsButton next={onNext} /> | ||
</div> | ||
</div> | ||
</Base> | ||
); | ||
}; | ||
export default ContenuLibre; |