From 06eedbee997b853332d212fc2d3eb3413a8ee2dc Mon Sep 17 00:00:00 2001 From: maryia-deriv Date: Thu, 6 Jun 2024 17:45:46 +0300 Subject: [PATCH 1/3] fix: clean_all_active rudderstack event tracking for Clear all action in indicators --- src/components/StudyLegend.tsx | 11 ++++++++--- src/store/StudyLegendStore.ts | 5 ++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/StudyLegend.tsx b/src/components/StudyLegend.tsx index 73d5d6d7e..f835b7f70 100644 --- a/src/components/StudyLegend.tsx +++ b/src/components/StudyLegend.tsx @@ -169,7 +169,7 @@ const TabularDisplayActivePanel = ({ clearAll, isMobile, }: TabularDisplayActivePanelProps) => ( - + <>

{isMobile @@ -183,7 +183,7 @@ const TabularDisplayActivePanel = ({

- + ); const TabularDisplay = ({ @@ -307,6 +307,11 @@ const StudyLegend = ({ portalNodeId }: TStudyLegendProps) => { }); }; + const handleClearAll = () => { + deleteAll(); + state.stateChange(STATE.INDICATORS_CLEAR_ALL); + }; + return ( { handleStateChange(item.flutter_chart_id, STATE.INDICATOR_INFO_TOGGLE, { is_info_open: true }); }} activeItems={activeItems} - clearAll={deleteAll} + clearAll={handleClearAll} searchQuery={searchQuery} isMobile={isMobile} maxAllowedItem={maxAllowedItem} diff --git a/src/store/StudyLegendStore.ts b/src/store/StudyLegendStore.ts index 94a53ad72..f856e31a0 100644 --- a/src/store/StudyLegendStore.ts +++ b/src/store/StudyLegendStore.ts @@ -108,9 +108,9 @@ export default class StudyLegendStore { get searchedItems() { return [...getIndicatorsTree()] .map(category => { - category.foundItems = (category.items.filter( + category.foundItems = category.items.filter( item => item.name.toLowerCase().indexOf(this.filterText.toLowerCase().trim()) !== -1 - ) as unknown) as TActiveItem[]; + ) as unknown as TActiveItem[]; return category; }) .filter(category => category.foundItems?.length); @@ -359,7 +359,6 @@ export default class StudyLegendStore { this.activeItems = []; window.flutterChart?.indicators.clearIndicators(); this.mainStore.state.saveLayout(); - this.mainStore.state.stateChange(STATE.INDICATORS_CLEAR_ALL); } onSelectTab(tabIndex: number) { From 8d3509e9c21ead5e97fdf23c9921537cc4cd6015 Mon Sep 17 00:00:00 2001 From: maryia-deriv Date: Thu, 6 Jun 2024 18:18:12 +0300 Subject: [PATCH 2/3] refactor: remove logic for sending CHART_MODE_TOGGLE and MARKETS_LIST_TOGGLE state change events --- src/Constant.tsx | 2 -- src/store/MenuStore.ts | 17 +---------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/src/Constant.tsx b/src/Constant.tsx index 1015ae2b6..7543def65 100644 --- a/src/Constant.tsx +++ b/src/Constant.tsx @@ -2118,7 +2118,6 @@ export const Languages = [ export const STATE = { CHART_INTERVAL_CHANGE: 'CHART_INTERVAL_CHANGE', - CHART_MODE_TOGGLE: 'CHART_MODE_TOGGLE', CHART_TYPE_CHANGE: 'CHART_TYPE_CHANGE', FAVORITE_MARKETS_TOGGLE: 'FAVORITE_MARKETS_TOGGLE', INDICATOR_ADDED: 'INDICATOR_ADDED', @@ -2131,7 +2130,6 @@ export const STATE = { INITIAL: 'INITIAL', MARKET_SEARCH: 'MARKET_SEARCH', MARKET_STATE_CHANGE: 'MARKET_STATE_CHANGE', - MARKETS_LIST_TOGGLE: 'MARKETS_LIST_TOGGLE', READY: 'READY', SCROLL_TO_LEFT: 'SCROLL_TO_LEFT', SYMBOL_CHANGE: 'SYMBOL_CHANGE', diff --git a/src/store/MenuStore.ts b/src/store/MenuStore.ts index 4c6f781c7..1a05d78b5 100644 --- a/src/store/MenuStore.ts +++ b/src/store/MenuStore.ts @@ -57,22 +57,7 @@ export default class MenuStore { this.setOpen(!this.open); } handleDialogStatus() { - if (this.route === 'chart-mode') { - const chart_type_name = ChartTypes.find(type => type.id === this.mainStore.chartType.type.id)?.text ?? ''; - this.mainStore.state.stateChange(STATE.CHART_MODE_TOGGLE, { - is_open: this.open, - chart_type_name: - this.mainStore.chartType.type.id === 'colored_bar' - ? chart_type_name - : chart_type_name.toLowerCase(), - time_interval_name: getTimeIntervalName(this.mainStore.state.granularity, Intervals), - }); - } else if (this.route === 'chart-title') { - this.mainStore.state.stateChange(STATE.MARKETS_LIST_TOGGLE, { - is_open: this.open, - symbol: this.mainStore.chart.currentActiveSymbol?.symbol, - }); - } else if (this.route === 'indicators') { + if (this.route === 'indicators') { this.mainStore.state.stateChange(STATE.INDICATORS_MODAL_TOGGLE, { is_open: this.open, }); From 1c7ee3b5e56ba939000f1dade6b37a165c334d7e Mon Sep 17 00:00:00 2001 From: maryia-deriv Date: Thu, 6 Jun 2024 18:31:34 +0300 Subject: [PATCH 3/3] fix: remove unused vars --- src/store/MenuStore.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/store/MenuStore.ts b/src/store/MenuStore.ts index 1a05d78b5..b8d3aeb08 100644 --- a/src/store/MenuStore.ts +++ b/src/store/MenuStore.ts @@ -1,6 +1,5 @@ import { action, computed, observable, reaction, makeObservable } from 'mobx'; -import { ChartTypes, Intervals, STATE } from 'src/Constant'; -import { getTimeIntervalName } from 'src/utils'; +import { STATE } from 'src/Constant'; import MainStore from '.'; import Context from '../components/ui/Context'; import DialogStore from './DialogStore';