refactor: full codebase audit — extract modules, fix type safety, clean dead code
- Extract API helpers from UploadZone into lib/upload-api.ts (FormData builder, checkFolderDiffs, uploadDrive, uploadGit)
- Extract upload orchestration into hooks/useUploadOrchestrator.ts (UploadZone: 489 → 162 lines)
- Extract file diff classification into lib/diff-files.ts (from git route)
- Extract shared SVG icons into components/ui/icons.tsx (7 icons, 0 duplication)
- Extract shared modal wrapper into components/ui/Modal.tsx + ModalActions
- Extract DriveStatusLine sub-component from FolderCard
- Fix checkFolderDiffs silently swallowing auth/network errors (now throws)
- Fix type safety: remove as never casts, add isHttpError type guard, use discriminated union for validateFolder
- Fix nextcloud: cache getConfig, add max bound to findNextVersion, optimize mkdirRecursive (skip PROPFIND)
- Fix drive route: remove req.clone(), extend parseMultiUpload to return extra fields
- Fix commit message: model shown as unchanged with ↔️ on updates (not falsely marked as modified)
- Clean dead code: unused folderExists import, FileStatus/DriveStatus exports, ParsedFile.textureName, getConfig basePath
- Add security headers in next.config.ts (HSTS, X-Content-Type-Options, X-Frame-Options, etc.)
- Update README with new project structure
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import Modal, { ModalActions } from '@/components/ui/Modal'
|
||||
import { CheckIcon } from '@/components/ui/icons'
|
||||
|
||||
interface NoChangesModalProps {
|
||||
destination: string
|
||||
folderName: string
|
||||
@@ -12,52 +15,27 @@ export default function NoChangesModal({
|
||||
onModify,
|
||||
}: NoChangesModalProps) {
|
||||
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="no-changes-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-gray-700/50 flex items-center justify-center shrink-0">
|
||||
<svg className="w-5 h-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" strokeWidth={2}>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
d="M5 13l4 4L19 7"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div>
|
||||
<h3 id="no-changes-title" className="text-sm font-semibold text-gray-100">
|
||||
Aucun changement detecte
|
||||
</h3>
|
||||
<p className="text-xs text-gray-400 mt-0.5">
|
||||
Le dossier <span className="font-mono text-gray-300">{destination}/{folderName}</span> est identique au contenu distant. Rien a envoyer.
|
||||
</p>
|
||||
</div>
|
||||
<Modal ariaLabelledBy="no-changes-title">
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="w-10 h-10 rounded-full bg-gray-700/50 flex items-center justify-center shrink-0">
|
||||
<CheckIcon className="w-5 h-5 text-gray-400" />
|
||||
</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={onModify}
|
||||
className="flex-1 bg-white text-[#000000] font-medium text-sm
|
||||
py-2.5 px-4 rounded-xl transition-colors duration-150
|
||||
hover:bg-gray-200"
|
||||
>
|
||||
Modifier
|
||||
</button>
|
||||
<div>
|
||||
<h3 id="no-changes-title" className="text-sm font-semibold text-gray-100">
|
||||
Aucun changement detecte
|
||||
</h3>
|
||||
<p className="text-xs text-gray-400 mt-0.5">
|
||||
Le dossier <span className="font-mono text-gray-300">{destination}/{folderName}</span> est identique au contenu distant. Rien a envoyer.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ModalActions
|
||||
cancelLabel="Annuler"
|
||||
confirmLabel="Modifier"
|
||||
onCancel={onCancel}
|
||||
onConfirm={onModify}
|
||||
/>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user