Skip to content

Commit e1fa901

Browse files
committed
revert data modeling changes
1 parent ebe9694 commit e1fa901

File tree

2 files changed

+41
-54
lines changed

2 files changed

+41
-54
lines changed
Lines changed: 10 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,35 @@
1-
import React, { useMemo } from 'react';
1+
import React from 'react';
22
import { connect } from 'react-redux';
33
import DiagramEditor from './diagram-editor';
44
import SavedDiagramsList from './saved-diagrams-list';
55
import NewDiagramFormModal from './new-diagram-form';
66
import type { DataModelingState } from '../store/reducer';
77
import { DiagramProvider } from '@mongodb-js/diagramming';
88
import DiagramEditorSidePanel from './diagram-editor-side-panel';
9-
import {
10-
DrawerDisplayMode,
11-
DrawerLayout,
12-
type DrawerLayoutProps,
13-
} from '@mongodb-js/compass-components';
14-
import { closeSidePanel } from '../store/side-panel';
159
type DataModelingPluginInitialProps = {
1610
showList: boolean;
17-
isSidePanelOpen: boolean;
18-
onSidePanelClose: () => void;
1911
};
2012

2113
const DataModeling: React.FunctionComponent<DataModelingPluginInitialProps> = ({
2214
showList,
23-
onSidePanelClose,
2415
}) => {
25-
const drawerToolbarData = useMemo<DrawerLayoutProps['toolbarData']>(
26-
() => [
27-
{
28-
id: 'DiagramEditor',
29-
label: 'Data Model',
30-
content: <DiagramEditorSidePanel />,
31-
title: 'Data Model',
32-
glyph: 'Diagram',
33-
onClose: onSidePanelClose,
34-
},
35-
],
36-
[onSidePanelClose]
37-
);
38-
3916
return (
4017
<>
4118
{showList ? (
4219
<SavedDiagramsList></SavedDiagramsList>
4320
) : (
44-
<DrawerLayout
45-
displayMode={DrawerDisplayMode.Overlay}
46-
toolbarData={drawerToolbarData}
47-
>
48-
<DiagramProvider fitView>
49-
<DiagramEditor />
50-
</DiagramProvider>
51-
</DrawerLayout>
21+
<DiagramProvider fitView>
22+
<DiagramEditor />
23+
<DiagramEditorSidePanel />
24+
</DiagramProvider>
5225
)}
5326
<NewDiagramFormModal></NewDiagramFormModal>
5427
</>
5528
);
5629
};
5730

58-
export default connect(
59-
(state: DataModelingState) => {
60-
return {
61-
showList: state.step === 'NO_DIAGRAM_SELECTED',
62-
isSidePanelOpen: state.sidePanel.isOpen,
63-
};
64-
},
65-
{
66-
onSidePanelClose: closeSidePanel,
67-
}
68-
)(DataModeling);
31+
export default connect((state: DataModelingState) => {
32+
return {
33+
showList: state.step === 'NO_DIAGRAM_SELECTED',
34+
};
35+
})(DataModeling);
Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import React from 'react';
22
import { connect } from 'react-redux';
33
import type { DataModelingState } from '../store/reducer';
4+
import { closeSidePanel } from '../store/side-panel';
45
import {
6+
Button,
57
css,
68
cx,
9+
Body,
710
spacing,
811
palette,
912
useDarkMode,
@@ -18,27 +21,44 @@ const containerStyles = css({
1821
alignItems: 'center',
1922
justifyContent: 'center',
2023
gap: spacing[400],
24+
borderLeft: `1px solid ${palette.gray.light2}`,
2125
});
2226

2327
const darkModeContainerStyles = css({
2428
borderLeftColor: palette.gray.dark2,
2529
});
2630

27-
function DiagramEditorSidePanel() {
28-
const isDarkMode = useDarkMode();
29-
30-
// TODO: this is a placeholder for the side panel content.
31+
type DiagramEditorSidePanelProps = {
32+
isOpen: boolean;
33+
onClose: () => void;
34+
};
3135

36+
function DiagmramEditorSidePanel({
37+
isOpen,
38+
onClose,
39+
}: DiagramEditorSidePanelProps) {
40+
const isDarkMode = useDarkMode();
41+
if (!isOpen) {
42+
return null;
43+
}
3244
return (
3345
<div className={cx(containerStyles, isDarkMode && darkModeContainerStyles)}>
34-
This feature is under development.
46+
<Body>This feature is under development.</Body>
47+
<Button onClick={onClose} variant="primary" size="small">
48+
Close Side Panel
49+
</Button>
3550
</div>
3651
);
3752
}
3853

39-
export default connect((state: DataModelingState) => {
40-
const { sidePanel } = state;
41-
return {
42-
isOpen: sidePanel.isOpen,
43-
};
44-
})(DiagramEditorSidePanel);
54+
export default connect(
55+
(state: DataModelingState) => {
56+
const { sidePanel } = state;
57+
return {
58+
isOpen: sidePanel.isOpen,
59+
};
60+
},
61+
{
62+
onClose: closeSidePanel,
63+
}
64+
)(DiagmramEditorSidePanel);

0 commit comments

Comments
 (0)