From de1fffd55db4982c690d45cd384a2a8f1b4b2eee Mon Sep 17 00:00:00 2001 From: henry-deriv <118344354+henry-deriv@users.noreply.github.com> Date: Wed, 10 May 2023 13:43:45 +0800 Subject: [PATCH] =?UTF-8?q?henry/93321/fix:=20unable=20to=20view=20chart?= =?UTF-8?q?=20for=20digit=20contracts=20in=20mobile=20for=20non=20tick=20?= =?UTF-8?q?=E2=80=A6=20(#8356)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: unable to view chart for digit contracts in mobile for non tick streams * fix: include accumualtors in the change * fix: add brackets for readability * fix: bug * refactor: naming --------- Co-authored-by: Sandeep Rajput <90243468+sandeep-deriv@users.noreply.github.com> --- .../SmartChart/Components/toolbar-widgets.jsx | 14 +++----------- .../src/Modules/Trading/Containers/trade.jsx | 14 ++++---------- 2 files changed, 7 insertions(+), 21 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 ee477cd765fe..61950b4261a7 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 || is_accumulator ? 0 : granularity} requestAPI={wsSendRequest} requestForget={wsForget} requestForgetStream={wsForgetStream} requestSubscribe={wsSubscribe} settings={settings} should_show_eu_content={should_show_eu_content} + allowTickChartTypeOnly={show_digits_stats || is_accumulator} stateChangeListener={chartStateChange} symbol={symbol} topWidgets={is_trade_enabled ? topWidgets : null} @@ -481,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,