Feature: Add collapse full collection feature (#4492)

* Add collapse collection feature
---------
Co-authored-by: Anoop M D <anoop@usebruno.com>
This commit is contained in:
Mauricio Sanabria
2025-09-29 01:37:10 -06:00
committed by GitHub
parent 191a997b05
commit 41e0615f77
2 changed files with 22 additions and 1 deletions

View File

@@ -6,7 +6,7 @@ import filter from 'lodash/filter';
import { useDrop, useDrag } from 'react-dnd';
import { IconChevronRight, IconDots, IconLoader2 } from '@tabler/icons';
import Dropdown from 'components/Dropdown';
import { toggleCollection } from 'providers/ReduxStore/slices/collections';
import { toggleCollection, collapseFullCollection } from 'providers/ReduxStore/slices/collections';
import { mountCollection, moveCollectionAndPersist, handleCollectionItemDrop } from 'providers/ReduxStore/slices/collections/actions';
import { useDispatch, useSelector } from 'react-redux';
import { hideHomePage } from 'providers/ReduxStore/slices/app';
@@ -132,6 +132,10 @@ const Collection = ({ collection, searchText }) => {
}
};
const handleCollapseFullCollection = () => {
dispatch(collapseFullCollection({ collectionUid: collection.uid }));
};
const viewCollectionSettings = () => {
dispatch(
addTab({
@@ -311,6 +315,15 @@ const Collection = ({ collection, searchText }) => {
>
Share
</div>
<div
className="dropdown-item"
onClick={(_e) => {
menuDropdownTippyRef.current.hide();
handleCollapseFullCollection();
}}
>
Collapse
</div>
<div
className="dropdown-item"
onClick={(_e) => {

View File

@@ -96,6 +96,13 @@ export const collectionsSlice = createSlice({
state.collections.push(collection);
}
},
collapseFullCollection: (state, action) => {
const { collectionUid } = action.payload;
const collection = findCollectionByUid(state.collections, collectionUid);
if (collection) {
collapseAllItemsInCollection(collection);
}
},
updateCollectionMountStatus: (state, action) => {
const collection = findCollectionByUid(state.collections, action.payload.collectionUid);
if (collection) {
@@ -2748,6 +2755,7 @@ export const {
saveRequest,
deleteRequestDraft,
newEphemeralHttpRequest,
collapseFullCollection,
toggleCollection,
toggleCollectionItem,
requestUrlChanged,