mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 10:30:17 +01:00
ajout de composants pour li'nterface admin
This commit is contained in:
56
code/interface_admin/components/Avis.jsx
Normal file
56
code/interface_admin/components/Avis.jsx
Normal file
@@ -0,0 +1,56 @@
|
||||
import React from 'react'
|
||||
import { Card, Col, Row, Table } from 'react-bootstrap';
|
||||
import { BsPersonFill } from 'react-icons/bs';
|
||||
import styles from '../styles/Avis.module.css'
|
||||
|
||||
export default function Avis({ age, sex, text, date, grade, gradeOther }) {
|
||||
return (
|
||||
<Card>
|
||||
<Card.Title>Avis</Card.Title>
|
||||
<Card.Body>
|
||||
<Row>
|
||||
<h2>Auteur</h2>
|
||||
<Col xs={1}>
|
||||
<BsPersonFill className={styles.personIcon} />
|
||||
</Col>
|
||||
<Col className='d-flex flex-column'>
|
||||
<p>Age : {age}</p>
|
||||
<p>Sexe : {sex}</p>
|
||||
<p>Date de publication : {date}</p>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<h2>Notes</h2>
|
||||
<Table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Critère</th>
|
||||
<th>Note</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Général</td>
|
||||
<td>{grade} / 10</td>
|
||||
</tr>
|
||||
{gradeOther.map(({ title, grade }) => {
|
||||
return <tr key={title}>
|
||||
<td>{title}</td>
|
||||
<td>{grade}/10</td>
|
||||
</tr>
|
||||
})}
|
||||
</tbody>
|
||||
</Table>
|
||||
</Row>
|
||||
<Row>
|
||||
<Card>
|
||||
<Card.Header>Commentaire</Card.Header>
|
||||
<Card.Body>
|
||||
{text}
|
||||
</Card.Body>
|
||||
</Card>
|
||||
</Row>
|
||||
</Card.Body>
|
||||
</Card>
|
||||
)
|
||||
}
|
||||
32
code/interface_admin/components/AvisList.jsx
Normal file
32
code/interface_admin/components/AvisList.jsx
Normal file
@@ -0,0 +1,32 @@
|
||||
import { useRouter } from 'next/router';
|
||||
import React from 'react'
|
||||
import { Table } from 'react-bootstrap'
|
||||
import styles from '../styles/AvisList.module.css'
|
||||
|
||||
export default function AvisList({ avis }) {
|
||||
const router = useRouter();
|
||||
function handleClick(id) {
|
||||
router.push(`/avis/${id}`);
|
||||
}
|
||||
|
||||
return (
|
||||
<Table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Note globale</th>
|
||||
<th>Commentaire</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{avis.map(({ id, grade, comment, date }) => {
|
||||
return <tr onClick={() => handleClick(id)} key={id} className={styles.row}>
|
||||
<td>{date}</td>
|
||||
<td>{grade} / 10</td>
|
||||
<td>{comment}</td>
|
||||
</tr>
|
||||
})}
|
||||
</tbody>
|
||||
</Table>
|
||||
)
|
||||
}
|
||||
@@ -2,16 +2,16 @@ import React from 'react'
|
||||
import { Bar } from 'react-chartjs-2'
|
||||
import Chart from 'chart.js/auto';
|
||||
|
||||
export default function ComparativeBarChart({ xlabels, data0, label0, data1, label1, title }) {
|
||||
export default function ComparativeBarChart({ xlabels, data0, label0, data1, label1}) {
|
||||
return (
|
||||
<Bar
|
||||
options={{
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: title
|
||||
},
|
||||
},
|
||||
// plugins: {
|
||||
// title: {
|
||||
// display: true,
|
||||
// text: title
|
||||
// },
|
||||
// },
|
||||
responsive: true,
|
||||
interaction: {
|
||||
intersect: false,
|
||||
|
||||
Reference in New Issue
Block a user