feat: list folder recursively

This commit is contained in:
2025-02-14 16:17:24 +08:00
parent c523f1a59c
commit f9c4c1c7cf
3 changed files with 61 additions and 2 deletions

View File

@@ -38,11 +38,12 @@ import {
DocumentAddRegular,
DeleteRegular,
DeleteDismissRegular,
FolderAddRegular,
WindowPlayRegular,
} from '@fluentui/react-icons'
import { Status, Item, SaveTo } from './types'
import { SelectFiles, SelectFolder, ProcessFiles } from '../wailsjs/go/main/App'
import { SelectFiles, SelectFolder, SelectFilesFromFolder, ProcessFiles } from '../wailsjs/go/main/App'
import { Load, Save } from '../wailsjs/go/utils/ConfigManager'
import { main } from '../wailsjs/go/models'
import { EventsOn, OnFileDrop } from '../wailsjs/runtime/runtime'
@@ -155,6 +156,17 @@ export const App = () => {
})
}
const selectFilesFromFolder = () => {
if (isProcessing) {
return
}
SelectFilesFromFolder('ncm').then(files => {
for (const file of files) {
setItems(prev => [...prev, { file, status: 'pending' }])
}
})
}
const showDialog = (message: string) => {
setMessage(message)
setOpen(true)
@@ -178,7 +190,7 @@ export const App = () => {
showDialog('当前文件列表已全部处理完毕,请重新添加新的文件。')
return
}
if(saveTo === 'custom' && savePath === '') {
if (saveTo === 'custom' && savePath === '') {
showDialog('保存路径为空,请先设置保存路径。')
return
}
@@ -254,6 +266,7 @@ export const App = () => {
<Button onClick={selectFiles} icon={<DocumentAddRegular />}>
</Button>
<Button onClick={selectFilesFromFolder} icon={<FolderAddRegular />}></Button>
<Button
onClick={() => {
if (!isProcessing) {