diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js index 8bfbb075eb..eb0fedc250 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSelector/index.js @@ -1,18 +1,17 @@ -import React, { useRef, forwardRef, useState } from 'react'; +import React, { useRef, forwardRef } from 'react'; import find from 'lodash/find'; import Dropdown from 'components/Dropdown'; import { selectEnvironment } from 'providers/ReduxStore/slices/collections/actions'; -import { updateEnvironmentSettingsModalVisibility } from 'providers/ReduxStore/slices/app'; import { IconSettings, IconCaretDown, IconDatabase, IconDatabaseOff } from '@tabler/icons'; -import EnvironmentSettings from '../EnvironmentSettings'; import toast from 'react-hot-toast'; import { useDispatch } from 'react-redux'; import StyledWrapper from './StyledWrapper'; +import { addTab } from 'providers/ReduxStore/slices/tabs'; +import { uuid } from 'utils/common'; const EnvironmentSelector = ({ collection }) => { const dispatch = useDispatch(); const dropdownTippyRef = useRef(); - const [openSettingsModal, setOpenSettingsModal] = useState(false); const { environments, activeEnvironmentUid } = collection; const activeEnvironment = activeEnvironmentUid ? find(environments, (e) => e.uid === activeEnvironmentUid) : null; @@ -25,15 +24,15 @@ const EnvironmentSelector = ({ collection }) => { ); }); - const handleSettingsIconClick = () => { - setOpenSettingsModal(true); - dispatch(updateEnvironmentSettingsModalVisibility(true)); - }; - - const handleModalClose = () => { - setOpenSettingsModal(false); - dispatch(updateEnvironmentSettingsModalVisibility(false)); - }; + const viewEnvironmentSettings = () => { + dispatch( + addTab({ + uid: uuid(), + collectionUid: collection.uid, + type: 'environment-settings' + }) + ) + } const onDropdownCreate = (ref) => (dropdownTippyRef.current = ref); @@ -78,7 +77,7 @@ const EnvironmentSelector = ({ collection }) => { No Environment -
+
@@ -86,7 +85,6 @@ const EnvironmentSelector = ({ collection }) => {
- {openSettingsModal && } ); }; diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js index 330ae082c6..51dcb23fda 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/StyledWrapper.js @@ -1,18 +1,13 @@ import styled from 'styled-components'; const StyledWrapper = styled.div` - margin-inline: -1rem; - margin-block: -1.5rem; - - background-color: ${(props) => props.theme.collection.environment.settings.bg}; - - .environments-sidebar { - background-color: ${(props) => props.theme.collection.environment.settings.sidebar.bg}; - border-right: solid 1px ${(props) => props.theme.collection.environment.settings.sidebar.borderRight}; - min-height: 400px; - height: 100%; - max-height: 85vh; - overflow-y: auto; + width: 100%; + height: 100%; + display: flex; + padding: 0.25rem; + + .environment-list-divider { + border-right: 1px solid ${(props) => props.theme.requestTabs.bottomBorder}; } .environment-item { @@ -21,7 +16,7 @@ const StyledWrapper = styled.div` position: relative; cursor: pointer; padding: 8px 10px; - border-left: solid 2px transparent; + border-bottom: solid 2px transparent; text-decoration: none; &:hover { @@ -32,7 +27,7 @@ const StyledWrapper = styled.div` .active { background-color: ${(props) => props.theme.collection.environment.settings.item.active.bg} !important; - border-left: solid 2px ${(props) => props.theme.collection.environment.settings.item.border}; + border-bottom: solid 2px ${(props) => props.theme.collection.environment.settings.item.border}; &:hover { background-color: ${(props) => props.theme.collection.environment.settings.item.active.hoverBg} !important; } diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js index 4517bd8d3f..b574f1171f 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js @@ -93,13 +93,13 @@ const EnvironmentList = ({ selectedEnvironment, setSelectedEnvironment, collecti {openManageSecretsModal && setOpenManageSecretsModal(false)} />}
-
+
{switchEnvConfirmClose && (
handleConfirmSwitch(false)} />
)} -
+
{environments && environments.length && environments.map((env) => ( diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/StyledWrapper.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/StyledWrapper.js index 2dfad0cfe2..26f17782a9 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/StyledWrapper.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/StyledWrapper.js @@ -1,6 +1,10 @@ import styled from 'styled-components'; const StyledWrapper = styled.div` + width: 100%; + height: 100%; + padding: 1rem; + button.btn-create-environment { &:hover { span { diff --git a/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js b/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js index 3a17e2ecd0..320277d384 100644 --- a/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js +++ b/packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js @@ -1,4 +1,3 @@ -import Modal from 'components/Modal/index'; import React, { useState } from 'react'; import CreateEnvironment from './CreateEnvironment'; import EnvironmentList from './EnvironmentList'; @@ -42,7 +41,7 @@ const DefaultTab = ({ setTab }) => { ); }; -const EnvironmentSettings = ({ collection, onClose }) => { +const EnvironmentSettings = ({ collection }) => { const [isModified, setIsModified] = useState(false); const { environments } = collection; const [selectedEnvironment, setSelectedEnvironment] = useState(null); @@ -50,7 +49,6 @@ const EnvironmentSettings = ({ collection, onClose }) => { if (!environments || !environments.length) { return ( - {tab === 'create' ? ( setTab('default')} /> ) : tab === 'import' ? ( @@ -59,13 +57,12 @@ const EnvironmentSettings = ({ collection, onClose }) => { <> )} - ); } return ( - + { isModified={isModified} setIsModified={setIsModified} /> - + ); }; diff --git a/packages/bruno-app/src/components/RequestTabPanel/index.js b/packages/bruno-app/src/components/RequestTabPanel/index.js index e1f4b6fda4..ab0af88b81 100644 --- a/packages/bruno-app/src/components/RequestTabPanel/index.js +++ b/packages/bruno-app/src/components/RequestTabPanel/index.js @@ -22,6 +22,7 @@ import SecuritySettings from 'components/SecuritySettings'; import FolderSettings from 'components/FolderSettings'; import { getGlobalEnvironmentVariables } from 'utils/collections/index'; import { produce } from 'immer'; +import EnvironmentSettings from 'components/Environments/EnvironmentSettings'; const MIN_LEFT_PANE_WIDTH = 300; const MIN_RIGHT_PANE_WIDTH = 350; @@ -157,6 +158,10 @@ const RequestTabPanel = () => { return ; } + if (focusedTab.type === 'environment-settings') { + return ; + } + const item = findItemInCollection(collection, activeTabUid); if (!item || !item.uid) { return ; diff --git a/packages/bruno-app/src/components/RequestTabs/RequestTab/SpecialTab.js b/packages/bruno-app/src/components/RequestTabs/RequestTab/SpecialTab.js index c5d09faa8d..604eb674ad 100644 --- a/packages/bruno-app/src/components/RequestTabs/RequestTab/SpecialTab.js +++ b/packages/bruno-app/src/components/RequestTabs/RequestTab/SpecialTab.js @@ -45,6 +45,14 @@ const SpecialTab = ({ handleCloseClick, type, tabName }) => { ); } + case 'environment-settings': { + return ( + <> +