veza/apps/web/src/components/upload/BulkUploadModal.tsx
senke 7c69474cf9 aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 11:50:46 +01:00

118 lines
4.1 KiB
TypeScript

import React from 'react';
import { X, Play, Upload, Layers } from 'lucide-react';
import { Button } from '../ui/button';
import { FilePreviewCard, UploadFile } from './FilePreviewCard';
interface BulkUploadModalProps {
files: UploadFile[];
onClose: () => void;
onStartUpload: () => void;
onCancelFile: (id: string) => void;
onPauseFile: (id: string) => void;
onResumeFile: (id: string) => void;
}
export const BulkUploadModal: React.FC<BulkUploadModalProps> = ({
files,
onClose,
onStartUpload,
onCancelFile,
onPauseFile,
onResumeFile,
}) => {
const totalProgress =
files.reduce((acc, f) => acc + f.progress, 0) / (files.length || 1);
const uploadingCount = files.filter((f) => f.status === 'uploading').length;
const completedCount = files.filter((f) => f.status === 'completed').length;
return (
<div className="fixed inset-0 z-[100] flex items-center justify-center p-4">
<div
className="absolute inset-0 bg-kodo-void/90 backdrop-blur-sm"
onClick={onClose}
></div>
<div className="relative w-full max-w-3xl bg-kodo-graphite border border-kodo-steel rounded-2xl shadow-2xl overflow-hidden flex flex-col max-h-[80vh] animate-scaleIn">
{/* Header */}
<div className="p-6 border-b border-kodo-steel bg-kodo-ink flex justify-between items-center">
<div>
<h3 className="font-display font-bold text-xl text-white flex items-center gap-2">
<Layers className="w-5 h-5 text-kodo-steel" /> Bulk Upload Manager
</h3>
<p className="text-xs text-kodo-content-dim mt-1">
{completedCount} / {files.length} files uploaded {' '}
{files.length - completedCount} remaining
</p>
</div>
<Button variant="ghost" size="icon" onClick={onClose}>
<X className="w-5 h-5" />
</Button>
</div>
{/* Global Progress */}
<div className="px-6 py-2 bg-kodo-slate/30 border-b border-kodo-steel">
<div className="flex justify-between text-[10px] font-bold text-kodo-content-dim uppercase mb-1">
<span>Overall Progress</span>
<span>{Math.round(totalProgress)}%</span>
</div>
<div className="h-1 bg-kodo-steel rounded-full overflow-hidden">
<div
className="h-full bg-gradient-to-r from-kodo-cyan to-kodo-blue-500 transition-all duration-300"
style={{ width: `${totalProgress}%` }}
></div>
</div>
</div>
{/* File List */}
<div className="flex-1 overflow-y-auto p-6 space-y-4 bg-kodo-graphite/50">
{files.map((file) => (
<FilePreviewCard
key={file.id}
fileData={file}
onCancel={() => onCancelFile(file.id)}
onPause={() => onPauseFile(file.id)}
onResume={() => onResumeFile(file.id)}
/>
))}
</div>
{/* Footer Actions */}
<div className="p-6 border-t border-kodo-steel bg-kodo-ink flex justify-between items-center">
<div className="flex gap-2">
<Button
variant="ghost"
size="sm"
className="text-kodo-content-dim hover:text-white"
onClick={onClose}
>
Cancel All
</Button>
</div>
<div className="flex gap-4">
<Button
variant="secondary"
size="sm"
icon={<Upload className="w-4 h-4" />}
>
Apply Metadata to All
</Button>
{uploadingCount === 0 && completedCount < files.length && (
<Button
variant="primary"
size="sm"
icon={<Play className="w-4 h-4" />}
onClick={onStartUpload}
>
Start Upload
</Button>
)}
{completedCount === files.length && (
<Button variant="primary" size="sm" onClick={onClose}>
Done
</Button>
)}
</div>
</div>
</div>
</div>
);
};