diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js index f0cc8d360..0b33941f7 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/index.js @@ -88,30 +88,44 @@ const CollectionItem = ({ item, collection, searchText }) => { }); const handleClick = (event) => { - if (isItemARequest(item)) { - if (itemIsOpenedInTabs(item, tabs)) { + switch (event.button) { + case 0: // left click + if (isItemARequest(item)) { + dispatch(hideHomePage()); + if (itemIsOpenedInTabs(item, tabs)) { + dispatch( + focusTab({ + uid: item.uid + }) + ); + return; + } + dispatch( + addTab({ + uid: item.uid, + collectionUid: collection.uid, + requestPaneTab: getDefaultRequestPaneTab(item) + }) + ); + return; + } dispatch( - focusTab({ - uid: item.uid + collectionFolderClicked({ + itemUid: item.uid, + collectionUid: collection.uid }) ); - } else { - dispatch( - addTab({ - uid: item.uid, - collectionUid: collection.uid, - requestPaneTab: getDefaultRequestPaneTab(item) - }) - ); - } - dispatch(hideHomePage()); - } else { - dispatch( - collectionFolderClicked({ - itemUid: item.uid, - collectionUid: collection.uid - }) - ); + return; + case 2: // right click + const _menuDropdown = dropdownTippyRef.current; + if (_menuDropdown) { + let menuDropdownBehavior = 'show'; + if (_menuDropdown.state.isShown) { + menuDropdownBehavior = 'hide'; + } + _menuDropdown[menuDropdownBehavior](); + } + return; } }; @@ -189,7 +203,7 @@ const CollectionItem = ({ item, collection, searchText }) => { ? indents.map((i) => { return (
{ }) : null}
{ }); const handleClick = (event) => { - dispatch(collectionClicked(collection.uid)); + const _menuDropdown = menuDropdownTippyRef.current; + switch (event.button) { + case 0: // left click + dispatch(collectionClicked(collection.uid)); + return; + case 2: // right click + if (_menuDropdown) { + let menuDropdownBehavior = 'show'; + if (_menuDropdown.state.isShown) { + menuDropdownBehavior = 'hide'; + } + _menuDropdown[menuDropdownBehavior](); + } + return; + } }; const handleExportClick = () => { @@ -119,7 +133,7 @@ const Collection = ({ collection, searchText }) => { setCollectionPropertiesModal(false)} /> )}
-
+