Files
upload-gltf/components/upload/OverwriteConfirmModal.tsx
T
2026-04-14 16:21:37 +02:00

99 lines
3.6 KiB
TypeScript

import type { FileDiff } from '@/lib/types'
interface OverwriteConfirmModalProps {
destination: string
folderName: string
diffs: FileDiff[]
onCancel: () => void
onConfirm: () => void
}
export default function OverwriteConfirmModal({
destination,
folderName,
diffs,
onCancel,
onConfirm,
}: OverwriteConfirmModalProps) {
return (
<div
className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm"
role="dialog"
aria-modal="true"
aria-labelledby="overwrite-title"
>
<div className="bg-black-900 border border-white/20 rounded-2xl p-6 max-w-md w-full mx-4 space-y-4">
<div className="flex items-center gap-3">
<div className="w-10 h-10 rounded-full bg-yellow-900/30 flex items-center justify-center shrink-0">
<svg className="w-5 h-5 text-yellow-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
/>
</svg>
</div>
<div>
<h3 id="overwrite-title" className="text-sm font-semibold text-gray-100">
Dossier deja existant
</h3>
<p className="text-xs text-gray-400 mt-0.5">
<span className="font-mono text-yellow-400">{destination}/{folderName}</span> existe deja.
Les anciens fichiers seront archives sur le Drive, puis les nouveaux seront envoyes sur le Drive et Git.
</p>
</div>
</div>
{diffs.length > 0 && (
<div className="bg-black-800 border border-white/10 rounded-xl p-3 max-h-40 overflow-y-auto">
<p className="text-xs text-gray-500 mb-2">Modifications detectees :</p>
<ul className="space-y-1">
{diffs.map((d) => (
<li key={d.name} className="flex items-center gap-2 text-xs font-mono">
{d.status === 'changed' && (
<>
<span className="text-yellow-400">🔄</span>
<span className="text-gray-300">{d.name}</span>
</>
)}
{d.status === 'new' && (
<>
<span className="text-green-400"></span>
<span className="text-gray-300">{d.name}</span>
</>
)}
{d.status === 'deleted' && (
<>
<span className="text-red-400"></span>
<span className="text-gray-500 line-through">{d.name}</span>
</>
)}
</li>
))}
</ul>
</div>
)}
<div className="flex gap-3">
<button
onClick={onCancel}
className="flex-1 bg-black-700 text-gray-300 font-medium text-sm
py-2.5 px-4 rounded-xl border border-white/10 transition-colors duration-150
hover:bg-black-600"
>
Annuler
</button>
<button
onClick={onConfirm}
className="flex-1 bg-yellow-600 text-[#000000] font-medium text-sm
py-2.5 px-4 rounded-xl transition-colors duration-150
hover:bg-yellow-500"
>
Remplacer
</button>
</div>
</div>
</div>
)
}