Message lorsqu'aucun enregistrement présent

This commit is contained in:
2026-06-16 08:38:23 +02:00
parent 032a370e7d
commit 9058bc7d22
8 changed files with 156 additions and 6 deletions
+9 -1
View File
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useRef, useState } from 'react';
import { usePagination } from '../hooks/usePagination.js';
import Pagination from '../components/Pagination.jsx';
import PageIcon from '../components/PageIcon.jsx';
import EmptyState from '../components/EmptyState.jsx';
import { useLocation, useNavigate } from 'react-router-dom';
import { api } from '../api.js';
import { useInvestisseur } from '../context/InvestisseurContext.jsx';
@@ -177,6 +178,7 @@ export default function Remboursements() {
const [corrections, setCorrections] = useState([]);
const [investissements, setInvestissements] = useState([]);
const [plateformes, setPlateformes] = useState([]);
const [platLoaded, setPlatLoaded] = useState(false);
const [pfuRates, setPfuRates] = useState([]);
const [loading, setLoading] = useState(false);
@@ -263,7 +265,7 @@ export default function Remboursements() {
useEffect(() => {
api.get('/pfu').then(setPfuRates).catch(() => {});
api.get('/plateformes').then(setPlateformes).catch(() => {});
api.get('/plateformes').then(d => { setPlateformes(d); setPlatLoaded(true); }).catch(() => { setPlatLoaded(true); });
api.get('/icons').then(rows => { const m = {}; rows.forEach(r => { m[r.name] = r.filename; }); setLibIcons(m); }).catch(() => {});
}, []);
@@ -760,6 +762,12 @@ export default function Remboursements() {
const multiDetenteur = new Set(plateformes.map(p => p.investisseur_id)).size > 1;
/* ── Rendu ── */
if (platLoaded && !loading && plateformes.length === 0) return (
<>
<div className="topbar"><h2>Remboursements</h2></div>
<EmptyState />
</>
);
return (
<>
<div className="topbar">