Skip to content

Commit

Permalink
chore: only show malta jurisdiction in the modal for eu and filter ou…
Browse files Browse the repository at this point in the history
…t malta jurisdiction for non-eu (#13048)
  • Loading branch information
thisyahlen-deriv authored Jan 19, 2024
1 parent 23f2562 commit a5b67a6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { MouseEvent, useMemo, useState } from 'react';
import { Provider } from '@deriv/library';
import { Link, qtMerge, Text } from '@deriv/quill-design';
import { useUIContext } from '../../../../../components';
import useRegulationFlags from '../../../../../hooks/useRegulationFlags';
import DocumentsIcon from '../../../../../public/images/ic-documents.svg';
import IdCardIcon from '../../../../../public/images/ic-id-card.svg';
import SelfieIcon from '../../../../../public/images/ic-selfie.svg';
Expand Down Expand Up @@ -59,6 +61,9 @@ const JurisdictionCard = ({ isAdded = false, isSelected = false, jurisdiction, o
const [isFlipped, setIsFlipped] = useState(false);
const { toggleDynamicLeverage } = useDynamicLeverageModalState();
const { getCFDState } = Provider.useCFDContext();
const { getUIState } = useUIContext();
const regulation = getUIState('regulation');
const { isEU } = useRegulationFlags(regulation);

const descriptionClickHandler = (tag?: TClickableDescription['tag']) => (event: MouseEvent) => {
event.stopPropagation();
Expand All @@ -69,12 +74,19 @@ const JurisdictionCard = ({ isAdded = false, isSelected = false, jurisdiction, o
}
};

const { contents, header, isOverHeaderAvailable, overHeader, verificationDocs } = useMemo<TJurisdictionCardItems>(
() => getJurisdictionContents()[jurisdiction],
[jurisdiction]
const jurisdictionContents = useMemo<TJurisdictionCardItems | undefined>(
() => getJurisdictionContents(isEU)[jurisdiction],
[isEU, jurisdiction]
);
const marketType = getCFDState('marketType') || MarketType.ALL;
const rows = contents[marketType] || [];

if (!jurisdictionContents) {
return null;
}

const { contents, header, isOverHeaderAvailable, overHeader, verificationDocs } = jurisdictionContents;

const marketType = getCFDState('marketType') ?? MarketType.ALL;
const rows = contents[marketType] ?? [];

const parseDescription = (row: TJurisdictionCardSection) => {
if (row.clickableDescription)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,22 @@ import { TJurisdictionCardItems } from './props.types';
export type TJurisdictionContent = {
bvi: TJurisdictionCardItems;
labuan: TJurisdictionCardItems;
maltainvest: TJurisdictionCardItems;
maltainvest?: TJurisdictionCardItems;
svg: TJurisdictionCardItems;
vanuatu: TJurisdictionCardItems;
};

export const getJurisdictionContents = (): Record<string, TJurisdictionCardItems> => ({
bvi: getJurisdictionBviContents(),
labuan: getJurisdictionLabuanContents(),
maltainvest: getJurisdictionMaltainvestContents(),
svg: getJurisdictionSvgContents(),
vanuatu: getJurisdictionVanuatuContents(),
});
export const getJurisdictionContents = (isEU?: boolean): Record<string, TJurisdictionCardItems> => {
if (isEU) {
return {
maltainvest: getJurisdictionMaltainvestContents(),
};
}

return {
bvi: getJurisdictionBviContents(),
labuan: getJurisdictionLabuanContents(),
svg: getJurisdictionSvgContents(),
vanuatu: getJurisdictionVanuatuContents(),
};
};

1 comment on commit a5b67a6

@vercel
Copy link

@vercel vercel bot commented on a5b67a6 Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

deriv-app – ./

deriv-app.vercel.app
deriv-app-git-master.binary.sx
binary.sx
deriv-app.binary.sx

Please sign in to comment.