From 22fd86f46ce11bbe27169e251bfcac8cd7165a18 Mon Sep 17 00:00:00 2001 From: Anton Kulyk <kuliks.anton@gmail.com> Date: Wed, 9 Jun 2021 18:10:29 +0300 Subject: [PATCH] Move items to root collection via drag-n-drop (#16502) --- .../containers/CollectionSidebar.jsx | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/frontend/src/metabase/collections/containers/CollectionSidebar.jsx b/frontend/src/metabase/collections/containers/CollectionSidebar.jsx index c37d761d93a..2d2dcf53881 100644 --- a/frontend/src/metabase/collections/containers/CollectionSidebar.jsx +++ b/frontend/src/metabase/collections/containers/CollectionSidebar.jsx @@ -9,6 +9,8 @@ import * as Urls from "metabase/lib/urls"; import Collection from "metabase/entities/collections"; +import CollectionDropTarget from "metabase/containers/dnd/CollectionDropTarget"; + import Icon from "metabase/components/Icon"; import Link from "metabase/components/Link"; import LoadingSpinner from "metabase/components/LoadingSpinner"; @@ -82,15 +84,25 @@ class CollectionSidebar extends React.Component { const { currentUser, isRoot, collectionId, list } = this.props; return ( <React.Fragment> - <CollectionLink - to={Urls.collection({ id: "root" })} - selected={isRoot} - mb={1} - mt={2} - > - <Icon name="folder" mr={1} /> - {t`Our analytics`} - </CollectionLink> + <Collection.Loader id="root"> + {({ collection: root }) => ( + <Box mb={1} mt={2}> + <CollectionDropTarget collection={root}> + {({ highlighted, hovered }) => ( + <CollectionLink + to={Urls.collection({ id: "root" })} + selected={isRoot} + highlighted={highlighted} + hovered={hovered} + > + {t`Our analytics`} + </CollectionLink> + )} + </CollectionDropTarget> + </Box> + )} + </Collection.Loader> + <Box pb={4}> <CollectionsList openCollections={this.state.openCollections} -- GitLab