Skip to content

Commit

Permalink
feat(ui): Sidebar > Folder > Clicking on the folder icon should only …
Browse files Browse the repository at this point in the history
…toggle collapsed state instead of opening the folder view
  • Loading branch information
flawiddsouza committed Oct 11, 2024
1 parent 4f6afc5 commit c58fd40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/ui/src/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ export default {
font-size: 0.7rem;
}
.sidebar .sidebar-item * {
.sidebar .sidebar-item *:not(.request-group-toggle) {
pointer-events: none;
}
Expand Down
11 changes: 8 additions & 3 deletions packages/ui/src/components/SidebarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div
class="sidebar-item"
:class="{ 'sidebar-item-active': activeTab && sidebarItem._id === activeTab._id }"
@click="handleSidebarItemClick(sidebarItem)"
@click="handleSidebarItemClick($event, sidebarItem)"
@dblclick="handleSidebarItemDoubleClick(sidebarItem)"
@contextmenu.prevent="handleContextMenu(sidebarItem, $event)"
:draggable="collectionFilter === '' && !showInputToRenameRequest ? true : false"
Expand All @@ -12,7 +12,7 @@
:title="!showInputToRenameRequest ? sidebarItem.name : 'Press Enter to save, Esc to cancel'"
>
<template v-if="sidebarItem._type === 'request_group'">
<div style="margin-right: 0.3rem">
<div style="margin-right: 0.3rem" class="request-group-toggle">
<i class="fa space-right fa-folder-open" v-if="getSidebarItemExpandedState(sidebarItem)"></i>
<i class="fa space-right fa-folder" v-else></i>
</div>
Expand Down Expand Up @@ -98,14 +98,19 @@ export default {
return methods[method] || method
},
handleSidebarItemClick(sidebarItem) {
handleSidebarItemClick(event, sidebarItem) {
if(sidebarItem._type === 'request' || sidebarItem._type === 'socket') {
this.$store.dispatch('addTab', sidebarItem)
}
if(sidebarItem._type === 'request_group') {
sidebarItem.collapsed = !(sidebarItem.collapsed)
this.$store.dispatch('saveCollectionItemCollapsedState', { _id: sidebarItem._id, collapsed: sidebarItem.collapsed })
if(event.target.closest('.request-group-toggle')) {
return
}
this.$store.dispatch('addTab', sidebarItem)
}
},
Expand Down

0 comments on commit c58fd40

Please sign in to comment.