feat(remote): 支持文件并行上传下载

This commit is contained in:
2026-03-11 21:07:13 +08:00
parent 320d2654f5
commit 1b80fd036d

View File

@@ -19,7 +19,6 @@ export const FileTransferPage: React.FC<FileTransferPageProps> = ({ serverHost,
const [remotePath, setRemotePath] = useState('')
const [localPath, setLocalPath] = useState('')
const [transfers, setTransfers] = useState<TransferItem[]>([])
const [transferring, setTransferring] = useState(false)
const [transferQueueHeight, setTransferQueueHeight] = useState(240)
const [isDragging, setIsDragging] = useState(false)
const dragStartY = useRef(0)
@@ -28,7 +27,6 @@ export const FileTransferPage: React.FC<FileTransferPageProps> = ({ serverHost,
const handleUpload = useCallback(async () => {
if (!localSelected || !localSelected.path) return
setTransferring(true)
const transferId = Date.now().toString()
const newTransfer: TransferItem = {
id: transferId,
@@ -63,14 +61,12 @@ export const FileTransferPage: React.FC<FileTransferPageProps> = ({ serverHost,
)
)
} finally {
setTransferring(false)
}
}, [localSelected, serverHost, port, remotePath, password])
const handleDownload = useCallback(async () => {
if (!remoteSelected || !localPath) return
setTransferring(true)
const transferId = Date.now().toString()
const newTransfer: TransferItem = {
id: transferId,
@@ -105,7 +101,6 @@ export const FileTransferPage: React.FC<FileTransferPageProps> = ({ serverHost,
)
)
} finally {
setTransferring(false)
}
}, [remoteSelected, serverHost, port, remotePath, localPath, password])
@@ -155,7 +150,6 @@ export const FileTransferPage: React.FC<FileTransferPageProps> = ({ serverHost,
onSelect={setLocalSelected}
onUpload={handleUpload}
onPathChange={setLocalPath}
disabled={transferring}
/>
</div>
<div className="flex-1 min-w-0">
@@ -167,7 +161,6 @@ export const FileTransferPage: React.FC<FileTransferPageProps> = ({ serverHost,
onSelect={setRemoteSelected}
onDownload={handleDownload}
onPathChange={setRemotePath}
disabled={transferring}
/>
</div>
</div>