feat: added file management functionality and API operations

- Improved functionality for file management has been added.
- Added file system management functionality through IPC.
- Added functionality to interact with files including selection, upload, deletion, and batch operations.
- Added new file operations to the custom API, including file select, upload, delete, batch upload, and batch delete functions.
- Implemented feature to select and upload files via API.
This commit is contained in:
kangfenmao
2024-09-10 17:02:07 +08:00
parent 7beea24fc4
commit 2cb461db4e
5 changed files with 134 additions and 22 deletions
+11 -1
View File
@@ -7,13 +7,23 @@ import styled from 'styled-components'
const FilesPage: FC = () => {
const { t } = useTranslation()
const handleSelectFile = async () => {
const files = await window.api.fileSelect({
properties: ['openFile', 'multiSelections']
})
for (const file of files || []) {
const result = await window.api.fileUpload(file.path)
console.log('Selected file:', file, result)
}
}
return (
<Container>
<Navbar>
<NavbarCenter style={{ borderRight: 'none' }}>{t('files.title')}</NavbarCenter>
</Navbar>
<ContentContainer>
<Button></Button>
<Button onClick={handleSelectFile}></Button>
</ContentContainer>
</Container>
)