Skip to content

Commit

Permalink
Merge branch 'binary-com:master' into shayan/80609/components-shared-…
Browse files Browse the repository at this point in the history
…ts-migration-parent
  • Loading branch information
shayan-deriv committed Nov 29, 2022
2 parents 537cca5 + 79a3e0a commit 730b58c
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ const FinancialAssessment = ({
const getScrollOffset = () => {
if (is_mf) {
if (isMobile() && is_financial_information_incomplete) return '220px';
return is_financial_information_incomplete && !is_submit_success ? '165px' : '80px';
return is_financial_information_incomplete && !is_submit_success ? '165px' : '160px';
} else if (isMobile()) return is_appstore ? '160px' : '200px';
return '80px';
};
Expand Down
14 changes: 13 additions & 1 deletion packages/cfd/src/Components/cfd-account-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ const CFDAccountCardAction = ({
type,
platform,
title,
real_account_creation_unlock_date,
setShouldShowCooldownModal,
}: TCFDAccountCardActionProps) => {
if (
is_virtual &&
Expand Down Expand Up @@ -146,7 +148,13 @@ const CFDAccountCardAction = ({
return (
<Button
className='cfd-account-card__account-selection'
onClick={onSelectAccount}
onClick={() => {
if (real_account_creation_unlock_date) {
setShouldShowCooldownModal(true);
} else {
onSelectAccount();
}
}}
type='button'
is_disabled={is_disabled}
primary={is_button_primary}
Expand Down Expand Up @@ -187,6 +195,8 @@ const CFDAccountCardComponent = ({
toggleMT5TradeModal,
toggleShouldShowRealAccountsList,
type,
real_account_creation_unlock_date,
setShouldShowCooldownModal,
}: TCFDAccountCard) => {
const existing_data = existing_accounts_data?.length ? existing_accounts_data?.[0] : existing_accounts_data;
const all_svg_acc: DetailsOfEachMT5Loginid[] = [];
Expand Down Expand Up @@ -663,6 +673,8 @@ const CFDAccountCardComponent = ({
type={type}
platform={platform}
title={title}
real_account_creation_unlock_date={real_account_creation_unlock_date}
setShouldShowCooldownModal={setShouldShowCooldownModal}
/>
)}
</div>
Expand Down
6 changes: 6 additions & 0 deletions packages/cfd/src/Components/cfd-real-account-display.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type TCFDRealAccountDisplayProps = {
openDerivRealAccountNeededModal: () => void;
should_enable_add_button?: boolean;
setIsAcuityModalOpen: (value: boolean) => void;
real_account_creation_unlock_date: string;
setShouldShowCooldownModal: (value: boolean) => void;
};

const CFDRealAccountDisplay = ({
Expand Down Expand Up @@ -90,6 +92,8 @@ const CFDRealAccountDisplay = ({
openDerivRealAccountNeededModal,
should_enable_add_button,
setIsAcuityModalOpen,
real_account_creation_unlock_date,
setShouldShowCooldownModal,
}: TCFDRealAccountDisplayProps) => {
const is_eu_user = (is_logged_in && is_eu) || (!is_logged_in && is_eu_country);

Expand Down Expand Up @@ -234,6 +238,8 @@ const CFDRealAccountDisplay = ({
toggleAccountsDialog={toggleAccountsDialog}
toggleMT5TradeModal={toggleMT5TradeModal}
setIsAcuityModalOpen={setIsAcuityModalOpen}
real_account_creation_unlock_date={real_account_creation_unlock_date}
setShouldShowCooldownModal={setShouldShowCooldownModal}
/>
);

Expand Down
4 changes: 4 additions & 0 deletions packages/cfd/src/Components/props.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export type TCFDAccountCardActionProps = {
type: TType;
platform: string;
title: string;
real_account_creation_unlock_date: string;
setShouldShowCooldownModal: (value: boolean) => void;
};

export type TTradingPlatformAvailableAccount = {
Expand Down Expand Up @@ -109,6 +111,8 @@ export type TCFDAccountCard = {
toggleShouldShowRealAccountsList?: (arg?: boolean) => void;
setMT5TradeAccount: (arg: any) => void;
setIsAcuityModalOpen: (value: boolean) => void;
real_account_creation_unlock_date: string;
setShouldShowCooldownModal: (value: boolean) => void;
};

export type TTradingPlatformAccounts = {
Expand Down
18 changes: 17 additions & 1 deletion packages/cfd/src/Containers/cfd-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ export type TCFDDashboardProps = RouteComponentProps & {
openDerivRealAccountNeededModal: () => void;
setIsAcuityModalOpen: (value: boolean) => void;
refreshNotifications: () => void;
real_account_creation_unlock_date: string;
setShouldShowCooldownModal: (value: boolean) => void;
};

const CFDDashboard = (props: TCFDDashboardProps) => {
Expand Down Expand Up @@ -397,6 +399,8 @@ const CFDDashboard = (props: TCFDDashboardProps) => {
getRealFinancialAccountsExistingData,
openDerivRealAccountNeededModal,
setIsAcuityModalOpen,
real_account_creation_unlock_date,
setShouldShowCooldownModal,
} = props;

const should_show_missing_real_account =
Expand Down Expand Up @@ -492,7 +496,13 @@ const CFDDashboard = (props: TCFDDashboardProps) => {
<React.Fragment>
{should_show_missing_real_account && (
<MissingRealAccount
onClickSignup={beginRealSignupForMt5}
onClickSignup={() => {
if (real_account_creation_unlock_date) {
setShouldShowCooldownModal(true);
} else {
beginRealSignupForMt5();
}
}}
platform={platform}
/>
)}
Expand Down Expand Up @@ -529,6 +539,8 @@ const CFDDashboard = (props: TCFDDashboardProps) => {
openDerivRealAccountNeededModal={openDerivRealAccountNeededModal}
should_enable_add_button={should_enable_add_button}
setIsAcuityModalOpen={setIsAcuityModalOpen}
real_account_creation_unlock_date={real_account_creation_unlock_date}
setShouldShowCooldownModal={setShouldShowCooldownModal}
/>
</React.Fragment>
</div>
Expand Down Expand Up @@ -586,6 +598,8 @@ const CFDDashboard = (props: TCFDDashboardProps) => {
is_demo_tab={is_demo_tab}
openPasswordModal={openRealPasswordModal}
is_real_enabled={is_real_enabled}
real_account_creation_unlock_date={real_account_creation_unlock_date}
setShouldShowCooldownModal={setShouldShowCooldownModal}
/>
<SwitchToRealAccountModal />
<JurisdictionModal openPasswordModal={openRealPasswordModal} />
Expand Down Expand Up @@ -735,5 +749,7 @@ export default withRouter(
mt5_status_server: client.website_status.mt5_status,
openDerivRealAccountNeededModal: ui.openDerivRealAccountNeededModal,
setIsAcuityModalOpen: ui.setIsAcuityModalOpen,
setShouldShowCooldownModal: ui.setShouldShowCooldownModal,
real_account_creation_unlock_date: client.real_account_creation_unlock_date,
}))(CFDDashboard)
);
8 changes: 8 additions & 0 deletions packages/cfd/src/Containers/compare-accounts-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type TCompareAccountsModalProps = TCompareAccountsReusedProps & {
toggleCompareAccounts: () => void;
openPasswordModal: (account_type: TOpenAccountTransferMeta) => void;
openDerivRealAccountNeededModal: () => void;
real_account_creation_unlock_date: string;
setShouldShowCooldownModal: (value: boolean) => void;
};

type TDxtradeCompareAccountContent = TCompareAccountsReusedProps & {
Expand Down Expand Up @@ -98,6 +100,8 @@ const CompareAccountsModal = ({
toggleCompareAccounts,
openPasswordModal,
openDerivRealAccountNeededModal,
real_account_creation_unlock_date,
setShouldShowCooldownModal,
}: TCompareAccountsModalProps) => {
const show_eu_related = (is_logged_in && is_eu) || (!is_logged_in && is_eu_country);
const is_dxtrade = platform && platform === CFD_PLATFORMS.DXTRADE;
Expand Down Expand Up @@ -179,6 +183,8 @@ const CompareAccountsModal = ({
show_eu_related={show_eu_related}
is_real_enabled={is_real_enabled}
toggleCompareAccounts={toggleCompareAccounts}
real_account_creation_unlock_date={real_account_creation_unlock_date}
setShouldShowCooldownModal={setShouldShowCooldownModal}
/>
)}
</Modal>
Expand Down Expand Up @@ -212,6 +218,8 @@ const CompareAccountsModal = ({
show_eu_related={show_eu_related}
is_real_enabled={is_real_enabled}
toggleCompareAccounts={toggleCompareAccounts}
real_account_creation_unlock_date={real_account_creation_unlock_date}
setShouldShowCooldownModal={setShouldShowCooldownModal}
/>
)}
</MobileDialog>
Expand Down
10 changes: 9 additions & 1 deletion packages/cfd/src/Containers/mt5-compare-table-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ type TDMT5CompareModalContentProps = {
account_status: GetAccountStatus;
upgradeable_landing_companies: unknown[];
should_restrict_bvi_account_creation: boolean;
real_account_creation_unlock_date: string;
setShouldShowCooldownModal: (value: boolean) => void;
};

const eucontent: TModalContentProps[] = [
Expand Down Expand Up @@ -229,6 +231,8 @@ const DMT5CompareModalContent = ({
account_status,
upgradeable_landing_companies,
should_restrict_bvi_account_creation,
real_account_creation_unlock_date,
setShouldShowCooldownModal,
}: TDMT5CompareModalContentProps) => {
const [has_submitted_personal_details, setHasSubmittedPersonalDetails] = React.useState(false);

Expand Down Expand Up @@ -385,7 +389,11 @@ const DMT5CompareModalContent = ({
is_logged_in && !has_real_account && upgradeable_landing_companies?.length > 0 && is_real_enabled;
toggleCompareAccounts();
if (should_show_missing_real_account) {
openDerivRealAccountNeededModal();
if (real_account_creation_unlock_date) {
setShouldShowCooldownModal(true);
} else {
openDerivRealAccountNeededModal();
}
} else if (is_virtual && !['synthetic_svg', 'financial_svg'].includes(item.action)) {
openSwitchToRealAccountModal();
} else onSelectRealAccount(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,14 @@ const AccountSwitcher = props => {
{account.title}
</Text>
<Button
onClick={() => openMt5RealAccount(account.type)}
onClick={() => {
if (props.real_account_creation_unlock_date) {
closeAccountsDialog();
props.setShouldShowCooldownModal(true);
} else {
openMt5RealAccount(account.type);
}
}}
className='acc-switcher__new-account-btn'
secondary
small
Expand Down

0 comments on commit 730b58c

Please sign in to comment.