| | |
| | | return true; |
| | | }; |
| | | |
| | | export type FileType = 'doc' | 'docx' | 'pdf' | 'md' | 'xls' | 'xlsx' | 'png' | 'jpg' | 'jpeg' | 'gif' | 'json' | 'txt' | 'csv'; |
| | | export type FileType = |
| | | | 'dot' |
| | | | 'doc' |
| | | | 'docx' |
| | | | 'pdf' |
| | | | 'md' |
| | | | 'xls' |
| | | | 'xlsx' |
| | | | 'png' |
| | | | 'jpg' |
| | | | 'jpeg' |
| | | | 'gif' |
| | | | 'json' |
| | | | 'txt' |
| | | | 'text' |
| | | | 'csv'; |
| | | export type FileGroupType = 'word' | 'pdf' | 'excel' | 'image' | 'json' | 'md' | 'csv' | 'txt'; |
| | | export type UploadFile = { |
| | | name: string; |
| | |
| | | |
| | | export const getFileGroupType = (type: FileType): FileGroupType => { |
| | | switch (type) { |
| | | case 'dot': |
| | | case 'doc': |
| | | case 'docx': |
| | | return 'word'; |
| | | case 'csv': |
| | | return 'csv'; |
| | | case 'txt': |
| | | case 'text': |
| | | return 'txt'; |
| | | |
| | | case 'md': |
| | |
| | | return ''; |
| | | } |
| | | }; |
| | | const supportFileType = ['doc', 'docx', 'md', 'xls', 'xlsx', 'png', 'jpg', 'jpeg', 'gif', 'json', 'pdf','csv', 'txt']; |
| | | // const supportFileType = ['csv', 'txt']; |
| | | // const supportFileType = ['doc', 'docx', 'md', 'xls', 'xlsx', 'png', 'jpg', 'jpeg', 'gif', 'json', 'pdf','csv', 'txt']; |
| | | const supportFileType = ['csv', 'txt', 'text', 'dot', 'doc', 'docx', 'pdf']; |
| | | |
| | | export const getFileSuffix = (name: string): FileType => { |
| | | if (!name) return 'txt'; |
| | |
| | | reset: resetOpenFileDialog, |
| | | onChange: onPickFileChange, |
| | | } = useFileDialog({ |
| | | accept: 'text/csv,text/plain', // Only accept csv and txt files |
| | | accept: |
| | | 'text/csv,text/plain,application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document', // Accept csv, txt, doc, docx and pdf files |
| | | reset: true, |
| | | }); |
| | | |