feat(remote): 下载改成本地面板选择目录
This commit is contained in:
@@ -8,6 +8,7 @@ interface LocalFilePanelProps {
|
||||
selectedFile: FileItem | null
|
||||
onSelect: (file: FileItem | null) => void
|
||||
onUpload: () => void
|
||||
onPathChange?: (path: string) => void
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
@@ -15,6 +16,7 @@ export const LocalFilePanel: React.FC<LocalFilePanelProps> = ({
|
||||
selectedFile,
|
||||
onSelect,
|
||||
onUpload,
|
||||
onPathChange,
|
||||
disabled,
|
||||
}) => {
|
||||
const [currentPath, setCurrentPath] = useState('')
|
||||
@@ -50,6 +52,7 @@ export const LocalFilePanel: React.FC<LocalFilePanelProps> = ({
|
||||
useEffect(() => {
|
||||
if (isAtDrives) {
|
||||
loadDrives()
|
||||
onPathChange?.('')
|
||||
} else {
|
||||
loadFiles(currentPath)
|
||||
}
|
||||
@@ -64,6 +67,9 @@ export const LocalFilePanel: React.FC<LocalFilePanelProps> = ({
|
||||
setCurrentPath(prevPath)
|
||||
if (prevPath === '') {
|
||||
setIsAtDrives(true)
|
||||
onPathChange?.('')
|
||||
} else {
|
||||
onPathChange?.(prevPath)
|
||||
}
|
||||
onSelect(null)
|
||||
}
|
||||
@@ -74,6 +80,7 @@ export const LocalFilePanel: React.FC<LocalFilePanelProps> = ({
|
||||
setPathHistory([...pathHistory, file.path])
|
||||
setCurrentPath(file.path)
|
||||
onSelect(null)
|
||||
onPathChange?.(file.path)
|
||||
}
|
||||
|
||||
const handleRefresh = () => {
|
||||
|
||||
Reference in New Issue
Block a user