mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-28 15:14:06 +00:00
* feat: inline create collection and workspace editor * refactor: use inline collection creation from workspace overview * fix: improve inline collection creation UX from workspace overview * fix: update E2E tests for inline collection creation flow * fix: update default location test for inline collection creation flow * fix: derive inline workspace/collection names from filesystem * feat: inline workspace create form manage workspace * feat: prefill create modal with name * fix: minor code style fixes --------- Co-authored-by: naman-bruno <naman@usebruno.com>
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
import { useTheme } from '../../../../providers/Theme';
|
|
import { useDispatch } from 'react-redux';
|
|
import { openCollection } from 'providers/ReduxStore/slices/collections/actions';
|
|
|
|
import toast from 'react-hot-toast';
|
|
import styled from 'styled-components';
|
|
import StyledWrapper from './StyledWrapper';
|
|
|
|
const LinkStyle = styled.span`
|
|
color: ${(props) => props.theme['text-link']};
|
|
`;
|
|
|
|
const CreateOrOpenCollection = ({ onCreateClick }) => {
|
|
const { theme } = useTheme();
|
|
const dispatch = useDispatch();
|
|
|
|
const handleOpenCollection = () => {
|
|
dispatch(openCollection()).catch(
|
|
(err) => {
|
|
console.log(err);
|
|
toast.error('An error occurred while opening the collection');
|
|
}
|
|
);
|
|
};
|
|
const CreateLink = () => (
|
|
<LinkStyle
|
|
className="underline text-link cursor-pointer"
|
|
theme={theme}
|
|
onClick={onCreateClick}
|
|
>
|
|
Create
|
|
</LinkStyle>
|
|
);
|
|
const OpenLink = () => (
|
|
<LinkStyle className="underline text-link cursor-pointer" theme={theme} onClick={() => handleOpenCollection(true)}>
|
|
Open
|
|
</LinkStyle>
|
|
);
|
|
|
|
return (
|
|
<StyledWrapper className="px-2 mt-4">
|
|
<div className="text-xs text-center">
|
|
<div>No collections found.</div>
|
|
<div className="mt-2">
|
|
<CreateLink /> or <OpenLink /> Collection.
|
|
</div>
|
|
</div>
|
|
</StyledWrapper>
|
|
);
|
|
};
|
|
|
|
export default CreateOrOpenCollection;
|