mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 10:30:17 +01:00
intégration de l'analyse des avis dans l'interface admin
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user