diff --git a/app/components/DropToImport/DropToImport.js b/app/components/DropToImport/DropToImport.js index 67a11277..73d70b0b 100644 --- a/app/components/DropToImport/DropToImport.js +++ b/app/components/DropToImport/DropToImport.js @@ -54,11 +54,19 @@ class DropToImport extends Component { } for (const file of files) { - await importFile({ file, documentId, collectionId, redirect }, doc => { - if (redirect) { - this.props.history.push(doc.url); + importFile( + { + documents: this.props.documents, + file, + documentId, + collectionId, + }, + doc => { + if (redirect) { + this.props.history.push(doc.url); + } } - }); + ); } } catch (err) { // TODO: show error alert. diff --git a/app/components/Sidebar/components/Collections.js b/app/components/Sidebar/components/Collections.js index 2d99b958..fc2a0965 100644 --- a/app/components/Sidebar/components/Collections.js +++ b/app/components/Sidebar/components/Collections.js @@ -126,17 +126,16 @@ class CollectionLink extends Component { > {collection.name} - - - (this.menuOpen = true)} - onClose={() => (this.menuOpen = false)} - /> - + + (this.menuOpen = true)} + onClose={() => (this.menuOpen = false)} + /> + ); } @@ -225,6 +224,7 @@ const CollectionName = styled(Flex)` const CollectionAction = styled.span` position: absolute; right: 0; + top: 0; color: ${color.slate}; svg { opacity: 0.75; @@ -238,6 +238,8 @@ const CollectionAction = styled.span` `; const StyledDropToImport = styled(DropToImport)` + position: relative; + ${CollectionAction} { display: ${props => (props.menuOpen ? 'inline' : 'none')}; } diff --git a/app/menus/CollectionMenu.js b/app/menus/CollectionMenu.js index 6cbb9426..1d2b0775 100644 --- a/app/menus/CollectionMenu.js +++ b/app/menus/CollectionMenu.js @@ -33,7 +33,9 @@ class CollectionMenu extends Component { history.push(`${collection.url}/new`); }; - onImportFile = (ev: SyntheticEvent) => { + onImportDocument = (ev: SyntheticEvent) => { + ev.preventDefault(); + // simulate a click on the file upload input element this.file.click(); }; @@ -87,7 +89,7 @@ class CollectionMenu extends Component { New document - + Import document Edit…