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

@@ -8,7 +8,12 @@ export default function AvisList({ avis }) {
function handleClick(id) {
router.push(`/avis/${id}`);
}
function truncateComment(text) {
if(text.length > 100) {
return text.substring(0, 100) + "..."
}
return text;
}
return (
<Table>
<thead>
@@ -16,15 +21,17 @@ export default function AvisList({ avis }) {
<th>Date</th>
<th>Note globale</th>
<th>Commentaire</th>
<th>Positivité</th>
<th>Source</th>
</tr>
</thead>
<tbody>
{avis.map(({ id, note_principale, commentaire, date, nom_source }) => {
{avis.map(({ id, note_principale, commentaire,analyse, date, nom_source }) => {
return <tr onClick={() => handleClick(id)} key={id} className={styles.row}>
<td>{date}</td>
<td>{note_principale} / 10</td>
<td>{commentaire}</td>
<td>{truncateComment(commentaire)}</td>
<td>{analyse}</td>
<td>{nom_source}</td>
</tr>
})}