fix: prevent duplicate uploads and group asset commits
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
interface ActionButtonsProps {
|
||||
isUploading: boolean
|
||||
isChecking: boolean
|
||||
isSecretEmpty: boolean
|
||||
hasPendingOrErrors: boolean
|
||||
allDone: boolean
|
||||
@@ -11,6 +12,7 @@ interface ActionButtonsProps {
|
||||
|
||||
export default function ActionButtons({
|
||||
isUploading,
|
||||
isChecking,
|
||||
isSecretEmpty,
|
||||
hasPendingOrErrors,
|
||||
allDone,
|
||||
@@ -19,11 +21,12 @@ export default function ActionButtons({
|
||||
onCancel,
|
||||
onReset,
|
||||
}: ActionButtonsProps) {
|
||||
const cantUpload = isSecretEmpty
|
||||
const cantUpload = isSecretEmpty || isChecking
|
||||
const isBusy = isUploading || isChecking
|
||||
|
||||
return (
|
||||
<div className="flex gap-3">
|
||||
{!isUploading && hasPendingOrErrors && (
|
||||
{!isBusy && hasPendingOrErrors && (
|
||||
<button
|
||||
onClick={onUpload}
|
||||
disabled={cantUpload}
|
||||
@@ -38,18 +41,19 @@ export default function ActionButtons({
|
||||
</button>
|
||||
)}
|
||||
|
||||
{isUploading && (
|
||||
<button
|
||||
onClick={onCancel}
|
||||
className="flex-1 bg-black-700 text-gray-300 font-medium text-sm
|
||||
py-2.5 px-6 rounded-xl border border-black-600 transition-colors duration-150
|
||||
{isBusy && (
|
||||
<button
|
||||
onClick={onCancel}
|
||||
disabled={!isUploading}
|
||||
className="flex-1 bg-black-700 text-gray-300 font-medium text-sm
|
||||
py-2.5 px-6 rounded-xl border border-black-600 transition-colors duration-150 disabled:opacity-50 disabled:cursor-not-allowed
|
||||
hover:bg-black-600"
|
||||
>
|
||||
Annuler
|
||||
</button>
|
||||
)}
|
||||
>
|
||||
{isChecking ? 'Verification...' : 'Annuler'}
|
||||
</button>
|
||||
)}
|
||||
|
||||
{(allDone || hasErrors) && !isUploading && (
|
||||
{(allDone || hasErrors) && !isBusy && (
|
||||
<button
|
||||
onClick={onReset}
|
||||
className="flex-1 bg-black-700 text-gray-300 font-medium text-sm
|
||||
|
||||
@@ -5,12 +5,14 @@ interface DriveErrorModalProps {
|
||||
error: string
|
||||
onCancel: () => void
|
||||
onContinue: () => void
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
export default function DriveErrorModal({
|
||||
error,
|
||||
onCancel,
|
||||
onContinue,
|
||||
disabled = false,
|
||||
}: DriveErrorModalProps) {
|
||||
return (
|
||||
<Modal ariaLabelledBy="drive-error-title">
|
||||
@@ -41,6 +43,7 @@ export default function DriveErrorModal({
|
||||
confirmLabel="Envoyer sur Git seulement"
|
||||
onCancel={onCancel}
|
||||
onConfirm={onContinue}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</Modal>
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Drive/Git status sub-line for FolderCard
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
import { SpinnerIcon, XIcon, InfoIcon } from '@/components/ui/icons'
|
||||
import { SpinnerIcon, XIcon, WarningIcon } from '@/components/ui/icons'
|
||||
import type { FolderEntry } from '@/lib/client-types'
|
||||
|
||||
interface DriveStatusLineProps {
|
||||
@@ -35,7 +35,7 @@ export default function DriveStatusLine({ driveStatus, driveError }: DriveStatus
|
||||
)}
|
||||
{driveStatus === 'skipped' && (
|
||||
<>
|
||||
<InfoIcon className="w-3 h-3 text-yellow-400" />
|
||||
<WarningIcon className="w-3 h-3 text-yellow-400" />
|
||||
<span className="text-xs text-yellow-400">Drive ignore</span>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -7,6 +7,7 @@ interface OverwriteConfirmModalProps {
|
||||
diffs: FileDiff[]
|
||||
onCancel: () => void
|
||||
onConfirm: () => void
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
export default function OverwriteConfirmModal({
|
||||
@@ -14,6 +15,7 @@ export default function OverwriteConfirmModal({
|
||||
diffs,
|
||||
onCancel,
|
||||
onConfirm,
|
||||
disabled = false,
|
||||
}: OverwriteConfirmModalProps) {
|
||||
return (
|
||||
<Modal ariaLabelledBy="overwrite-title">
|
||||
@@ -68,6 +70,7 @@ export default function OverwriteConfirmModal({
|
||||
onCancel={onCancel}
|
||||
onConfirm={onConfirm}
|
||||
confirmClassName="bg-yellow-600 text-[#000000] hover:bg-yellow-500"
|
||||
disabled={disabled}
|
||||
/>
|
||||
</Modal>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user