import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router-dom'; import { getClientOrders } from '../../services/api'; import { AlertCircle, Loader } from 'lucide-react'; // Importation des composants isolés import DashboardServiceCard from '../../components/dashboard/DashboardServiceCard'; import NewServiceCard from '../../components/dashboard/NewServiceCard'; export default function Dashboard() { const navigate = useNavigate(); const [orders, setOrders] = useState([]); const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(null); // Chargement des données à l'ouverture du Sas useEffect(() => { const fetchInventory = async () => { try { const data = await getClientOrders(); if (data.list) { // LE FILTRE CHIRURGICAL PAR PREFIXE const filteredOrders = data.list.filter(order => { const title = (order.title || '').toLowerCase(); const type = (order.type || '').toLowerCase(); const isGhostProduct = type === 'domain' || title.startsWith('domain ') || title.startsWith('domaine ') || title.startsWith('enregistrement '); return !isGhostProduct; }); setOrders(filteredOrders); } else { setOrders([]); } } catch (err) { setError(err.message || "Impossible de récupérer la télémétrie des services."); } finally { setIsLoading(false); } }; fetchInventory(); }, []); return (

TABLEAU DE BORD

Aperçu de vos accréditations réseau et infrastructures.

{/* GESTION DES ERREURS & CHARGEMENT */} {isLoading && (
Synchronisation avec l'orchestrateur en cours...
)} {error && (
{error}
)} {/* GRILLE DES SERVICES */} {!isLoading && !error && (
{/* Boucle sur les composants isolés */} {orders.map((order) => ( navigate(`/services/${order.id}`)} /> ))} {/* Le composant carte d'ajout */} navigate('/store')} />
)}
); }