diff --git a/app/components/Sidebar/components/CollectionLink.js b/app/components/Sidebar/components/CollectionLink.js
index b9944824e0..a598cccf8e 100644
--- a/app/components/Sidebar/components/CollectionLink.js
+++ b/app/components/Sidebar/components/CollectionLink.js
@@ -78,26 +78,29 @@ function CollectionLink({
const [{ isCollectionDropping }, dropToReorderCollection] = useDrop({
accept: "collection",
drop: async (item, monitor) => {
- if (!collection) return;
- //documents.move()
console.log("move collection");
},
collect: (monitor) => ({
- isCollectionDroppping: monitor.isOver(),
+ isCollectionDropping: monitor.isOver(),
}),
});
// Drag to reorder Collection
const [{ isCollectionDragging }, dragToReorderCollection] = useDrag({
- item: { type: "collection" },
+ item: { type: "collection", activeCollectionId: ui.activeCollectionId },
collect: (monitor) => ({
isCollectionDragging: monitor.isDragging(),
}),
canDrag: (monitor) => {
- ui.activeCollectionId = "";
//policies to allow admin
return true;
},
+ begin: (monitor) => {
+ ui.activeCollectionId = "";
+ },
+ end: (monitor) => {
+ ui.activeCollectionId = monitor.activeCollectionId;
+ },
});
return (
@@ -147,11 +150,10 @@ function CollectionLink({
/>
-
{expanded && manualSort && (
)}
- {isCollectionDropping && (
+ {!expanded && (
{
+ //documents.move()
+ console.log("move collection");
+ },
+ collect: (monitor) => ({
+ isCollectionDropping: monitor.isOver(),
+ }),
+ });
+
const content = (
<>
+
{collections.orderedData.map((collection) => (
);
+ if (!collections.isLoaded) {
+ return (
+
+
+
+
+ );
+ }
+
return (
- {collections.isLoaded ? (
- isPreloaded ? (
- content
- ) : (
- {content}
- )
- ) : (
-
- )}
+ {isPreloaded ? content : {content}}
);
}
diff --git a/app/components/Sidebar/components/DropCursor.js b/app/components/Sidebar/components/DropCursor.js
index 2eb584cf85..bb2df5d0d4 100644
--- a/app/components/Sidebar/components/DropCursor.js
+++ b/app/components/Sidebar/components/DropCursor.js
@@ -7,12 +7,14 @@ function DropCursor({
isActiveDrop,
innerRef,
theme,
+ from,
}: {
isActiveDrop: boolean,
innerRef: React.Ref,
theme: Theme,
+ from: string,
}) {
- return ;
+ return ;
}
// transparent hover zone with a thin visible band vertically centered
@@ -25,7 +27,7 @@ const Cursor = styled("div")`
width: 100%;
height: 14px;
- bottom: -7px;
+ ${(props) => (props.from === "collections" ? "top:15px;" : "bottom: -7px;")}
background: transparent;
::after {