diff --git a/apps/frontend/app/dashboard/page.tsx b/apps/frontend/app/dashboard/page.tsx index 1969448..f1afe89 100644 --- a/apps/frontend/app/dashboard/page.tsx +++ b/apps/frontend/app/dashboard/page.tsx @@ -1,7 +1,6 @@ /** - * Dashboard Home Page - * - * Main dashboard with CSV Booking KPIs and carrier analytics + * Dashboard Home Page - Clean & Colorful with Charts + * Professional design with data visualization */ 'use client'; @@ -22,6 +21,21 @@ import { Plus, ArrowRight, } from 'lucide-react'; +import { + PieChart, + Pie, + Cell, + BarChart, + Bar, + XAxis, + YAxis, + CartesianGrid, + Tooltip, + ResponsiveContainer, + LineChart, + Line, + Legend, +} from 'recharts'; export default function DashboardPage() { // Fetch CSV booking KPIs @@ -36,138 +50,240 @@ export default function DashboardPage() { queryFn: () => dashboardApi.getTopCarriers(), }); + // Prepare data for charts + const statusDistribution = csvKpis + ? [ + { name: 'Acceptés', value: csvKpis.totalAccepted, color: '#10b981' }, + { name: 'Refusés', value: csvKpis.totalRejected, color: '#ef4444' }, + { name: 'En Attente', value: csvKpis.totalPending, color: '#f59e0b' }, + ] + : []; + + const carrierWeightData = topCarriers + ? topCarriers.slice(0, 5).map(c => ({ + name: c.carrierName.length > 15 ? c.carrierName.substring(0, 15) + '...' : c.carrierName, + poids: Math.round(c.totalWeightKG), + })) + : []; + return ( -
- Suivez vos bookings et vos performances -
++ Vue d'ensemble de vos bookings et performances +
+- +{csvKpis?.acceptedThisMonth || 0} ce mois -
- > - )} -- +{csvKpis?.rejectedThisMonth || 0} ce mois -
- > - )} -- {csvKpis?.acceptanceRate.toFixed(1)}% taux d'acceptation -
- > - )} -- KG ({(csvKpis?.totalVolumeAcceptedCBM || 0).toFixed(2)} CBM) -
- > - )} - - -Acceptés
+ {csvKpisLoading ? ( + + ) : ( + <> ++ {csvKpis?.totalAccepted || 0} +
++ +{csvKpis?.acceptedThisMonth || 0} ce mois +
+ > + )}Taux d'acceptation
-
+
+
+
+ {/* Bookings Refusés */}
+ Refusés
+ {csvKpis?.totalRejected || 0}
+
+ +{csvKpis?.rejectedThisMonth || 0} ce mois
+ En Attente
+ {csvKpis?.totalPending || 0}
+
+ {csvKpis?.acceptanceRate.toFixed(1)}% acceptés
+ Poids Total
+ {(csvKpis?.totalWeightAcceptedKG || 0).toLocaleString()}
+
+ KG • {(csvKpis?.totalVolumeAcceptedCBM || 0).toFixed(1)} CBM
+
Taux d'Acceptation
+{csvKpisLoading ? '--' : `${csvKpis?.acceptanceRate.toFixed(1)}%`}
Total bookings
-
+ Total Bookings
{csvKpisLoading
? '--'
: (csvKpis?.totalAccepted || 0) +
@@ -175,178 +291,130 @@ export default function DashboardPage() {
(csvKpis?.totalPending || 0)}
Volume total accepté
-
+ Volume Total
{csvKpisLoading ? '--' : `${(csvKpis?.totalVolumeAcceptedCBM || 0).toFixed(1)}`}
- CBM
+ CBM
- Créez votre premier booking pour voir vos statistiques -
- -+ {carrier.acceptanceRate.toFixed(0)}% • ${carrier.avgPriceUSD.toFixed(0)} +
+Trouver les meilleurs prix
+ ) : ( ++ Créez votre premier booking pour voir vos statistiques +
+ + +Voir tous mes envois
-Configuration du compte
-