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

Minimap props refactor: miniMapBtn & zoomToolBar #1982

Closed
wants to merge 4 commits into from
Closed
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: 2 additions & 0 deletions src/components/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ App.propTypes = {
exportBtn: PropTypes.bool,
pipelineBtn: PropTypes.bool,
sidebar: PropTypes.bool,
miniMapBtn: PropTypes.bool,
jitu5 marked this conversation as resolved.
Show resolved Hide resolved
}),
/**
* Determines if certain elements are displayed, e.g global tool bar, sidebar
Expand All @@ -108,6 +109,7 @@ App.propTypes = {
sidebar: PropTypes.bool,
miniMap: PropTypes.bool,
expandAllPipelines: PropTypes.bool,
zoomToolBar: PropTypes.bool,
}),
};

Expand Down
8 changes: 5 additions & 3 deletions src/components/minimap-toolbar/minimap-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const MiniMapToolbar = ({
onToggleMiniMap,
onUpdateChartZoom,
visible,
displayZoomToolbar,
}) => {
const { scale, minScale, maxScale } = chartZoom;

Expand Down Expand Up @@ -45,7 +46,7 @@ export const MiniMapToolbar = ({
icon={PlusIcon}
labelText={'Zoom in'}
onClick={() => onUpdateChartZoom(scaleZoom(chartZoom, 1.3))}
visible={visible.miniMapBtn}
visible={displayZoomToolbar}
/>
<IconButton
ariaLabel={'Zoom out'}
Expand All @@ -57,7 +58,7 @@ export const MiniMapToolbar = ({
icon={MinusIcon}
labelText={'Zoom out'}
onClick={() => onUpdateChartZoom(scaleZoom(chartZoom, 0.7))}
visible={visible.miniMapBtn}
visible={displayZoomToolbar}
/>
<IconButton
ariaLabel={'Reset zoom'}
Expand All @@ -66,7 +67,7 @@ export const MiniMapToolbar = ({
icon={ResetIcon}
labelText={'Reset zoom'}
onClick={() => onUpdateChartZoom(scaleZoom(chartZoom, 0))}
visible={visible.miniMapBtn}
visible={displayZoomToolbar}
/>
<li>
<span className="pipeline-minimap-toolbar__scale" title="Zoom level">
Expand All @@ -88,6 +89,7 @@ const scaleZoom = ({ scale }, factor) => ({
export const mapStateToProps = (state) => ({
visible: state.visible,
displayMiniMap: state.display.miniMap,
displayZoomToolbar: state.display.zoomToolbar,
chartZoom: getChartZoom(state),
});

Expand Down
1 change: 1 addition & 0 deletions src/components/minimap-toolbar/minimap-toolbar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ describe('MiniMapToolbar', () => {
const expectedResult = {
displayMiniMap: true,
chartZoom: expect.any(Object),
displayZoomToolbar: expect.any(Boolean),
visible: expect.objectContaining({
miniMap: expect.any(Boolean),
miniMapBtn: expect.any(Boolean),
Expand Down
1 change: 1 addition & 0 deletions src/store/initial-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const createInitialState = () => ({
sidebar: true,
miniMap: true,
expandAllPipelines: false,
zoomToolbar: true,
},
zoom: {},
runsMetadata: {},
Expand Down
Loading