forked from extern/bruno
chore: disable dragndrop temporarily due to electron issues
This commit is contained in:
parent
7f2e19250f
commit
ae7e3a722c
@ -35,28 +35,28 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
||||
const [newFolderModalOpen, setNewFolderModalOpen] = useState(false);
|
||||
const [itemIsCollapsed, setItemisCollapsed] = useState(item.collapsed);
|
||||
|
||||
const [{ isDragging }, drag] = useDrag({
|
||||
type: 'COLLECTION_ITEM',
|
||||
item: item,
|
||||
collect: (monitor) => ({
|
||||
isDragging: monitor.isDragging()
|
||||
})
|
||||
});
|
||||
// const [{ isDragging }, drag] = useDrag({
|
||||
// type: 'COLLECTION_ITEM',
|
||||
// item: item,
|
||||
// collect: (monitor) => ({
|
||||
// isDragging: monitor.isDragging()
|
||||
// })
|
||||
// });
|
||||
|
||||
const [{ isOver }, drop] = useDrop({
|
||||
accept: 'COLLECTION_ITEM',
|
||||
drop: (draggedItem) => {
|
||||
if (draggedItem.uid !== item.uid) {
|
||||
dispatch(moveItem(collection.uid, draggedItem.uid, item.uid));
|
||||
}
|
||||
},
|
||||
canDrop: (draggedItem) => {
|
||||
return draggedItem.uid !== item.uid;
|
||||
},
|
||||
collect: (monitor) => ({
|
||||
isOver: monitor.isOver()
|
||||
})
|
||||
});
|
||||
// const [{ isOver }, drop] = useDrop({
|
||||
// accept: 'COLLECTION_ITEM',
|
||||
// drop: (draggedItem) => {
|
||||
// if (draggedItem.uid !== item.uid) {
|
||||
// dispatch(moveItem(collection.uid, draggedItem.uid, item.uid));
|
||||
// }
|
||||
// },
|
||||
// canDrop: (draggedItem) => {
|
||||
// return draggedItem.uid !== item.uid;
|
||||
// },
|
||||
// collect: (monitor) => ({
|
||||
// isOver: monitor.isOver()
|
||||
// })
|
||||
// });
|
||||
|
||||
useEffect(() => {
|
||||
if (searchText && searchText.length) {
|
||||
@ -141,7 +141,7 @@ const CollectionItem = ({ item, collection, searchText }) => {
|
||||
{deleteItemModalOpen && <DeleteCollectionItem item={item} collection={collection} onClose={() => setDeleteItemModalOpen(false)} />}
|
||||
{newRequestModalOpen && <NewRequest item={item} collection={collection} onClose={() => setNewRequestModalOpen(false)} />}
|
||||
{newFolderModalOpen && <NewFolder item={item} collection={collection} onClose={() => setNewFolderModalOpen(false)} />}
|
||||
<div className={itemRowClassName} ref={(node) => drag(drop(node))}>
|
||||
<div className={itemRowClassName}>
|
||||
<div className="flex items-center h-full w-full">
|
||||
{indents && indents.length
|
||||
? indents.map((i) => {
|
||||
|
@ -73,20 +73,20 @@ const Collection = ({ collection, searchText }) => {
|
||||
|
||||
const isLocal = isLocalCollection(collection);
|
||||
|
||||
const [{ isOver }, drop] = useDrop({
|
||||
accept: 'COLLECTION_ITEM',
|
||||
drop: (draggedItem) => {
|
||||
console.log('drop', draggedItem);
|
||||
dispatch(moveItemToRootOfCollection(collection.uid, draggedItem.uid));
|
||||
},
|
||||
canDrop: (draggedItem) => {
|
||||
// todo need to make sure that draggedItem belongs to the collection
|
||||
return true;
|
||||
},
|
||||
collect: (monitor) => ({
|
||||
isOver: monitor.isOver()
|
||||
})
|
||||
});
|
||||
// const [{ isOver }, drop] = useDrop({
|
||||
// accept: 'COLLECTION_ITEM',
|
||||
// drop: (draggedItem) => {
|
||||
// console.log('drop', draggedItem);
|
||||
// dispatch(moveItemToRootOfCollection(collection.uid, draggedItem.uid));
|
||||
// },
|
||||
// canDrop: (draggedItem) => {
|
||||
// // todo need to make sure that draggedItem belongs to the collection
|
||||
// return true;
|
||||
// },
|
||||
// collect: (monitor) => ({
|
||||
// isOver: monitor.isOver()
|
||||
// })
|
||||
// });
|
||||
|
||||
return (
|
||||
<StyledWrapper className="flex flex-col">
|
||||
@ -96,7 +96,7 @@ const Collection = ({ collection, searchText }) => {
|
||||
{showRemoveCollectionFromWSModal && <RemoveCollectionFromWorkspace collection={collection} onClose={() => setShowRemoveCollectionFromWSModal(false)} />}
|
||||
{showDeleteCollectionModal && <DeleteCollection collection={collection} onClose={() => setShowDeleteCollectionModal(false)} />}
|
||||
{showRemoveLocalCollectionModal && <RemoveLocalCollection collection={collection} onClose={() => setShowRemoveLocalCollectionModal(false)} />}
|
||||
<div className="flex py-1 collection-name items-center" ref={(node) => drop(node)}>
|
||||
<div className="flex py-1 collection-name items-center">
|
||||
<div className="flex flex-grow items-center" onClick={handleClick}>
|
||||
<IconChevronRight size={16} strokeWidth={2} className={iconClassName} style={{ width: 16, color: 'rgb(160 160 160)' }} />
|
||||
<div className="ml-1" id="sidebar-collection-name">{collection.name}</div>
|
||||
|
Loading…
Reference in New Issue
Block a user