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

maryia/79969/feat: disable all chart modes besides 'Area' and '1 tick' interval #31

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import React from 'react';
import { isDesktop, isMobile } from '@deriv/shared';
import { ChartMode, DrawTools, Share, StudyLegend, Views, ToolbarWidget } from 'Modules/SmartChart';

const ToolbarWidgets = ({ position, updateChartType, updateGranularity }) => (
const ToolbarWidgets = ({ position, updateChartType, updateGranularity, settings }) => (
<ToolbarWidget position={position || isMobile() ? 'bottom' : null}>
<ChartMode portalNodeId='modal_root' onChartType={updateChartType} onGranularity={updateGranularity} />
<ChartMode
portalNodeId='modal_root'
onChartType={updateChartType}
onGranularity={updateGranularity}
settings={settings}
/>
{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 @@ -17,6 +22,7 @@ ToolbarWidgets.propTypes = {
position: PropTypes.string,
updateChartType: PropTypes.func,
updateGranularity: PropTypes.func,
settings: PropTypes.object,
};

export default React.memo(ToolbarWidgets);
13 changes: 12 additions & 1 deletion packages/trader/src/Modules/Trading/Containers/trade.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,13 @@ const Chart = props => {
filterByContractType(p.contract_info, 'accumulator')
);

const toolbar_settings = show_accumulators_stats
? {
enabled_chart_types: ['mountain'], // 'Area' chart type
enabled_intervals_in_seconds: [0], // 0 seconds means 1 tick time inteval (0 granularity)
}
: undefined;

return (
<SmartChartWithRef
ref={charts_ref}
Expand Down Expand Up @@ -400,7 +407,11 @@ const Chart = props => {
isConnectionOpened={is_socket_opened}
clearChart={false}
toolbarWidget={() => (
<ToolbarWidgets updateChartType={updateChartType} updateGranularity={updateGranularity} />
<ToolbarWidgets
updateChartType={updateChartType}
updateGranularity={updateGranularity}
settings={toolbar_settings}
/>
)}
importedLayout={chart_layout}
onExportLayout={exportLayout}
Expand Down