Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | 1x 4x 4x 5x 2x 2x | // src/features/flyer/BulkImportSummary.tsx
import React from 'react';
import { CheckCircleIcon } from '../../components/icons/CheckCircleIcon';
import { ExclamationTriangleIcon } from '../../components/icons/ExclamationTriangleIcon';
import { InformationCircleIcon } from '../../components/icons/InformationCircleIcon';
interface BulkImportSummaryProps {
summary: {
processed: string[];
skipped: string[];
errors: { fileName: string; message: string }[];
};
onDismiss: () => void;
}
export const BulkImportSummary: React.FC<BulkImportSummaryProps> = ({ summary, onDismiss }) => {
const hasContent =
summary.processed.length > 0 || summary.skipped.length > 0 || summary.errors.length > 0;
return (
<div className="p-6 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 min-h-[400px] flex flex-col">
<div className="flex justify-between items-start mb-4">
<div>
<h2 className="text-xl font-bold text-gray-800 dark:text-white">Bulk Import Report</h2>
<p className="text-sm text-gray-500 dark:text-gray-400">
{`Processed: ${summary.processed.length}, Skipped: ${summary.skipped.length}, Errors: ${summary.errors.length}`}
</p>
</div>
<button
onClick={onDismiss}
className="text-sm bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 rounded-md px-3 py-1"
aria-label="Dismiss summary"
>
Close
</button>
</div>
{hasContent ? (
<div className="space-y-4 grow overflow-y-auto">
{summary.processed.length > 0 && (
<div>
<h4 className="text-md font-semibold flex items-center mb-2 text-green-700 dark:text-green-400">
<CheckCircleIcon className="w-5 h-5 mr-2" />
Successfully Processed ({summary.processed.length})
</h4>
<ul className="text-sm list-disc pl-6 space-y-1 bg-gray-50 dark:bg-gray-800/50 p-3 rounded-md">
{summary.processed.map((item, index) => (
<li key={index} className="text-gray-700 dark:text-gray-300">
{item}
</li>
))}
</ul>
</div>
)}
{summary.skipped.length > 0 && (
<div>
<h4 className="text-md font-semibold flex items-center mb-2 text-blue-700 dark:text-blue-400">
<InformationCircleIcon className="w-5 h-5 mr-2" />
Skipped Duplicates ({summary.skipped.length})
</h4>
<ul className="text-sm list-disc pl-6 space-y-1 bg-gray-50 dark:bg-gray-800/50 p-3 rounded-md">
{summary.skipped.map((item, index) => (
<li key={index} className="text-gray-700 dark:text-gray-300">
{item}
</li>
))}
</ul>
</div>
)}
{summary.errors.length > 0 && (
<div>
<h4 className="text-md font-semibold flex items-center mb-2 text-red-700 dark:text-red-400">
<ExclamationTriangleIcon className="w-5 h-5 mr-2" />
Errors ({summary.errors.length})
</h4>
<ul className="text-sm list-disc pl-6 space-y-2 bg-gray-50 dark:bg-gray-800/50 p-3 rounded-md">
{summary.errors.map((err, index) => (
<li key={index} className="text-red-800 dark:text-red-300">
<strong>{err.fileName}:</strong> {err.message}
</li>
))}
</ul>
</div>
)}
</div>
) : (
<div className="grow flex flex-col justify-center items-center text-center">
<InformationCircleIcon className="w-12 h-12 text-gray-400 mb-4" />
<p className="text-gray-600 dark:text-gray-400">No new files were found to process.</p>
</div>
)}
</div>
);
};
|