From d53372e55267b48d568426adcfdffdde948e694a Mon Sep 17 00:00:00 2001 From: Henry Hein Date: Wed, 26 Apr 2023 15:39:36 +0800 Subject: [PATCH 1/5] fix: unable to view chart for digit contracts in mobile for non tick streams --- .../trader/src/Modules/Trading/Containers/trade.jsx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/trader/src/Modules/Trading/Containers/trade.jsx b/packages/trader/src/Modules/Trading/Containers/trade.jsx index ee477cd765fe..06239db517b2 100644 --- a/packages/trader/src/Modules/Trading/Containers/trade.jsx +++ b/packages/trader/src/Modules/Trading/Containers/trade.jsx @@ -4,7 +4,6 @@ import classNames from 'classnames'; import { DesktopWrapper, Div100vhContainer, MobileWrapper, SwipeableWrapper } from '@deriv/components'; import { isDesktop, isMobile } from '@deriv/shared'; import ChartLoader from 'App/Components/Elements/chart-loader.jsx'; -import { isDigitTradeType } from 'Modules/Trading/Helpers/digits'; import { connect } from 'Stores/connect'; import PositionsDrawer from 'App/Components/Elements/PositionsDrawer'; import MarketIsClosedOverlay from 'App/Components/Elements/market-is-closed-overlay.jsx'; @@ -31,7 +30,6 @@ const BottomWidgetsMobile = ({ tick, digits, setTick, setDigits }) => { }; const Trade = ({ - contract_type, form_components, getFirstOpenMarket, should_show_active_symbols_loading, @@ -182,13 +180,7 @@ const Trade = ({ - + { id='trade' isMobile={isMobile()} maxTick={isMobile() ? max_ticks : undefined} - granularity={granularity} + granularity={!show_digits_stats ? granularity : 0} requestAPI={wsSendRequest} requestForget={wsForget} requestForgetStream={wsForgetStream} requestSubscribe={wsSubscribe} settings={settings} should_show_eu_content={should_show_eu_content} + showTicksOnly={show_digits_stats} stateChangeListener={chartStateChange} symbol={symbol} topWidgets={is_trade_enabled ? topWidgets : null} From 3d9d1e894b9869f293158335be20261581b3dad3 Mon Sep 17 00:00:00 2001 From: Henry Hein Date: Thu, 27 Apr 2023 09:26:17 +0800 Subject: [PATCH 2/5] fix: include accumualtors in the change --- .../SmartChart/Components/toolbar-widgets.jsx | 14 +++----------- .../src/Modules/Trading/Containers/trade.jsx | 5 +++-- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/trader/src/Modules/SmartChart/Components/toolbar-widgets.jsx b/packages/trader/src/Modules/SmartChart/Components/toolbar-widgets.jsx index db799d507ccb..f98fa5684f6d 100644 --- a/packages/trader/src/Modules/SmartChart/Components/toolbar-widgets.jsx +++ b/packages/trader/src/Modules/SmartChart/Components/toolbar-widgets.jsx @@ -2,13 +2,10 @@ import PropTypes from 'prop-types'; import React from 'react'; import { isDesktop, isMobile } from '@deriv/shared'; import { ChartMode, DrawTools, Share, StudyLegend, Views, ToolbarWidget } from 'Modules/SmartChart'; -import { connect } from 'Stores/connect'; -const ToolbarWidgets = ({ is_accumulator, position, updateChartType, updateGranularity }) => ( +const ToolbarWidgets = ({ position, updateChartType, updateGranularity }) => ( - {!is_accumulator && ( - - )} + {isDesktop() && } {isDesktop() && } {isDesktop() && } @@ -20,11 +17,6 @@ ToolbarWidgets.propTypes = { position: PropTypes.string, updateChartType: PropTypes.func, updateGranularity: PropTypes.func, - is_accumulator: PropTypes.func, }; -export default React.memo( - connect(({ modules }) => ({ - is_accumulator: modules.trade.is_accumulator, - }))(ToolbarWidgets) -); +export default React.memo(ToolbarWidgets); diff --git a/packages/trader/src/Modules/Trading/Containers/trade.jsx b/packages/trader/src/Modules/Trading/Containers/trade.jsx index 06239db517b2..2eddbd68658d 100644 --- a/packages/trader/src/Modules/Trading/Containers/trade.jsx +++ b/packages/trader/src/Modules/Trading/Containers/trade.jsx @@ -384,14 +384,14 @@ const Chart = props => { id='trade' isMobile={isMobile()} maxTick={isMobile() ? max_ticks : undefined} - granularity={!show_digits_stats ? granularity : 0} + granularity={!show_digits_stats || !is_accumulator ? granularity : 0} requestAPI={wsSendRequest} requestForget={wsForget} requestForgetStream={wsForgetStream} requestSubscribe={wsSubscribe} settings={settings} should_show_eu_content={should_show_eu_content} - showTicksOnly={show_digits_stats} + showTicksOnly={show_digits_stats || is_accumulator} stateChangeListener={chartStateChange} symbol={symbol} topWidgets={is_trade_enabled ? topWidgets : null} @@ -474,6 +474,7 @@ const ChartTrade = connect(({ client, modules, ui, common, contract_trade, portf is_digit_contract: contract_trade.last_contract.is_digit_contract, is_ended: contract_trade.last_contract.is_ended, }, + is_accumulator: modules.trade.is_accumulator, is_trade_enabled: modules.trade.is_trade_enabled, main_barrier: modules.trade.main_barrier_flattened, extra_barriers: modules.trade.barriers_flattened, From 1600ee82d896ef3ef230f39a5db45dd51194a2a2 Mon Sep 17 00:00:00 2001 From: Henry Hein Date: Thu, 27 Apr 2023 09:28:33 +0800 Subject: [PATCH 3/5] fix: add brackets for readability From 831c6f04c657f7bba00fc89f18d7a9a2b58a62f3 Mon Sep 17 00:00:00 2001 From: Henry Hein Date: Thu, 27 Apr 2023 10:33:09 +0800 Subject: [PATCH 4/5] fix: bug --- packages/trader/src/Modules/Trading/Containers/trade.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/trader/src/Modules/Trading/Containers/trade.jsx b/packages/trader/src/Modules/Trading/Containers/trade.jsx index 2eddbd68658d..6644e7c7287b 100644 --- a/packages/trader/src/Modules/Trading/Containers/trade.jsx +++ b/packages/trader/src/Modules/Trading/Containers/trade.jsx @@ -384,7 +384,7 @@ const Chart = props => { id='trade' isMobile={isMobile()} maxTick={isMobile() ? max_ticks : undefined} - granularity={!show_digits_stats || !is_accumulator ? granularity : 0} + granularity={show_digits_stats || is_accumulator ? 0 : granularity} requestAPI={wsSendRequest} requestForget={wsForget} requestForgetStream={wsForgetStream} From 502a969ba0380e92a527c08c999a44ed0ab73632 Mon Sep 17 00:00:00 2001 From: Henry Hein Date: Fri, 28 Apr 2023 16:06:23 +0800 Subject: [PATCH 5/5] refactor: naming --- packages/trader/src/Modules/Trading/Containers/trade.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/trader/src/Modules/Trading/Containers/trade.jsx b/packages/trader/src/Modules/Trading/Containers/trade.jsx index 6644e7c7287b..61950b4261a7 100644 --- a/packages/trader/src/Modules/Trading/Containers/trade.jsx +++ b/packages/trader/src/Modules/Trading/Containers/trade.jsx @@ -391,7 +391,7 @@ const Chart = props => { requestSubscribe={wsSubscribe} settings={settings} should_show_eu_content={should_show_eu_content} - showTicksOnly={show_digits_stats || is_accumulator} + allowTickChartTypeOnly={show_digits_stats || is_accumulator} stateChangeListener={chartStateChange} symbol={symbol} topWidgets={is_trade_enabled ? topWidgets : null}