From bdf9b1513e4cb3f7d385e9887675e0652ebf7b0f Mon Sep 17 00:00:00 2001 From: Pooja Belaramani Date: Tue, 7 Jan 2025 13:15:30 +0530 Subject: [PATCH] small fixes --- .../CollectionSettings/Docs/index.js | 1 - .../src/components/Documentation/index.js | 2 -- .../FolderSettings/Documentation/index.js | 3 --- .../ReduxStore/slices/collections/actions.js | 18 +++++++++--------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/packages/bruno-app/src/components/CollectionSettings/Docs/index.js b/packages/bruno-app/src/components/CollectionSettings/Docs/index.js index 74c64b9511..66931cdf6f 100644 --- a/packages/bruno-app/src/components/CollectionSettings/Docs/index.js +++ b/packages/bruno-app/src/components/CollectionSettings/Docs/index.js @@ -8,7 +8,6 @@ import { saveCollectionRoot } from 'providers/ReduxStore/slices/collections/acti import Markdown from 'components/MarkDown'; import CodeEditor from 'components/CodeEditor'; import StyledWrapper from './StyledWrapper'; -import { IconDeviceFloppy } from '@tabler/icons'; const Docs = ({ collection }) => { const dispatch = useDispatch(); diff --git a/packages/bruno-app/src/components/Documentation/index.js b/packages/bruno-app/src/components/Documentation/index.js index fd7b6339b4..bbce1bd9b1 100644 --- a/packages/bruno-app/src/components/Documentation/index.js +++ b/packages/bruno-app/src/components/Documentation/index.js @@ -8,7 +8,6 @@ import { saveRequest } from 'providers/ReduxStore/slices/collections/actions'; import Markdown from 'components/MarkDown'; import CodeEditor from 'components/CodeEditor'; import StyledWrapper from './StyledWrapper'; -import { IconDeviceFloppy } from '@tabler/icons'; const Documentation = ({ item, collection }) => { const dispatch = useDispatch(); @@ -16,7 +15,6 @@ const Documentation = ({ item, collection }) => { const [isEditing, setIsEditing] = useState(false); const docs = item.draft ? get(item, 'draft.request.docs') : get(item, 'request.docs'); const preferences = useSelector((state) => state.app.preferences); - const { theme } = useTheme(); const toggleViewMode = () => { setIsEditing((prev) => !prev); diff --git a/packages/bruno-app/src/components/FolderSettings/Documentation/index.js b/packages/bruno-app/src/components/FolderSettings/Documentation/index.js index 11cf316e5d..275e8c8f3a 100644 --- a/packages/bruno-app/src/components/FolderSettings/Documentation/index.js +++ b/packages/bruno-app/src/components/FolderSettings/Documentation/index.js @@ -8,7 +8,6 @@ import { saveFolderRoot } from 'providers/ReduxStore/slices/collections/actions' import Markdown from 'components/MarkDown'; import CodeEditor from 'components/CodeEditor'; import StyledWrapper from './StyledWrapper'; -import { IconDeviceFloppy } from '@tabler/icons'; const Documentation = ({ collection, folder }) => { const dispatch = useDispatch(); @@ -16,8 +15,6 @@ const Documentation = ({ collection, folder }) => { const preferences = useSelector((state) => state.app.preferences); const [isEditing, setIsEditing] = useState(false); const docs = folder.draft ? get(folder, 'draft.docs', '') : get(folder, 'root.docs', ''); - const { theme } = useTheme(); - const toggleViewMode = () => { setIsEditing((prev) => !prev); diff --git a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js index 53cc380d95..6d0e2f5857 100644 --- a/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js +++ b/packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js @@ -128,19 +128,19 @@ export const saveMultipleRequests = (items) => (dispatch, getState) => { export const saveCollectionRoot = (collectionUid) => (dispatch, getState) => { const state = getState(); - const collection = findCollectionByUid(state.collections.collections, collectionUid); + const collectionRoot = findCollectionByUid(state.collections.collections, collectionUid); - const transformRoot = transformCollectionRootToSave(collection); + const transformRoot = transformCollectionRootToSave(collectionRoot); return new Promise((resolve, reject) => { - if (!collection) { + if (!collectionRoot) { return reject(new Error('Collection not found')); } const { ipcRenderer } = window; ipcRenderer - .invoke('renderer:save-collection-root', collection.pathname, transformRoot) + .invoke('renderer:save-collection-root', collectionRoot.pathname, transformRoot) .then(() => toast.success('Collection Settings saved successfully')) .then(resolve) .catch((err) => { @@ -153,25 +153,25 @@ export const saveCollectionRoot = (collectionUid) => (dispatch, getState) => { export const saveFolderRoot = (collectionUid, folderUid) => (dispatch, getState) => { const state = getState(); const collection = findCollectionByUid(state.collections.collections, collectionUid); - const folder = findItemInCollection(collection, folderUid); + const folderRoot = findItemInCollection(collection, folderUid); return new Promise((resolve, reject) => { if (!collection) { return reject(new Error('Collection not found')); } - if (!folder) { + if (!folderRoot) { return reject(new Error('Folder not found')); } console.log(collection); const { ipcRenderer } = window; - const transformFolderRoot = transformFolderRootToSave(folder); + const transformFolderRoot = transformFolderRootToSave(folderRoot); const folderData = { - name: folder.name, - pathname: folder.pathname, + name: folderRoot.name, + pathname: folderRoot.pathname, root: transformFolderRoot }; console.log(folderData);