mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-27 07:21:51 +02:00
fix: fixed bugs
This commit is contained in:
parent
96f50b0c6d
commit
51784d08cd
@ -9,8 +9,8 @@ const EnvironmentList = ({ collection }) => {
|
|||||||
const [openCreateModal, setOpenCreateModal] = useState(false);
|
const [openCreateModal, setOpenCreateModal] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSelectedEnvironment(environments[0]);
|
setSelectedEnvironment(environments && environments.length ? environments[0] : null);
|
||||||
}, []);
|
}, [environments]);
|
||||||
|
|
||||||
if (!selectedEnvironment) {
|
if (!selectedEnvironment) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -20,7 +20,6 @@ const RemoveCollectionFromWorkspace = ({ onClose, collection }) => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(() => dispatch(removeLocalCollection(collection.uid)))
|
|
||||||
.then(() => toast.success('Collection removed from workspace'))
|
.then(() => toast.success('Collection removed from workspace'))
|
||||||
.catch((err) => console.log(err) && toast.error('An error occured while removing the collection'));
|
.catch((err) => console.log(err) && toast.error('An error occured while removing the collection'));
|
||||||
};
|
};
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
color: ${(props) => props.theme.colors.text.muted};
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default Wrapper;
|
@ -8,6 +8,7 @@ import toast from 'react-hot-toast';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import CreateCollection from 'components/Sidebar/CreateCollection';
|
import CreateCollection from 'components/Sidebar/CreateCollection';
|
||||||
import SelectCollection from 'components/Sidebar/Collections/SelectCollection';
|
import SelectCollection from 'components/Sidebar/Collections/SelectCollection';
|
||||||
|
import StyledWrapper from './StyledWrapper';
|
||||||
|
|
||||||
const LinkStyle = styled.span`
|
const LinkStyle = styled.span`
|
||||||
color: ${(props) => props.theme['text-link']};
|
color: ${(props) => props.theme['text-link']};
|
||||||
@ -50,7 +51,7 @@ const CreateOrAddCollection = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="px-2 mt-4 text-gray-600">
|
<StyledWrapper className="px-2 mt-4">
|
||||||
{createCollectionModalOpen ? <CreateCollection handleCancel={() => setCreateCollectionModalOpen(false)} handleConfirm={handleCreateCollection} /> : null}
|
{createCollectionModalOpen ? <CreateCollection handleCancel={() => setCreateCollectionModalOpen(false)} handleConfirm={handleCreateCollection} /> : null}
|
||||||
|
|
||||||
{addCollectionToWSModalOpen ? (
|
{addCollectionToWSModalOpen ? (
|
||||||
@ -63,7 +64,7 @@ const CreateOrAddCollection = () => {
|
|||||||
<CreateLink /> or <AddLink /> Collection to Workspace.
|
<CreateLink /> or <AddLink /> Collection to Workspace.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</StyledWrapper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@ const darkTheme = {
|
|||||||
|
|
||||||
colors: {
|
colors: {
|
||||||
text: {
|
text: {
|
||||||
danger: '#f06f57'
|
danger: '#f06f57',
|
||||||
|
muted: '#9d9d9d'
|
||||||
},
|
},
|
||||||
bg: {
|
bg: {
|
||||||
danger: '#d03544'
|
danger: '#d03544'
|
||||||
|
@ -6,7 +6,8 @@ const lightTheme = {
|
|||||||
|
|
||||||
colors: {
|
colors: {
|
||||||
text: {
|
text: {
|
||||||
danger: 'rgb(185, 28, 28)'
|
danger: 'rgb(185, 28, 28)',
|
||||||
|
muted: '#4b5563',
|
||||||
},
|
},
|
||||||
bg: {
|
bg: {
|
||||||
danger: '#dc3545'
|
danger: '#dc3545'
|
||||||
|
@ -2,6 +2,7 @@ import each from 'lodash/each';
|
|||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import fileDialog from 'file-dialog';
|
import fileDialog from 'file-dialog';
|
||||||
import toast from 'react-hot-toast';
|
import toast from 'react-hot-toast';
|
||||||
|
import cloneDeep from 'lodash/cloneDeep';
|
||||||
import { uuid } from 'utils/common';
|
import { uuid } from 'utils/common';
|
||||||
import { collectionSchema } from '@usebruno/schema';
|
import { collectionSchema } from '@usebruno/schema';
|
||||||
import { saveCollectionToIdb } from 'utils/idb';
|
import { saveCollectionToIdb } from 'utils/idb';
|
||||||
@ -29,7 +30,6 @@ const parseJsonCollection = (str) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const validateSchema = (collection = {}) => {
|
const validateSchema = (collection = {}) => {
|
||||||
collection.uid = uuid();
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
collectionSchema
|
collectionSchema
|
||||||
.validate(collection)
|
.validate(collection)
|
||||||
@ -41,7 +41,9 @@ const validateSchema = (collection = {}) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateUidsInCollection = (collection) => {
|
const updateUidsInCollection = (_collection) => {
|
||||||
|
const collection = cloneDeep(_collection);
|
||||||
|
|
||||||
collection.uid = uuid();
|
collection.uid = uuid();
|
||||||
|
|
||||||
const updateItemUids = (items = []) => {
|
const updateItemUids = (items = []) => {
|
||||||
@ -86,7 +88,6 @@ const importCollection = () => {
|
|||||||
export const importSampleCollection = () => {
|
export const importSampleCollection = () => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
validateSchema(sampleCollection)
|
validateSchema(sampleCollection)
|
||||||
.then(validateSchema)
|
|
||||||
.then(updateUidsInCollection)
|
.then(updateUidsInCollection)
|
||||||
.then(validateSchema)
|
.then(validateSchema)
|
||||||
.then((collection) => saveCollectionToIdb(window.__idb, collection))
|
.then((collection) => saveCollectionToIdb(window.__idb, collection))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user