Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENG-1354, 1415] Fixes bottom sidesheet and ReactFlow alignment issues #267

Merged
merged 3 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ui/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lint:fix": "eslint '*/**/*.{js,ts,tsx}' --format table --fix"
},
"dependencies": {
"@aqueducthq/common": "^0.0.11",
"@aqueducthq/common": "^0.0.11-rc10",
"@emotion/react": "^11.9.0",
"@emotion/styled": "^11.8.1",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/ui/common/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@aqueducthq/common",
"author": "Aqueduct <[email protected]",
"version": "0.0.11",
"version": "0.0.11-rc0",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"alias": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,8 @@ export const AqueductSidebar: React.FC<Props> = ({
// open bottom to top
bottomAligned: {
position: 'absolute',
right: bottomSideSheetOffset,
left: MenuSidebarOffset,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super urgent, but we'll need to add this to the EnterpriseMenuSidebar as well. we use different components on enterprise and OSS

bottom: 0,
mx: `${BottomSidebarMarginInPx}px`,
transition: AllTransition,
width: bottomSideSheetWidth,
height: `${BottomSidebarHeightInPx}px`,
Expand Down
4 changes: 2 additions & 2 deletions src/ui/common/src/components/pages/workflow/id/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,13 @@ const WorkflowPage: React.FC<WorkflowPageProps> = ({
mt: 2,
p: 3,
mb: contentBottomOffsetInPx,
width: '100%',
boxSizing: 'border-box',
backgroundColor: 'gray.50',
}}
>
<ReactFlowProvider>
<ReactFlowCanvas
nodes={dagPosition.result?.nodes}
edges={dagPosition.result?.edges}
switchSideSheet={switchSideSheet}
onPaneClicked={onPaneClicked}
/>
Expand Down
17 changes: 8 additions & 9 deletions src/ui/common/src/components/workflows/ReactFlowCanvas.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useEffect } from 'react';
import ReactFlow, {
Edge,
Node as ReactFlowNode,
useReactFlow,
} from 'react-flow-renderer';
Expand All @@ -19,23 +18,23 @@ type ReactFlowCanvasProps = {
event: React.MouseEvent,
element: ReactFlowNode<ReactFlowNodeData>
) => void;
nodes: ReactFlowNode<ReactFlowNodeData>[];
edges: Edge[];
};

const ReactFlowCanvas: React.FC<ReactFlowCanvasProps> = ({
onPaneClicked,
switchSideSheet,
nodes,
edges,
}) => {
const openSideSheetState = useSelector(
(state: RootState) => state.openSideSheetReducer
);
const { fitView } = useReactFlow();
const dagPositionState = useSelector(
(state: RootState) => state.workflowReducer.selectedDagPosition
);

const { fitView, viewportInitialized } = useReactFlow();
useEffect(() => {
fitView();
}, []);
}, [dagPositionState]);

useEffect(() => {
// NOTE(vikram): There's a timeout here because there seems to be a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timeout still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still necessary. This has to do with a race condition between the CSS transition for the div and when the fitView call is made.

Expand All @@ -48,8 +47,8 @@ const ReactFlowCanvas: React.FC<ReactFlowCanvasProps> = ({
return (
<ReactFlow
onPaneClick={onPaneClicked}
nodes={nodes}
edges={edges}
nodes={dagPositionState.result?.nodes}
edges={dagPositionState.result?.edges}
onNodeClick={switchSideSheet}
nodeTypes={nodeTypes}
connectionLineStyle={connectionLineStyle}
Expand Down