1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

audio upload buttin

This commit is contained in:
Fedor Katurov 2019-10-21 13:42:00 +07:00
parent d676ff88e4
commit 5e9b6e1819
10 changed files with 89 additions and 6 deletions

View file

@ -30,6 +30,7 @@ type IProps = ReturnType<typeof mapStateToProps> &
accept?: string;
icon?: string;
type?: typeof UPLOAD_TYPES[keyof typeof UPLOAD_TYPES];
};
const EditorUploadButtonUnconnected: FC<IProps> = ({
@ -42,6 +43,7 @@ const EditorUploadButtonUnconnected: FC<IProps> = ({
uploadUploadFiles,
accept = 'image/*',
icon = 'plus',
type = UPLOAD_TYPES.IMAGE,
}) => {
const eventPreventer = useCallback(event => event.preventDefault(), []);
@ -52,13 +54,15 @@ const EditorUploadButtonUnconnected: FC<IProps> = ({
if (current >= NODE_SETTINGS.MAX_FILES) return;
console.log({ type });
const items: IFileWithUUID[] = Array.from(uploads).map(
(file: File): IFileWithUUID => ({
file,
temp_id: uuid(),
subject: UPLOAD_SUBJECTS.EDITOR,
target: UPLOAD_TARGETS.NODES,
type: UPLOAD_TYPES.IMAGE,
type,
})
);
@ -67,7 +71,7 @@ const EditorUploadButtonUnconnected: FC<IProps> = ({
setTemp([...temp, ...temps]);
uploadUploadFiles(items);
},
[setTemp, uploadUploadFiles, temp, data]
[setTemp, uploadUploadFiles, temp, data, type]
);
const onFileAdd = useCallback(