Files
bruno/packages/bruno-app/src/components/Sidebar/Collections/CreateOrOpenCollection/index.js
gopu-bruno 6d86c76b21 feat: inline create collection and workspace editor (#7324)
* 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>
2026-03-04 13:25:30 +05:30

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;