From 3808089e608c479ce121c2f2e4ea480bbf15a8d1 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Mon, 17 Mar 2025 02:52:03 +0530 Subject: [PATCH] feat: added helptips for file and folder custom names --- .../components/PathDisplay/StyledWrapper.js | 2 +- .../src/components/PathDisplay/index.js | 9 +- .../Collection/CloneCollection/index.js | 68 +++++++----- .../CloneCollectionItem/index.js | 105 ++++++++++-------- .../RenameCollectionItem/index.js | 73 +++++++----- .../Sidebar/CreateCollection/index.js | 101 +++++++++-------- .../src/components/Sidebar/NewFolder/index.js | 61 +++++----- .../components/Sidebar/NewRequest/index.js | 58 +++++----- 8 files changed, 276 insertions(+), 201 deletions(-) diff --git a/packages/bruno-app/src/components/PathDisplay/StyledWrapper.js b/packages/bruno-app/src/components/PathDisplay/StyledWrapper.js index 1b6ace094..f5e174b78 100644 --- a/packages/bruno-app/src/components/PathDisplay/StyledWrapper.js +++ b/packages/bruno-app/src/components/PathDisplay/StyledWrapper.js @@ -31,7 +31,7 @@ const StyledWrapper = styled.div` .separator { color: ${(props) => props.theme.text}; opacity: 0.6; - margin: 0 1px; + margin: 0 2px; } } `; diff --git a/packages/bruno-app/src/components/PathDisplay/index.js b/packages/bruno-app/src/components/PathDisplay/index.js index b867abb7b..5e4add37d 100644 --- a/packages/bruno-app/src/components/PathDisplay/index.js +++ b/packages/bruno-app/src/components/PathDisplay/index.js @@ -4,6 +4,7 @@ import path from 'utils/common/path'; import StyledWrapper from './StyledWrapper'; const PathDisplay = ({ + collection, dirName = '', baseName = '' }) => { @@ -14,10 +15,16 @@ const PathDisplay = ({ return (
-
+
{hasExtension ? : }
+ {collection?.name && ( +
+ {collection.name} + / +
+ )} {pathSegments?.map((segment, index) => (
diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js index 35235df94..ab9fc1a7f 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CloneCollection/index.js @@ -7,7 +7,8 @@ import { cloneCollection } from 'providers/ReduxStore/slices/collections/actions import toast from 'react-hot-toast'; import Modal from 'components/Modal'; import { sanitizeName, validateName, validateNameError } from 'utils/common/regex'; -import PathDisplay from 'components/PathDisplay/index'; +import Help from 'components/Help'; +import PathDisplay from 'components/PathDisplay'; import { useState } from 'react'; import { IconArrowBackUp, IconEdit } from "@tabler/icons"; @@ -125,23 +126,46 @@ const CloneCollection = ({ onClose, collection }) => {
{formik.errors.collectionLocation}
) : null}
- + Browse
- {isEditing ? -
-
- + +
+
+ + {isEditing ? ( toggleEditing(false)} /> -
+ ) : ( + toggleEditing(true)} + /> + )} +
+ {isEditing ? ( { spellCheck="false" value={formik.values.collectionFolderName || ''} /> -
- : -
-
- - toggleEditing(true)} - /> -
+ ) : (
-
- } - {formik.touched.collectionFolderName && formik.errors.collectionFolderName ? ( -
{formik.errors.collectionFolderName}
- ) : null} + )} + + {formik.touched.collectionFolderName && formik.errors.collectionFolderName ? ( +
{formik.errors.collectionFolderName}
+ ) : null} +
diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.js index db9b0e895..296051a97 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/CloneCollectionItem/index.js @@ -8,6 +8,7 @@ import { isItemAFolder } from 'utils/tabs'; import { cloneItem } from 'providers/ReduxStore/slices/collections/actions'; import { IconArrowBackUp, IconEdit } from "@tabler/icons"; import { sanitizeName, validateName, validateNameError } from 'utils/common/regex'; +import Help from 'components/Help'; import PathDisplay from 'components/PathDisplay/index'; import path from 'utils/common/path'; @@ -91,60 +92,76 @@ const CloneCollectionItem = ({ collection, item, onClose }) => { /> {formik.touched.name && formik.errors.name ?
{formik.errors.name}
: null}
- {isEditing ? ( -
-
- - toggleEditing(false)} - /> -
-
- - {itemType !== 'folder' && .bru} -
-
- ) : ( -
-
- - +
+ + {isEditing ? ( + toggleEditing(false)} + /> + ) : ( + toggleEditing(true)} /> -
-
- -
+ )} +
+ {isEditing ? ( +
+ + {itemType !== 'folder' && .bru} +
+ ) : ( +
+
)} {formik.touched.filename && formik.errors.filename ? (
{formik.errors.filename}
) : null} +
); diff --git a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.js b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.js index 50c3dee22..619778755 100644 --- a/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.js +++ b/packages/bruno-app/src/components/Sidebar/Collections/Collection/CollectionItem/RenameCollectionItem/index.js @@ -10,6 +10,7 @@ import { IconArrowBackUp, IconEdit } from '@tabler/icons'; import { sanitizeName, validateName, validateNameError } from 'utils/common/regex'; import toast from 'react-hot-toast'; import { closeTabs } from 'providers/ReduxStore/slices/tabs'; +import Help from 'components/Help'; import PathDisplay from 'components/PathDisplay'; const RenameCollectionItem = ({ collection, item, onClose }) => { @@ -110,26 +111,54 @@ const RenameCollectionItem = ({ collection, item, onClose }) => { /> {formik.touched.name && formik.errors.name ?
{formik.errors.name}
: null}
- - {isEditing ? ( -
-
- + +
+
+ + {isEditing ? ( toggleEditing(false)} /> -
+ ) : ( + toggleEditing(true)} + /> + )} +
+ {isEditing ? (
{ /> {itemType !== 'folder' && .bru}
-
- ) : ( -
-
- - toggleEditing(true)} - /> -
+ ) : (
-
- )} - {formik.touched.filename && formik.errors.filename ? ( -
{formik.errors.filename}
- ) : null} + )} + {formik.touched.filename && formik.errors.filename ? ( +
{formik.errors.filename}
+ ) : null} +
); diff --git a/packages/bruno-app/src/components/Sidebar/CreateCollection/index.js b/packages/bruno-app/src/components/Sidebar/CreateCollection/index.js index a8787a8fb..07f390901 100644 --- a/packages/bruno-app/src/components/Sidebar/CreateCollection/index.js +++ b/packages/bruno-app/src/components/Sidebar/CreateCollection/index.js @@ -105,7 +105,7 @@ const CreateCollection = ({ onClose }) => { Bruno stores your collections on your computer's filesystem.

- Choose where you want to store this collection. + Choose the location where you want to store this collection.

@@ -126,59 +126,70 @@ const CreateCollection = ({ onClose }) => {
{formik.errors.collectionLocation}
) : null}
- + Browse
- {isEditing ? + {formik.values.collectionName?.trim()?.length > 0 && (
-
- + {isEditing ? ( + + ) : ( +
+ +
+ )} + {formik.touched.collectionFolderName && formik.errors.collectionFolderName ? ( +
{formik.errors.collectionFolderName}
+ ) : null}
- : -
-
- - toggleEditing(true)} - /> -
-
- -
-
- } - {formik.touched.collectionFolderName && formik.errors.collectionFolderName ? ( -
{formik.errors.collectionFolderName}
- ) : null} + )}
diff --git a/packages/bruno-app/src/components/Sidebar/NewFolder/index.js b/packages/bruno-app/src/components/Sidebar/NewFolder/index.js index b703beba0..7989f806f 100644 --- a/packages/bruno-app/src/components/Sidebar/NewFolder/index.js +++ b/packages/bruno-app/src/components/Sidebar/NewFolder/index.js @@ -9,7 +9,7 @@ import { IconArrowBackUp, IconEdit} from '@tabler/icons'; import { sanitizeName, validateName, validateNameError } from 'utils/common/regex'; import PathDisplay from 'components/PathDisplay/index'; import path from "utils/common/path"; - +import Help from 'components/Help'; const NewFolder = ({ collection, item, onClose }) => { const dispatch = useDispatch(); const inputRef = useRef(); @@ -88,20 +88,37 @@ const NewFolder = ({ collection, item, onClose }) => {
{formik.errors.folderName}
) : null} - - {isEditing ? ( -
-
- + +
+
+ + {isEditing ? ( toggleEditing(false)} /> -
+ ): ( + toggleEditing(true)} + /> + )} +
+ {isEditing ? (
{ value={formik.values.directoryName || ''} />
-
- ) : ( -
-
- - toggleEditing(true)} - /> -
+ ) : (
-
- )} - {formik.touched.directoryName && formik.errors.directoryName ? ( -
{formik.errors.directoryName}
- ) : null} + )} + {formik.touched.directoryName && formik.errors.directoryName ? ( +
{formik.errors.directoryName}
+ ) : null} +
); diff --git a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js index 6484f21ff..9e8f32beb 100644 --- a/packages/bruno-app/src/components/Sidebar/NewRequest/index.js +++ b/packages/bruno-app/src/components/Sidebar/NewRequest/index.js @@ -16,6 +16,7 @@ import { IconArrowBackUp, IconCaretDown, IconEdit } from '@tabler/icons'; import { sanitizeName, validateName, validateNameError } from 'utils/common/regex'; import Dropdown from 'components/Dropdown'; import PathDisplay from 'components/PathDisplay'; +import Help from 'components/Help'; import StyledWrapper from './StyledWrapper'; const NewRequest = ({ collection, item, isEphemeral, onClose }) => { @@ -318,19 +319,36 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
{formik.errors.requestName}
) : null} - {isEditing ? ( -
-
- +
+
+ + {isEditing ? ( toggleEditing(false)} /> -
+ ) : ( + toggleEditing(true)} + /> + )} +
+ {isEditing ? (
{ /> .bru
-
- ) : ( -
-
- - toggleEditing(true)} - /> -
+ ) : (
-
- )} - {formik.touched.filename && formik.errors.filename ? ( -
{formik.errors.filename}
- ) : null} + )} + {formik.touched.filename && formik.errors.filename ? ( +
{formik.errors.filename}
+ ) : null} +
{formik.values.requestType !== 'from-curl' ? ( <>