Skip to content

Commit

Permalink
update failed test and use visibleSidebar instead
Browse files Browse the repository at this point in the history
Signed-off-by: Huong Nguyen <huongg1409@gmail>
  • Loading branch information
Huong Nguyen committed Jul 29, 2024
1 parent ead4fad commit 8306bcc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import Button from '../../../ui/button';

import './sliced-pipeline-action-bar.scss';

export const SlicedPipelineActionBar = ({ chartSize, slicedPipeline }) => {
const { outerWidth, sidebarWidth } = chartSize;
const sidebarVisible = sidebarWidth > 140;
export const SlicedPipelineActionBar = ({
chartSize,
slicedPipeline,
visibleSidebar,
}) => {
const { outerWidth } = chartSize;

const transformX = sidebarVisible ? outerWidth / 2 + 100 : outerWidth / 2;
const transformX = visibleSidebar ? outerWidth / 2 + 100 : outerWidth / 2;
if (slicedPipeline.length > 0) {
return (
<div
Expand Down
2 changes: 2 additions & 0 deletions src/components/flowchart/flowchart.js
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ export class FlowChart extends Component {
visibleGraph,
displayGlobalNavigation,
displaySidebar,
visibleSidebar,
} = this.props;
const { outerWidth = 0, outerHeight = 0 } = chartSize;
const { slicedPipelineState } = this.state;
Expand Down Expand Up @@ -786,6 +787,7 @@ export class FlowChart extends Component {
<SlicedPipelineActionBar
chartSize={chartSize}
slicedPipeline={slicedPipelineState.range}
visibleSidebar={visibleSidebar}
/>
</div>
<Tooltip
Expand Down
2 changes: 1 addition & 1 deletion src/components/flowchart/flowchart.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ describe('FlowChart', () => {
displayGlobalNavigation: expect.any(Boolean),
displaySidebar: expect.any(Boolean),
displayMetadataPanel: expect.any(Boolean),
filteredPipeline: expect.any(Object),
slicedPipeline: expect.any(Object),
};
expect(mapStateToProps(mockState.spaceflights)).toEqual(expectedResult);
});
Expand Down

0 comments on commit 8306bcc

Please sign in to comment.