feat: allow add file by selecting through open file dialog

This commit is contained in:
鲁树人
2023-05-08 16:06:52 +01:00
parent 3b264f380f
commit c0737a341b
4 changed files with 36 additions and 13 deletions

View File

@@ -1,20 +1,11 @@
import { useEffect } from 'react';
import { Avatar, Box, Table, TableContainer, Tbody, Td, Text, Th, Thead, Tr, Wrap, WrapItem } from '@chakra-ui/react';
import { addNewFile, selectFiles } from './fileListingSlice';
import { useAppDispatch, useAppSelector } from '../../hooks';
import { selectFiles } from './fileListingSlice';
import { useAppSelector } from '../../hooks';
export function FileListing() {
const dispatch = useAppDispatch();
const files = useAppSelector(selectFiles);
useEffect(() => {
// FIXME: Remove test data
if (Object.keys(files).length === 0) {
dispatch(addNewFile({ id: 'dummy', fileName: '测试文件名.mgg', blobURI: '' }));
}
}, []);
return (
<TableContainer>
<Table variant="striped">