Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pooja-bruno committed Jan 7, 2025
1 parent 2dfc7e9 commit bdf9b15
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions packages/bruno-app/src/components/Documentation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ 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();
const { displayedTheme } = useTheme();
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@ 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();
const { displayedTheme } = useTheme();
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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);
Expand Down

0 comments on commit bdf9b15

Please sign in to comment.