diff --git a/src/components/sync/SyncProgress.tsx b/src/components/sync/SyncProgress.tsx new file mode 100644 index 0000000..1b54b2b --- /dev/null +++ b/src/components/sync/SyncProgress.tsx @@ -0,0 +1,65 @@ +'use client' + +interface SyncProgressProps { + log: string[] + progress: { current: number; total: number } | null + summary: { created: number; updated: number; deactivated: number; errors: number; status: string } | null +} + +export function SyncProgress({ log, progress, summary }: SyncProgressProps) { + const percent = progress && progress.total > 0 + ? Math.round((progress.current / progress.total) * 100) + : 0 + + return ( +
+ {/* Barre de progression */} + {progress && ( +
+
+ {progress.current} / {progress.total} produits + {percent}% +
+
+
+
+
+ )} + + {/* Log */} +
+ {log.length === 0 && ( +

Démarrage de la synchronisation…

+ )} + {log.map((line, i) => ( +

+ {line} +

+ ))} +
+ + {/* Résultat final */} + {summary && ( +
+ {summary.status === 'success' && '✅ '} + {summary.status === 'partial' && '⚠️ '} + {summary.status === 'error' && '❌ '} + Sync terminée — {summary.created} créés, {summary.updated} mis à jour,{' '} + {summary.deactivated} désactivés, {summary.errors} erreur{summary.errors > 1 ? 's' : ''} +
+ )} +
+ ) +}