-
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 #898 from parlemonde/Feature_Gerer-Interface-Acceu…
…il_VIL-310 Feature gerer interface acceuil vil 310
- Loading branch information
Showing
6 changed files
with
229 additions
and
1 deletion.
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,24 @@ | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
|
||
import BackArrow from 'src/svg/back-arrow.svg'; | ||
|
||
const Access = () => { | ||
const renderTitle = () => { | ||
return ( | ||
<div> | ||
<Link href="/admin/newportal/manage"> | ||
<div style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}> | ||
<BackArrow /> | ||
<h1 style={{ marginLeft: '10px' }}>Droits d'accès</h1> | ||
</div> | ||
</Link> | ||
<p>Il y a ici la liste complète des droits d'accès sur 1Village.</p> | ||
</div> | ||
); | ||
}; | ||
|
||
return <>{renderTitle()}</>; | ||
}; | ||
|
||
export default Access; |
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,24 @@ | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
|
||
import BackArrow from 'src/svg/back-arrow.svg'; | ||
|
||
const Activities = () => { | ||
const renderTitle = () => { | ||
return ( | ||
<div> | ||
<Link href="/admin/newportal/manage"> | ||
<div style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}> | ||
<BackArrow /> | ||
<h1 style={{ marginLeft: '10px' }}>Consignes d'activité</h1> | ||
</div> | ||
</Link> | ||
<p>Il y a ici la liste complète des villages-mondes.</p> | ||
</div> | ||
); | ||
}; | ||
|
||
return <>{renderTitle()}</>; | ||
}; | ||
|
||
export default Activities; |
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 |
---|---|---|
@@ -1,15 +1,77 @@ | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
|
||
import { List, ListItem, ListItemIcon, ListItemText } from '@mui/material'; | ||
|
||
import { UserContext } from 'src/contexts/userContext'; | ||
import DoubleChevronRightIcon from 'src/svg/mdi-light_chevron-double-right.svg'; | ||
import { UserType } from 'types/user.type'; | ||
|
||
type Link = { | ||
name: string; | ||
link: string; | ||
}; | ||
interface NavItemProps { | ||
key?: number; | ||
link: string; | ||
primary: string; | ||
} | ||
|
||
const Gerer = () => { | ||
const { user } = React.useContext(UserContext); | ||
const hasAccess = user !== null && user.type in [UserType.MEDIATOR, UserType.ADMIN, UserType.SUPER_ADMIN]; | ||
|
||
if (!hasAccess) { | ||
return <h1>Vous n'avez pas accès à cette page, vous devez être modérateur.</h1>; | ||
} | ||
|
||
const links: Link[] = [ | ||
{ name: 'Les villages-mondes', link: '/admin/newportal/manage/villages' }, | ||
{ name: 'Les utilisateurs', link: '/admin/newportal/manage/users' }, | ||
{ name: 'Les consignes des activités', link: '/admin/newportal/manage/activities' }, | ||
{ name: 'Paramétrer 1Village', link: '/admin/newportal/manage/settings' }, | ||
{ name: "Les droits d'accès", link: '/admin/newportal/manage/access' }, | ||
]; | ||
|
||
const NavItem = ({ link, primary }: NavItemProps) => ( | ||
<Link href={link} passHref> | ||
<ListItem className="like-button grey" button component="a"> | ||
<ListItemText primary={primary} /> | ||
<ListItemIcon> | ||
<DoubleChevronRightIcon /> | ||
</ListItemIcon> | ||
</ListItem> | ||
</Link> | ||
); | ||
|
||
const renderTitle = () => { | ||
return ( | ||
<div> | ||
<h1>Gérer</h1> | ||
<p> | ||
C’est dans cet espace, que les administrateurs et administratrices du site vont pouvoir gérer les droits d’accès, la composition des | ||
villages-mondes et accéder à la liste complète des utilisateurs. | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
return <>{renderTitle()}</>; | ||
const renderLinks = () => { | ||
return ( | ||
<List sx={{ padding: 0, margin: 0 }}> | ||
{links?.map((item, id) => ( | ||
<NavItem key={id} link={item.link} primary={item.name} /> | ||
))} | ||
</List> | ||
); | ||
}; | ||
|
||
return ( | ||
<> | ||
{renderTitle()} | ||
{renderLinks()} | ||
</> | ||
); | ||
}; | ||
|
||
export default Gerer; |
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,70 @@ | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
|
||
import { List, ListItem, ListItemIcon, ListItemText } from '@mui/material'; | ||
|
||
import BackArrow from 'src/svg/back-arrow.svg'; | ||
import DoubleChevronRightIcon from 'src/svg/mdi-light_chevron-double-right.svg'; | ||
|
||
type Link = { | ||
name: string; | ||
link: string; | ||
}; | ||
interface NavItemProps { | ||
key?: number; | ||
link: string; | ||
primary: string; | ||
} | ||
|
||
const Gerer = () => { | ||
const links: Link[] = [ | ||
{ name: 'Archiver', link: 'https://' }, | ||
{ name: 'Présenatation de Pélico', link: 'https://' }, | ||
{ name: 'Paramétrer la home', link: 'https://' }, | ||
{ name: 'Paramétrer les phases', link: 'https://' }, | ||
]; | ||
|
||
const NavItem = ({ link, primary }: NavItemProps) => ( | ||
<Link href={link} passHref> | ||
<ListItem className="like-button grey" button component="a"> | ||
<ListItemText primary={primary} /> | ||
<ListItemIcon> | ||
<DoubleChevronRightIcon /> | ||
</ListItemIcon> | ||
</ListItem> | ||
</Link> | ||
); | ||
|
||
const renderTitle = () => { | ||
return ( | ||
<div> | ||
<Link href="/admin/newportal/manage"> | ||
<div style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}> | ||
<BackArrow /> | ||
<h1 style={{ marginLeft: '10px' }}>Paramétrage</h1> | ||
</div> | ||
</Link> | ||
<p>C’est ici que l’on peut activer les phases d’1Village, créer les devinettes de lancement d’année et archiver 1Village.</p> | ||
</div> | ||
); | ||
}; | ||
|
||
const renderLinks = () => { | ||
return ( | ||
<List sx={{ padding: 0, margin: 0 }}> | ||
{links?.map((item, id) => ( | ||
<NavItem key={id} link={item.link} primary={item.name} /> | ||
))} | ||
</List> | ||
); | ||
}; | ||
|
||
return ( | ||
<> | ||
{renderTitle()} | ||
{renderLinks()} | ||
</> | ||
); | ||
}; | ||
|
||
export default Gerer; |
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,24 @@ | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
|
||
import BackArrow from 'src/svg/back-arrow.svg'; | ||
|
||
const Users = () => { | ||
const renderTitle = () => { | ||
return ( | ||
<div> | ||
<Link href="/admin/newportal/manage"> | ||
<div style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}> | ||
<BackArrow /> | ||
<h1 style={{ marginLeft: '10px' }}>Utilisateurs</h1> | ||
</div> | ||
</Link> | ||
<p>Il y a ici la liste complète des utilisateurs sur 1Village.</p> | ||
</div> | ||
); | ||
}; | ||
|
||
return <>{renderTitle()}</>; | ||
}; | ||
|
||
export default Users; |
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,24 @@ | ||
import Link from 'next/link'; | ||
import React from 'react'; | ||
|
||
import BackArrow from 'src/svg/back-arrow.svg'; | ||
|
||
const Villages = () => { | ||
const renderTitle = () => { | ||
return ( | ||
<div> | ||
<Link href="/admin/newportal/manage"> | ||
<div style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}> | ||
<BackArrow /> | ||
<h1 style={{ marginLeft: '10px' }}>Villages-mondes</h1> | ||
</div> | ||
</Link> | ||
<p>Il y a ici la liste complète des villages-mondes.</p> | ||
</div> | ||
); | ||
}; | ||
|
||
return <>{renderTitle()}</>; | ||
}; | ||
|
||
export default Villages; |