Skip to content

Commit

Permalink
toto
Browse files Browse the repository at this point in the history
Signed-off-by: mathieu <mathieu.dreano@gmail.com>
  • Loading branch information
MathieuDreano committed Nov 26, 2023
1 parent f1380f2 commit eb02a3c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, forwardRef, useState, useEffect } from 'react';
import React, { useRef, forwardRef, useState } from 'react';
import find from 'lodash/find';
import Dropdown from 'components/Dropdown';
import { selectEnvironment } from 'providers/ReduxStore/slices/collections/actions';
Expand All @@ -8,16 +8,19 @@ import toast from 'react-hot-toast';
import { useDispatch } from 'react-redux';
import StyledWrapper from './StyledWrapper';

const EnvironmentSelector = ({ collection }) => {
const EnvironmentSelector = (props) => {
const dispatch = useDispatch();
const dropdownTippyRef = useRef();
const [openSettingsModal, setOpenSettingsModal] = useState(false);
const { activeEnvironmentUid } = collection;
const [environments, setEnvironments] = useState(collection.environments);
useEffect(() => {
console.log('useEffect EnvironmentSelector');
}, [environments]);
const activeEnvironment = activeEnvironmentUid ? find(environments, (e) => e.uid === activeEnvironmentUid) : null;
const { activeEnvironmentUid } = props.collection;
const [collection, setCollection] = useState(props.collection);
const setEnvironments = (environments) => {
setCollection({ ...collection, environments: environments });
};

const activeEnvironment = activeEnvironmentUid
? find(collection.environments, (e) => e.uid === activeEnvironmentUid)
: null;

const Icon = forwardRef((props, ref) => {
return (
Expand Down Expand Up @@ -50,8 +53,8 @@ const EnvironmentSelector = ({ collection }) => {
<StyledWrapper>
<div className="flex items-center cursor-pointer environment-selector">
<Dropdown onCreate={onDropdownCreate} icon={<Icon />} placement="bottom-end">
{environments && environments.length
? environments.map((e) => (
{collection.environments?.length
? collection.environments.map((e) => (
<div
className="dropdown-item"
key={e.uid}
Expand Down Expand Up @@ -86,7 +89,6 @@ const EnvironmentSelector = ({ collection }) => {
{openSettingsModal && (
<EnvironmentSettings
collection={collection}
environments={environments}
setEnvironments={setEnvironments}
onClose={() => setOpenSettingsModal(false)}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const EnvironmentColor = ({ environment, onColorChange, collectionUid }) => {
}
}, [formik.values.color]);

console.log(environment.color);
return (
<CirclePicker
id="environment-color"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const EnvironmentList = ({ collection, setEnvironments }) => {

// check env delete
if (prevEnvUids?.length && envUids.length < prevEnvUids.length) {
setSelectedEnvironment(collection.environments?.length ? environments[0] : null);
setSelectedEnvironment(collection.environments?.length ? collection.environments[0] : null);
}
}, [envUids, collection, prevEnvUids]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Modal from 'components/Modal/index';
import React, { useState, useEffect } from 'react';
import React, { useState } from 'react';
import CreateEnvironment from './CreateEnvironment';
import EnvironmentList from './EnvironmentList';
import StyledWrapper from './StyledWrapper';
Expand Down
1 change: 0 additions & 1 deletion packages/bruno-lang/v2/src/jsonToEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ ${secretVars.join(',\n')}
}

if (color !== undefined) {
console.log('jsonToEnv color', color);
output += `color: ${color}
`;
}
Expand Down

0 comments on commit eb02a3c

Please sign in to comment.