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

henry/93321/fix: unable to view chart for digit contracts in mobile for non tick … #8356

Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => (
<ToolbarWidget position={position || isMobile() ? 'bottom' : null}>
{!is_accumulator && (
<ChartMode portalNodeId='modal_root' onChartType={updateChartType} onGranularity={updateGranularity} />
)}
<ChartMode portalNodeId='modal_root' onChartType={updateChartType} onGranularity={updateGranularity} />
{isDesktop() && <StudyLegend portalNodeId='modal_root' searchInputClassName='data-hj-whitelist' />}
{isDesktop() && <Views portalNodeId='modal_root' searchInputClassName='data-hj-whitelist' />}
{isDesktop() && <DrawTools portalNodeId='modal_root' />}
Expand All @@ -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);
14 changes: 4 additions & 10 deletions packages/trader/src/Modules/Trading/Containers/trade.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -31,7 +30,6 @@ const BottomWidgetsMobile = ({ tick, digits, setTick, setDigits }) => {
};

const Trade = ({
contract_type,
form_components,
getFirstOpenMarket,
should_show_active_symbols_loading,
Expand Down Expand Up @@ -182,13 +180,7 @@ const Trade = ({
</div>
</DesktopWrapper>
<MobileWrapper>
<ChartLoader
is_visible={
is_chart_loading ||
should_show_active_symbols_loading ||
(isDigitTradeType(contract_type) && !digits[0])
}
/>
<ChartLoader is_visible={is_chart_loading || should_show_active_symbols_loading} />
<SwipeableWrapper
onChange={onChangeSwipeableIndex}
is_disabled={
Expand Down Expand Up @@ -392,13 +384,14 @@ const Chart = props => {
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}
showTicksOnly={show_digits_stats || is_accumulator}
stateChangeListener={chartStateChange}
symbol={symbol}
topWidgets={is_trade_enabled ? topWidgets : null}
Expand Down Expand Up @@ -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,
Expand Down