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/DTRA-1263/revert: remove information (redirect) icon from market subcategories #1591

Merged
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
12 changes: 0 additions & 12 deletions sass/components/_categorical-display.scss
Original file line number Diff line number Diff line change
Expand Up @@ -255,24 +255,13 @@
font-size: 1.4em;
border-radius: $border-radius $border-radius 0 0;
display: flex;
justify-content: space-between;
height: 40px;
font-weight: bold;
align-items: center;
@include themify($themes) {
color: themed('CatDisplayCatTitleText');
background-color: themed('CatDisplayCatContentBg');
}

.ic-icon {
svg {
width: 16px;
height: 16px;
@include themify($themes) {
fill: themed('IndicatorListItemText');
}
}
}
}
}
}
Expand Down Expand Up @@ -472,7 +461,6 @@
}
.subcategory {
padding: 0 45px 0 48px;
justify-content: space-between;
}
}
.empty-category {
Expand Down
1 change: 0 additions & 1 deletion src/Constant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2124,7 +2124,6 @@ export const STATE = {
INDICATORS_CLEAR_ALL: 'INDICATORS_CLEAR_ALL',
INDICATORS_MODAL_TOGGLE: 'INDICATORS_MODAL_TOGGLE',
INITIAL: 'INITIAL',
MARKET_INFO_REDIRECT: 'MARKET_INFO_REDIRECT',
MARKET_SEARCH: 'MARKET_SEARCH',
MARKET_STATE_CHANGE: 'MARKET_STATE_CHANGE',
MARKETS_LIST_TOGGLE: 'MARKETS_LIST_TOGGLE',
Expand Down
7 changes: 0 additions & 7 deletions src/binaryapi/ActiveSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export type TProcessedSymbolItem = {
market_display_name: string;
subgroup: string;
subgroup_display_name: string;
submarket: string;
submarket_display_name: string;
exchange_is_open: boolean;
decimal_places: number;
Expand All @@ -43,7 +42,6 @@ export type TSubCategoryDataItem = {
export type TSubCategoryData = TSubCategoryDataItem[];

export type TSubCategory = {
subcategoryId: string;
subcategoryName: string;
data: TSubCategoryDataItem[];
};
Expand Down Expand Up @@ -175,12 +173,8 @@ export default class ActiveSymbols {
name: s.display_name,
market: s.market,
market_display_name: s.market_display_name,
// TODO: stop ignoring these types after BE api types are updated
// @ts-ignore
subgroup: s.subgroup,
// @ts-ignore
subgroup_display_name: s.subgroup_display_name,
submarket: s.submarket,
submarket_display_name: s.submarket_display_name,
exchange_is_open: !!s.exchange_is_open,
decimal_places: s.pip.toString().length - 2,
Expand All @@ -207,7 +201,6 @@ export default class ActiveSymbols {
const categorizedSymbols: TCategorizedSymbols = [];
const first = activeSymbols[0];
const getSubcategory = (d: TProcessedSymbolItem): TSubCategory => ({
subcategoryId: d.submarket,
subcategoryName: d.submarket_display_name,
data: [],
});
Expand Down
69 changes: 3 additions & 66 deletions src/components/categoricaldisplay/ResultsPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React from 'react';
import classNames from 'classnames';
import { STATE } from 'src/Constant';
import { useStores } from 'src/store';
import { ArrowIcon, CategoryIconMap, InfoCircleIcon } from '../Icons';
import { getSymbolMarketCategory, stringToSlug } from '../../utils';
import { ArrowIcon, CategoryIconMap } from '../Icons';
import { stringToSlug } from '../../utils';
import {
TCategorizedSymbolItem,
TCategorizedSymbols,
Expand Down Expand Up @@ -119,64 +117,6 @@ const CategoryTitle = ({ category, activeHeadKey, isNestedList, handleTitleClick
</div>
);

const row_subcategory_mapper: { [key: string]: string } = {
commodity_basket: 'basket-indices/?tab=options#commodities-basket',
forex_basket: 'basket-indices/?tab=options#forex-basket',
random_index: 'synthetic/?tab=options#continuous-indices',
crash_index: 'synthetic/?tab=multipliers#crash-boom',
random_daily: 'synthetic/?tab=options#daily-reset-indices',
jump_index: 'synthetic/?tab=options#jump-indices',
step_index: 'synthetic/?tab=multipliers#step-indices',
major_pairs: 'forex/?tab=options#major-pairs',
minor_pairs: 'forex/?tab=options#minor-pairs',
americas_OTC: 'stock/?tab=options#american-indices',
asia_oceania_OTC: 'stock/?tab=options#asian-indices',
europe_OTC: 'stock/?tab=options#european-indices',
non_stable_coin: 'cryptocurrencies/?tab=multipliers#crypto-pairs',
energy: 'commodities/?tab=options#energy',
metals: 'commodities/?tab=options#metals',
};

const eu_subcategory_mapper: { [key: string]: string } = {
random_index: 'synthetic/?tab=multipliers#continuous-indices',
crash_index: 'synthetic/?tab=multipliers#crash-boom',
major_pairs: 'forex/?tab=multipliers#major-pairs',
non_stable_coin: 'cryptocurrencies/?tab=multipliers#crypto-pairs',
};

const redirectLink = (subCategoryId: string, should_show_eu_content: boolean) => {
const DEFAULT_LANGUAGE = 'EN';
const lang_from_url =
new URLSearchParams(window.location.search).get('lang')?.toLowerCase() || DEFAULT_LANGUAGE.toLowerCase();
const link_mapper = should_show_eu_content
? eu_subcategory_mapper[subCategoryId]
: row_subcategory_mapper[subCategoryId];
let language = `${lang_from_url}/`;
const modified_lang_code = lang_from_url.replace('_', '-');
if (lang_from_url.includes('_')) language = `${modified_lang_code}/`;
let link = `https://deriv.com/${language}`;
if (link_mapper) link += `markets/${link_mapper}/`;
return link;
};

const RedirectIcon = ({ subcategory }: { subcategory: TSubCategory }) => {
const { state } = useStores();
const { should_show_eu_content } = state;
const derivComLink = redirectLink(subcategory.subcategoryId, !!should_show_eu_content);

const onInfoClick = () => {
state.stateChange(STATE.MARKET_INFO_REDIRECT, {
symbol_category: getSymbolMarketCategory(subcategory.data[0].dataObject),
});
};

return (
<a href={derivComLink} target='_blank' rel='noreferrer' onClick={onInfoClick}>
<InfoCircleIcon />
</a>
);
};

const Category = ({
category,
categoryItemCount,
Expand Down Expand Up @@ -224,10 +164,7 @@ const Category = ({
)}
key={subcategory.subcategoryName}
>
<div className='subcategory'>
{t.translate(subcategory.subcategoryName)}
<RedirectIcon subcategory={subcategory} />
</div>
<div className='subcategory'>{t.translate(subcategory.subcategoryName)}</div>
{subcategory.data.map(item => (
<ItemType
key={item.display}
Expand Down
4 changes: 0 additions & 4 deletions src/store/ChartState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class ChartState {
clearChart?: () => void;
isChartClosed = false;
shouldMinimiseLastDigits = false;
should_show_eu_content?: boolean;
allowTickChartTypeOnly?: boolean;
isStaticChart? = false;
shouldFetchTradingTimes = true;
Expand Down Expand Up @@ -112,7 +111,6 @@ class ChartState {
chartStatusListener: observable,
debouncedStateChange: action.bound,
stateChangeListener: observable,
should_show_eu_content: observable,
settings: observable,
showLastDigitStats: observable,
allowTickChartTypeOnly: observable,
Expand Down Expand Up @@ -180,7 +178,6 @@ class ChartState {
settings,
shouldFetchTradingTimes = true,
shouldFetchTickHistory = true,
should_show_eu_content,
should_zoom_out_on_yaxis,
allTicks = [],
contractInfo = {},
Expand Down Expand Up @@ -229,7 +226,6 @@ class ChartState {
this.margin = margin;
this.has_updated_settings = !isDeepEqual(this.settings?.whitespace, settings?.whitespace);
this.settings = settings;
this.should_show_eu_content = should_show_eu_content;
this.shouldFetchTradingTimes = shouldFetchTradingTimes;
this.shouldFetchTickHistory = shouldFetchTickHistory;
this.allowTickChartTypeOnly = allowTickChartTypeOnly;
Expand Down
1 change: 0 additions & 1 deletion src/types/props.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ export type TChartProps = {
showLastDigitStats?: boolean;
scrollToEpoch?: number | null;
clearChart?: () => void;
should_show_eu_content?: boolean;
shouldFetchTradingTimes?: boolean;
shouldFetchTickHistory?: boolean;
allowTickChartTypeOnly?: boolean;
Expand Down
Loading