From 8fbb77766596907e9552cc42552fc6ef5a59dab4 Mon Sep 17 00:00:00 2001 From: Anoop M D Date: Sun, 22 Jan 2023 02:34:23 +0530 Subject: [PATCH] feat: ask foldername when creating collection --- packages/bruno-app/package.json | 1 + .../Sidebar/CreateCollection/index.js | 32 ++++++++++++++++--- .../bruno-app/src/components/Tooltip/index.js | 16 ++++++++++ packages/bruno-app/src/pages/_app.js | 1 + .../ReduxStore/slices/collections/actions.js | 7 ++-- .../src/ipc/local-collection.js | 4 +-- 6 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 packages/bruno-app/src/components/Tooltip/index.js diff --git a/packages/bruno-app/package.json b/packages/bruno-app/package.json index 7ca31f8a2..00bacad1c 100644 --- a/packages/bruno-app/package.json +++ b/packages/bruno-app/package.json @@ -46,6 +46,7 @@ "react-dom": "18.2.0", "react-hot-toast": "^2.4.0", "react-redux": "^7.2.6", + "react-tooltip": "^5.5.2", "reckonjs": "^0.1.2", "sass": "^1.46.0", "split-on-first": "^3.0.0", diff --git a/packages/bruno-app/src/components/Sidebar/CreateCollection/index.js b/packages/bruno-app/src/components/Sidebar/CreateCollection/index.js index b5104cfaf..4b0756f02 100644 --- a/packages/bruno-app/src/components/Sidebar/CreateCollection/index.js +++ b/packages/bruno-app/src/components/Sidebar/CreateCollection/index.js @@ -5,6 +5,7 @@ import * as Yup from 'yup'; import { browseDirectory } from 'providers/ReduxStore/slices/collections/actions'; import { createCollection } from 'providers/ReduxStore/slices/collections/actions'; import toast from 'react-hot-toast'; +import Tooltip from 'components/Tooltip'; import Modal from 'components/Modal'; const CreateCollection = ({ onClose }) => { @@ -15,13 +16,16 @@ const CreateCollection = ({ onClose }) => { enableReinitialize: true, initialValues: { collectionName: '', + collectionFolderName: '', collectionLocation: '' }, validationSchema: Yup.object({ - collectionName: Yup.string().min(1, 'must be atleast 1 characters').max(50, 'must be 50 characters or less').required('name is required') + collectionName: Yup.string().min(1, 'must be atleast 1 characters').max(50, 'must be 50 characters or less').required('collection name is required'), + collectionFolderName: Yup.string().min(1, 'must be atleast 1 characters').max(50, 'must be 50 characters or less').required('folder name is required'), + collectionLocation: Yup.string().required('location is required') }), onSubmit: (values) => { - dispatch(createCollection(values.collectionName, values.collectionLocation)) + dispatch(createCollection(values.collectionName, values.collectionFolderName, values.collectionLocation)) .then(() => { toast.success('Collection created'); onClose(); @@ -53,8 +57,9 @@ const CreateCollection = ({ onClose }) => {
-