intégration de l'analyse des avis dans l'interface admin

This commit is contained in:
Quentin Roussel
2023-04-02 20:28:12 +02:00
parent ef2c3cdce4
commit 1fa3b92e32
13 changed files with 114 additions and 21 deletions

View File

@@ -1,10 +1,19 @@
import React from 'react'
import { Card, Col, Row, Table } from 'react-bootstrap';
import { Alert, Card, Col, Row, Table } from 'react-bootstrap';
import { BsPersonFill } from 'react-icons/bs';
import styles from '../styles/Avis.module.css'
export default function Avis({review}) {
const {date, note_principale,notes_autres, commentaire, sexe_auteur, nom_source, age_auteur} = review;
function getAnalyse() {
let res = "Non calculé"
notes_autres.map(({ critere, note }) => {
if(critere === "analyse") {
res=note.toString();
}
})
return res
}
return (
<Card>
<Card.Title>Avis</Card.Title>
@@ -36,10 +45,12 @@ export default function Avis({review}) {
<td>{note_principale} / 10</td>
</tr>
{notes_autres && notes_autres.map(({ critere, note }) => {
return <tr key={critere}>
<td>{critere}</td>
<td>{note}/10</td>
</tr>
if(critere !== "analyse") {
return <tr key={critere}>
<td>{critere}</td>
<td>{note}/10</td>
</tr>
}
})}
</tbody>
</Table>
@@ -48,6 +59,9 @@ export default function Avis({review}) {
<Card>
<Card.Header>Commentaire</Card.Header>
<Card.Body>
<Alert variant={getAnalyse() > 0 ? "success" : "danger"}>
<p>Score de positivité : {getAnalyse()}</p>
</Alert>
{commentaire}
</Card.Body>
</Card>