fix: harden upload resilience and contracts

This commit is contained in:
Tom Boullay
2026-05-12 23:49:30 +02:00
parent 101af23418
commit 606df93b69
19 changed files with 479 additions and 159 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
import { SpinnerIcon, XIcon, WarningIcon } from '@/components/ui/icons'
import type { FolderEntry } from '@/lib/client-types'
import type { DriveStatus } from '@/lib/client-types'
interface DriveStatusLineProps {
driveStatus: NonNullable<FolderEntry['driveStatus']>
driveStatus: DriveStatus
driveError?: string
}
+8 -1
View File
@@ -1,7 +1,7 @@
import dynamic from 'next/dynamic'
import type { FolderEntry } from '@/lib/client-types'
import { formatBytes } from '@/lib/format-bytes'
import { SpinnerIcon, CheckIcon, XIcon, ChevronIcon } from '@/components/ui/icons'
import { SpinnerIcon, CheckIcon, XIcon, ChevronIcon, WarningIcon } from '@/components/ui/icons'
import DriveStatusLine from './DriveStatusLine'
import WarningBanner from './WarningBanner'
@@ -63,6 +63,13 @@ export default function FolderCard({ entry, index, onToggleViewer, onRemove }: F
<DriveStatusLine driveStatus={entry.driveStatus} driveError={entry.driveError} />
)}
{entry.uploadWarning && (
<div className="mt-1.5 flex items-start gap-1.5 text-xs text-yellow-400">
<WarningIcon className="mt-0.5 h-3.5 w-3.5 shrink-0" />
<span className="line-clamp-2">{entry.uploadWarning}</span>
</div>
)}
{entry.status === 'uploading' && (
<div className="mt-1.5 w-full h-1 bg-black-700 rounded-full overflow-hidden">
<div
+3 -2
View File
@@ -1,6 +1,7 @@
import { useRef, useState } from 'react'
import type { FolderEntry } from '@/lib/client-types'
import { validateFolder } from '@/lib/validate-folder'
import { getErrorMessage } from '@/lib/guards'
import { FolderIcon } from '@/components/ui/icons'
function buildAssetUrls(model: File, supportFiles: File[]) {
@@ -156,8 +157,8 @@ export default function FolderDropzone({
if (droppedFiles.length === 0) return
await processFiles(droppedFiles)
} catch {
onError('Impossible de lire le dossier depose')
} catch (err) {
onError(`Impossible de lire le dossier depose: ${getErrorMessage(err)}`)
}
}