From 027569872ca8ac9f934deb8ccb88d82138a0e18a Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:12:22 +0300 Subject: [PATCH 01/10] Improve props-linting --- src/ui/TimeRangePreservePref/TimeRangePreservePref.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js index bffb0e87a..092763fc4 100644 --- a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js +++ b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js @@ -1,10 +1,9 @@ import React from 'react' +import PropTypes from 'prop-types' import { Checkbox } from '@blueprintjs/core' import { tracker } from 'utils/trackers' -import { propTypes, defaultProps } from './TimeRangePreservePref.props' - const TimeRangePreservePref = (props) => { const { isTimeRangePreserved, toggleTimeRangePreserve } = props @@ -22,7 +21,9 @@ const TimeRangePreservePref = (props) => { ) } -TimeRangePreservePref.propTypes = propTypes -TimeRangePreservePref.defaultProps = defaultProps +TimeRangePreservePref.propTypes = { + isTimeRangePreserved: PropTypes.bool.isRequired, + toggleTimeRangePreserve: PropTypes.func.isRequired, +} export default TimeRangePreservePref From b33fb239830ba0bd0fc8d3dede81ae22f634c8be Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:14:55 +0300 Subject: [PATCH 02/10] Lint fixes --- .../TimeRangePreservePref/TimeRangePreservePref.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js index 092763fc4..58f53ff84 100644 --- a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js +++ b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js @@ -4,19 +4,20 @@ import { Checkbox } from '@blueprintjs/core' import { tracker } from 'utils/trackers' -const TimeRangePreservePref = (props) => { - const { isTimeRangePreserved, toggleTimeRangePreserve } = props - +const TimeRangePreservePref = ({ + isTimeRangePreserved, + toggleTimeRangePreserve, +}) => { const onChange = () => { - tracker.trackEvent('Preserve Timeframe') toggleTimeRangePreserve() + tracker.trackEvent('Preserve Timeframe') } return ( onChange()} large + onChange={() => onChange()} + checked={isTimeRangePreserved} /> ) } From 0daaaeef6e2d0889df69bea4fad25e68e64d86c6 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:15:27 +0300 Subject: [PATCH 03/10] Cleanup --- .../TimeRangePreservePref/TimeRangePreservePref.props.js | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 src/ui/TimeRangePreservePref/TimeRangePreservePref.props.js diff --git a/src/ui/TimeRangePreservePref/TimeRangePreservePref.props.js b/src/ui/TimeRangePreservePref/TimeRangePreservePref.props.js deleted file mode 100644 index 801265e89..000000000 --- a/src/ui/TimeRangePreservePref/TimeRangePreservePref.props.js +++ /dev/null @@ -1,8 +0,0 @@ -import PropTypes from 'prop-types' - -export const propTypes = { - isTimeRangePreserved: PropTypes.bool.isRequired, - toggleTimeRangePreserve: PropTypes.func.isRequired, -} - -export const defaultProps = {} From 59c67876bb43e8393fd583baa702a301b552f74a Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:19:31 +0300 Subject: [PATCH 04/10] Rework and improve time range preserving flow --- .../TimeRangePreservePref.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js index 58f53ff84..930b21c02 100644 --- a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js +++ b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js @@ -1,15 +1,20 @@ import React from 'react' import PropTypes from 'prop-types' import { Checkbox } from '@blueprintjs/core' +import { useDispatch, useSelector } from 'react-redux' + +import { toggleTimeRangePreserve } from 'state/timeRange/actions' +import { getIsTimeRangePreserved } from 'state/timeRange/selectors' import { tracker } from 'utils/trackers' -const TimeRangePreservePref = ({ - isTimeRangePreserved, - toggleTimeRangePreserve, -}) => { +const TimeRangePreservePref = () => { + const dispatch = useDispatch() + const isTimeRangePreserved = useSelector(getIsTimeRangePreserved) + + const onChange = () => { - toggleTimeRangePreserve() + dispatch(toggleTimeRangePreserve()) tracker.trackEvent('Preserve Timeframe') } From 173bf4ee7dd7d2cfca0fe686103aacb5b3749025 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:20:50 +0300 Subject: [PATCH 05/10] Actualize export --- src/ui/TimeRangePreservePref/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ui/TimeRangePreservePref/index.js b/src/ui/TimeRangePreservePref/index.js index d55a02343..eaf0938e5 100644 --- a/src/ui/TimeRangePreservePref/index.js +++ b/src/ui/TimeRangePreservePref/index.js @@ -1,3 +1 @@ -import TimeFramePreservePref from './TimeRangePreservePref.container' - -export default TimeFramePreservePref +export { default } from './TimeRangePreservePref.container' From 00e5b0b8984509caecfadcf85ec5b63cece916ea Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:21:20 +0300 Subject: [PATCH 06/10] Lint fix and cleanup --- src/ui/TimeRangePreservePref/TimeRangePreservePref.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js index 930b21c02..38d5da3fe 100644 --- a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js +++ b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js @@ -1,7 +1,6 @@ import React from 'react' -import PropTypes from 'prop-types' -import { Checkbox } from '@blueprintjs/core' import { useDispatch, useSelector } from 'react-redux' +import { Checkbox } from '@blueprintjs/core' import { toggleTimeRangePreserve } from 'state/timeRange/actions' import { getIsTimeRangePreserved } from 'state/timeRange/selectors' @@ -12,7 +11,6 @@ const TimeRangePreservePref = () => { const dispatch = useDispatch() const isTimeRangePreserved = useSelector(getIsTimeRangePreserved) - const onChange = () => { dispatch(toggleTimeRangePreserve()) tracker.trackEvent('Preserve Timeframe') @@ -27,9 +25,4 @@ const TimeRangePreservePref = () => { ) } -TimeRangePreservePref.propTypes = { - isTimeRangePreserved: PropTypes.bool.isRequired, - toggleTimeRangePreserve: PropTypes.func.isRequired, -} - export default TimeRangePreservePref From 9af73ac99c67ec26d39a17b80726377078e9d11b Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:24:42 +0300 Subject: [PATCH 07/10] Optimize onChange handler --- src/ui/TimeRangePreservePref/TimeRangePreservePref.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js index 38d5da3fe..81f68ee25 100644 --- a/src/ui/TimeRangePreservePref/TimeRangePreservePref.js +++ b/src/ui/TimeRangePreservePref/TimeRangePreservePref.js @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useCallback } from 'react' import { useDispatch, useSelector } from 'react-redux' import { Checkbox } from '@blueprintjs/core' @@ -11,15 +11,15 @@ const TimeRangePreservePref = () => { const dispatch = useDispatch() const isTimeRangePreserved = useSelector(getIsTimeRangePreserved) - const onChange = () => { + const onChange = useCallback(() => { dispatch(toggleTimeRangePreserve()) tracker.trackEvent('Preserve Timeframe') - } + }, [dispatch, tracker]) return ( onChange()} + onChange={onChange} checked={isTimeRangePreserved} /> ) From 3dc58039a7cb2cde0d3758d3029784f97d8618f0 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:25:30 +0300 Subject: [PATCH 08/10] Redundant container cleanup --- .../TimeRangePreservePref.container.js | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 src/ui/TimeRangePreservePref/TimeRangePreservePref.container.js diff --git a/src/ui/TimeRangePreservePref/TimeRangePreservePref.container.js b/src/ui/TimeRangePreservePref/TimeRangePreservePref.container.js deleted file mode 100644 index 573b7ba9a..000000000 --- a/src/ui/TimeRangePreservePref/TimeRangePreservePref.container.js +++ /dev/null @@ -1,18 +0,0 @@ -import { connect } from 'react-redux' - -import { toggleTimeRangePreserve } from 'state/timeRange/actions' -import { getIsTimeRangePreserved } from 'state/timeRange/selectors' - -import TimeRangePreservePref from './TimeRangePreservePref' - -const mapStateToProps = state => ({ - isTimeRangePreserved: getIsTimeRangePreserved(state), -}) - -const mapDispatchToProps = { - toggleTimeRangePreserve, -} - -const TimeFramePreservePrefContainer = connect(mapStateToProps, mapDispatchToProps)(TimeRangePreservePref) - -export default TimeFramePreservePrefContainer From 6843015121ff71d86edc4b95e8e3dbfc961fa8d9 Mon Sep 17 00:00:00 2001 From: alexstotsky Date: Mon, 30 Sep 2024 12:25:44 +0300 Subject: [PATCH 09/10] Update export --- src/ui/TimeRangePreservePref/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/TimeRangePreservePref/index.js b/src/ui/TimeRangePreservePref/index.js index eaf0938e5..85140465c 100644 --- a/src/ui/TimeRangePreservePref/index.js +++ b/src/ui/TimeRangePreservePref/index.js @@ -1 +1 @@ -export { default } from './TimeRangePreservePref.container' +export { default } from './TimeRangePreservePref' From 01394179f8dcf531341ef2bd78cfba4e97780a0f Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 2 Dec 2024 08:44:32 +0200 Subject: [PATCH 10/10] Bump version up to 2.47.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 72af41171..cc19c6186 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report-ui", - "version": "2.47.0", + "version": "2.47.1", "description": "Report page to overview the user actions in Bitfinex and download related csv files", "repository": { "type": "git",