From 9ba705815b5b7aa94ce7207236085152e6eebff6 Mon Sep 17 00:00:00 2001 From: Jitendra Gundaniya Date: Tue, 16 Jul 2024 17:30:51 +0100 Subject: [PATCH 1/3] Minimap prop refactor Signed-off-by: Jitendra Gundaniya --- src/components/global-toolbar/global-toolbar.test.js | 1 + src/components/minimap-toolbar/minimap-toolbar.js | 6 +++--- src/store/initial-state.js | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/global-toolbar/global-toolbar.test.js b/src/components/global-toolbar/global-toolbar.test.js index 74e9012844..5a6bb9f35b 100644 --- a/src/components/global-toolbar/global-toolbar.test.js +++ b/src/components/global-toolbar/global-toolbar.test.js @@ -60,6 +60,7 @@ describe('GlobalToolbar', () => { settingsModal: false, shareableUrlModal: false, sidebar: true, + zoomToolbar: true, }, }; expect(mapStateToProps(mockState.spaceflights)).toEqual(expectedResult); diff --git a/src/components/minimap-toolbar/minimap-toolbar.js b/src/components/minimap-toolbar/minimap-toolbar.js index dc706b09f3..3c38d66b5a 100644 --- a/src/components/minimap-toolbar/minimap-toolbar.js +++ b/src/components/minimap-toolbar/minimap-toolbar.js @@ -45,7 +45,7 @@ export const MiniMapToolbar = ({ icon={PlusIcon} labelText={'Zoom in'} onClick={() => onUpdateChartZoom(scaleZoom(chartZoom, 1.3))} - visible={visible.miniMapBtn} + visible={visible.zoomToolbar} /> onUpdateChartZoom(scaleZoom(chartZoom, 0.7))} - visible={visible.miniMapBtn} + visible={visible.zoomToolbar} /> onUpdateChartZoom(scaleZoom(chartZoom, 0))} - visible={visible.miniMapBtn} + visible={visible.zoomToolbar} />
  • diff --git a/src/store/initial-state.js b/src/store/initial-state.js index 9e65f9497f..1e654d9f03 100644 --- a/src/store/initial-state.js +++ b/src/store/initial-state.js @@ -45,6 +45,7 @@ export const createInitialState = () => ({ settingsModal: false, shareableUrlModal: false, sidebar: window.innerWidth > sidebarWidth.breakpoint, + zoomToolbar: true, }, display: { globalToolbar: true, From 2f602cd01c7a0ace7ef7fd5f38260c5dd57a74fd Mon Sep 17 00:00:00 2001 From: Jitendra Gundaniya Date: Wed, 17 Jul 2024 15:29:51 +0100 Subject: [PATCH 2/3] propTypes added Signed-off-by: Jitendra Gundaniya --- src/components/app/app.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/app/app.js b/src/components/app/app.js index ba70cfb8af..66916bc68f 100644 --- a/src/components/app/app.js +++ b/src/components/app/app.js @@ -99,6 +99,8 @@ App.propTypes = { exportBtn: PropTypes.bool, pipelineBtn: PropTypes.bool, sidebar: PropTypes.bool, + zoomToolBar: PropTypes.bool, + miniMapBtn: PropTypes.bool, }), /** * Determines if certain elements are displayed, e.g global tool bar, sidebar From 47b741419fa22f8d394e35412bf96ecf327beae7 Mon Sep 17 00:00:00 2001 From: Jitendra Gundaniya Date: Thu, 18 Jul 2024 15:32:51 +0100 Subject: [PATCH 3/3] Moving zoomToolbar into display Signed-off-by: Jitendra Gundaniya --- src/components/app/app.js | 2 +- src/components/global-toolbar/global-toolbar.test.js | 1 - src/components/minimap-toolbar/minimap-toolbar.js | 8 +++++--- src/components/minimap-toolbar/minimap-toolbar.test.js | 1 + src/store/initial-state.js | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/components/app/app.js b/src/components/app/app.js index 66916bc68f..788a98482f 100644 --- a/src/components/app/app.js +++ b/src/components/app/app.js @@ -99,7 +99,6 @@ App.propTypes = { exportBtn: PropTypes.bool, pipelineBtn: PropTypes.bool, sidebar: PropTypes.bool, - zoomToolBar: PropTypes.bool, miniMapBtn: PropTypes.bool, }), /** @@ -110,6 +109,7 @@ App.propTypes = { sidebar: PropTypes.bool, miniMap: PropTypes.bool, expandAllPipelines: PropTypes.bool, + zoomToolBar: PropTypes.bool, }), }; diff --git a/src/components/global-toolbar/global-toolbar.test.js b/src/components/global-toolbar/global-toolbar.test.js index 5a6bb9f35b..74e9012844 100644 --- a/src/components/global-toolbar/global-toolbar.test.js +++ b/src/components/global-toolbar/global-toolbar.test.js @@ -60,7 +60,6 @@ describe('GlobalToolbar', () => { settingsModal: false, shareableUrlModal: false, sidebar: true, - zoomToolbar: true, }, }; expect(mapStateToProps(mockState.spaceflights)).toEqual(expectedResult); diff --git a/src/components/minimap-toolbar/minimap-toolbar.js b/src/components/minimap-toolbar/minimap-toolbar.js index 3c38d66b5a..91a85dc567 100644 --- a/src/components/minimap-toolbar/minimap-toolbar.js +++ b/src/components/minimap-toolbar/minimap-toolbar.js @@ -18,6 +18,7 @@ export const MiniMapToolbar = ({ onToggleMiniMap, onUpdateChartZoom, visible, + displayZoomToolbar, }) => { const { scale, minScale, maxScale } = chartZoom; @@ -45,7 +46,7 @@ export const MiniMapToolbar = ({ icon={PlusIcon} labelText={'Zoom in'} onClick={() => onUpdateChartZoom(scaleZoom(chartZoom, 1.3))} - visible={visible.zoomToolbar} + visible={displayZoomToolbar} /> onUpdateChartZoom(scaleZoom(chartZoom, 0.7))} - visible={visible.zoomToolbar} + visible={displayZoomToolbar} /> onUpdateChartZoom(scaleZoom(chartZoom, 0))} - visible={visible.zoomToolbar} + visible={displayZoomToolbar} />
  • @@ -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), }); diff --git a/src/components/minimap-toolbar/minimap-toolbar.test.js b/src/components/minimap-toolbar/minimap-toolbar.test.js index 5ed479b54e..4436edffa6 100644 --- a/src/components/minimap-toolbar/minimap-toolbar.test.js +++ b/src/components/minimap-toolbar/minimap-toolbar.test.js @@ -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), diff --git a/src/store/initial-state.js b/src/store/initial-state.js index 1e654d9f03..4e26f62aa8 100644 --- a/src/store/initial-state.js +++ b/src/store/initial-state.js @@ -45,13 +45,13 @@ export const createInitialState = () => ({ settingsModal: false, shareableUrlModal: false, sidebar: window.innerWidth > sidebarWidth.breakpoint, - zoomToolbar: true, }, display: { globalToolbar: true, sidebar: true, miniMap: true, expandAllPipelines: false, + zoomToolbar: true, }, zoom: {}, runsMetadata: {},