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

bahar/landing_on_dtrader_responsive_page_frequently_after_clicking_cashier #4917

Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
import PropTypes from 'prop-types';
import * as React from 'react';
import { StaticUrl } from '@deriv/components';
import { Localize, localize } from '@deriv/translations';
import AccountArticle from 'Components/article/article.jsx';

const AccountLimitsArticle = () => {
return (
<AccountArticle
title={localize('Account limits')}
descriptions={[
<Localize key={0} i18n_default_text='These are default limits that we apply to your accounts.' />,
const AccountLimitsArticle = ({ is_navigated_from_deriv_go }) => {
const getDescription = () => {
const description = [];
description.push(
<Localize key={0} i18n_default_text='These are default limits that we apply to your accounts.' />
);
yashim-deriv marked this conversation as resolved.
Show resolved Hide resolved
if (!is_navigated_from_deriv_go) {
description.push(
<Localize
key={1}
i18n_default_text='To learn more about trading limits and how they apply, please go to the <0>Help Centre.</0>'
components={[<StaticUrl key={0} className='link' href='/help-centre' />]}
/>,
]}
/>
);
/>
);
}
return description;
};

return <AccountArticle title={localize('Account limits')} descriptions={getDescription()} />;
};

AccountLimitsArticle.propTypes = {
is_navigated_from_deriv_go: PropTypes.bool,
};

export default AccountLimitsArticle;
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const AccountLimits = ({
is_switching,
is_virtual,
overlay_ref,
is_navigated_from_deriv_go,
setIsOverlayShown: setIsPopupOverlayShown,
should_bypass_scrollbars,
should_show_article,
Expand Down Expand Up @@ -116,7 +117,9 @@ const AccountLimits = ({
'da-account-limits--app-settings': is_app_settings,
})}
>
{should_show_article && isMobile() && <AccountLimitsArticle />}
{should_show_article && isMobile() && (
<AccountLimitsArticle is_navigated_from_deriv_go={is_navigated_from_deriv_go} />
)}
<div className='da-account-limits__table-wrapper'>
<ThemedScrollbars is_bypassed={should_bypass_scrollbars || isMobile()}>
<table className='da-account-limits__table'>
Expand Down Expand Up @@ -343,6 +346,7 @@ AccountLimits.propTypes = {
is_app_settings: PropTypes.bool,
getLimits: PropTypes.func.isRequired,
is_fully_authenticated: PropTypes.bool.isRequired,
is_navigated_from_deriv_go: PropTypes.bool,
is_switching: PropTypes.bool.isRequired,
is_virtual: PropTypes.bool.isRequired,
overlay_ref: PropTypes.shape({ current: PropTypes.any }),
Expand Down
23 changes: 6 additions & 17 deletions packages/account/src/Containers/account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import { withRouter } from 'react-router-dom';
import { VerticalTab, FadeWrapper, PageOverlay, Loading, Text } from '@deriv/components';
import {
routes as shared_routes,
isMobile,
matchRoute,
getSelectedRoute,
platforms,
PlatformContext,
} from '@deriv/shared';
import { routes as shared_routes, isMobile, matchRoute, getSelectedRoute, PlatformContext } from '@deriv/shared';
import { localize } from '@deriv/translations';
import { connect } from 'Stores/connect';
import { flatten } from '../Helpers/flatten';
Expand All @@ -36,10 +29,10 @@ const AccountLogout = ({ logout, history }) => {

const PageOverlayWrapper = ({
is_dashboard,
is_navigated_from_deriv_go,
list_groups,
logout,
onClickClose,
platform,
selected_route,
subroutes,
}) => {
Expand All @@ -48,7 +41,7 @@ const PageOverlayWrapper = ({
<PageOverlay
header={selected_route.getTitle()}
onClickClose={onClickClose}
is_close_disabled={!!platforms[platform]}
is_from_app={is_navigated_from_deriv_go}
>
<selected_route.component component_icon={selected_route.icon_component} />
</PageOverlay>
Expand All @@ -75,11 +68,7 @@ const PageOverlayWrapper = ({
}

return (
<PageOverlay
header={localize('Settings')}
onClickClose={onClickClose}
is_close_disabled={!!platforms[platform]}
>
<PageOverlay header={localize('Settings')} onClickClose={onClickClose} is_from_app={is_navigated_from_deriv_go}>
<VerticalTab
alignment='center'
is_floating
Expand Down Expand Up @@ -189,11 +178,11 @@ Account.propTypes = {
history: PropTypes.object,
is_logged_in: PropTypes.bool,
is_logging_in: PropTypes.bool,
is_navigated_from_deriv_go: PropTypes.bool,
is_virtual: PropTypes.bool,
is_visible: PropTypes.bool,
location: PropTypes.object,
logout: PropTypes.func,
platform: PropTypes.string,
routes: PropTypes.arrayOf(PropTypes.object),
should_allow_authentication: PropTypes.bool,
toggleAccount: PropTypes.func,
Expand All @@ -203,10 +192,10 @@ export default connect(({ client, common, ui }) => ({
currency: client.currency,
is_logged_in: client.is_logged_in,
is_logging_in: client.is_logging_in,
is_navigated_from_deriv_go: common.is_navigated_from_deriv_go,
is_virtual: client.is_virtual,
is_visible: ui.is_account_settings_visible,
logout: client.logout,
platform: common.platform,
routeBackInApp: common.routeBackInApp,
should_allow_authentication: client.should_allow_authentication,
toggleAccount: ui.toggleAccountSettings,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import AccountLimits from 'Components/account-limits/account-limits.jsx';
import { connect } from 'Stores/connect';

export default connect(({ client, ui }) => ({
export default connect(({ client, common, ui }) => ({
account_limits: client.account_limits,
currency: client.currency,
getLimits: client.getLimits,
is_fully_authenticated: client.is_fully_authenticated,
is_navigated_from_deriv_go: common.is_navigated_from_deriv_go,
is_virtual: client.is_virtual,
is_switching: client.is_switching,
should_show_article: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const CashierDefault = ({
is_dark_mode_on,
is_landing_company_loaded,
is_mobile,
is_navigated_from_deriv_go,
is_payment_agent_visible_in_onboarding,
is_switching,
onMountCashierDefault,
Expand Down Expand Up @@ -154,7 +155,7 @@ const CashierDefault = ({
<Localize i18n_default_text='Please note that some payment methods might not be available in your country.' />
</Text>
</div>
{is_mobile && (
{is_mobile && !is_navigated_from_deriv_go && (
<div
className='cashier-default-header-learn-more'
onClick={() => window.open(getStaticUrl('/payment-methods'))}
Expand Down Expand Up @@ -192,6 +193,7 @@ CashierDefault.propTypes = {
is_dark_mode_on: PropTypes.bool,
is_landing_company_loaded: PropTypes.bool,
is_mobile: PropTypes.bool,
is_navigated_from_deriv_go: PropTypes.bool,
is_payment_agent_visible_in_onboarding: PropTypes.bool,
is_switching: PropTypes.bool,
onMountCashierDefault: PropTypes.func,
Expand All @@ -208,14 +210,15 @@ CashierDefault.propTypes = {
toggleSetCurrencyModal: PropTypes.func,
};

export default connect(({ client, modules, ui }) => ({
export default connect(({ client, common, modules, ui }) => ({
accounts_list: modules.cashier.account_transfer.accounts_list,
available_crypto_currencies: client.available_crypto_currencies,
currency: client.currency,
has_set_currency: modules.cashier.general_store.has_set_currency,
is_dark_mode_on: ui.is_dark_mode_on,
is_landing_company_loaded: client.is_landing_company_loaded,
is_mobile: ui.is_mobile,
is_navigated_from_deriv_go: common.is_navigated_from_deriv_go,
is_payment_agent_visible_in_onboarding: modules.cashier.payment_agent.is_payment_agent_visible_in_onboarding,
is_switching: client.is_switching,
onMountCashierDefault: modules.cashier.general_store.onMountCashierDefault,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const AccountTransferReceipt = ({
disableApp,
enableApp,
history,
is_navigated_from_deriv_go,
loginid,
receipt,
resetAccountTransfer,
Expand Down Expand Up @@ -106,14 +107,16 @@ const AccountTransferReceipt = ({
</div>
</div>
<div className='account-transfer-receipt__crypto--form-submit'>
<Button
className='account-transfer-receipt__button'
has_effect
text={localize('View transaction details')}
onClick={checkAccount}
secondary
large
/>
{!is_navigated_from_deriv_go && (
<Button
className='account-transfer-receipt__button'
has_effect
text={localize('View transaction details')}
onClick={checkAccount}
secondary
large
/>
)}
<Button
className='account-transfer-receipt__button'
has_effect
Expand Down Expand Up @@ -157,6 +160,7 @@ const AccountTransferReceipt = ({
AccountTransferReceipt.propTypes = {
disableApp: PropTypes.func,
enableApp: PropTypes.func,
is_navigated_from_deriv_go: PropTypes.bool,
loginid: PropTypes.string,
receipt: PropTypes.object,
resetAccountTransfer: PropTypes.func,
Expand All @@ -166,14 +170,15 @@ AccountTransferReceipt.propTypes = {
};

export default withRouter(
connect(({ client, modules, ui }) => ({
connect(({ client, common, modules, ui }) => ({
disableApp: ui.disableApp,
enableApp: ui.enableApp,
is_navigated_from_deriv_go: common.is_navigated_from_deriv_go,
loginid: client.loginid,
switchAccount: client.switchAccount,
receipt: modules.cashier.account_transfer.receipt,
resetAccountTransfer: modules.cashier.account_transfer.resetAccountTransfer,
selected_from: modules.cashier.account_transfer.selected_from,
selected_to: modules.cashier.account_transfer.selected_to,
disableApp: ui.disableApp,
enableApp: ui.enableApp,
switchAccount: client.switchAccount,
}))(AccountTransferReceipt)
);
31 changes: 21 additions & 10 deletions packages/cashier/src/Components/Receipt/payment-agent-receipt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,14 @@ const openStatement = (history, resetPaymentAgent) => {
resetPaymentAgent();
};

const PaymentAgentReceipt = ({ currency, history, loginid, receipt, resetPaymentAgent }) => {
const PaymentAgentReceipt = ({
currency,
history,
is_navigated_from_deriv_go,
loginid,
receipt,
resetPaymentAgent,
}) => {
React.useEffect(() => {
return () => resetPaymentAgent();
}, [resetPaymentAgent]);
Expand Down Expand Up @@ -107,14 +114,16 @@ const PaymentAgentReceipt = ({ currency, history, loginid, receipt, resetPayment
</div>
)}
<div className='cashier__form-submit'>
<Button
className='cashier__form-submit-button'
has_effect
text={localize('View in statement')}
onClick={() => openStatement(history, resetPaymentAgent)}
secondary
large
/>
{!is_navigated_from_deriv_go && (
<Button
className='cashier__form-submit-button'
has_effect
text={localize('View in statement')}
onClick={() => openStatement(history, resetPaymentAgent)}
secondary
large
/>
)}
<Button
className='cashier__form-submit-button cashier__done-button'
has_effect
Expand All @@ -131,14 +140,16 @@ const PaymentAgentReceipt = ({ currency, history, loginid, receipt, resetPayment
PaymentAgentReceipt.propTypes = {
currency: PropTypes.string,
history: PropTypes.object,
is_navigated_from_deriv_go: PropTypes.bool,
loginid: PropTypes.string,
receipt: PropTypes.object,
resetPaymentAgent: PropTypes.func,
};

export default withRouter(
connect(({ client, modules }) => ({
connect(({ client, common, modules }) => ({
currency: client.currency,
is_navigated_from_deriv_go: common.is_navigated_from_deriv_go,
loginid: client.loginid,
receipt: modules.cashier.payment_agent.receipt,
resetPaymentAgent: modules.cashier.payment_agent.resetPaymentAgent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ const openStatement = (history, resetPaymentAgentTransfer) => {
resetPaymentAgentTransfer();
};

const PaymentAgentTransferReceipt = ({ currency, history, loginid, receipt, resetPaymentAgentTransfer }) => (
const PaymentAgentTransferReceipt = ({
currency,
history,
is_navigated_from_deriv_go,
loginid,
receipt,
resetPaymentAgentTransfer,
}) => (
<div className='cashier__wrapper payment-agent-transfer-receipt__wrapper'>
<div className='cashier__success'>
<Text as='h2' color='prominent' align='center' weight='bold' className='cashier__header'>
Expand Down Expand Up @@ -56,14 +63,16 @@ const PaymentAgentTransferReceipt = ({ currency, history, loginid, receipt, rese
</div>
</div>
<div className='cashier__form-submit'>
<Button
className='cashier__form-submit-button'
has_effect
text={localize('View in statement')}
onClick={() => openStatement(history, resetPaymentAgentTransfer)}
secondary
large
/>
{!is_navigated_from_deriv_go && (
<Button
className='cashier__form-submit-button'
has_effect
text={localize('View in statement')}
onClick={() => openStatement(history, resetPaymentAgentTransfer)}
secondary
large
/>
)}
<Button
className='cashier__form-submit-button cashier__done-button'
has_effect
Expand All @@ -79,14 +88,16 @@ const PaymentAgentTransferReceipt = ({ currency, history, loginid, receipt, rese
PaymentAgentTransferReceipt.propTypes = {
currency: PropTypes.string,
history: PropTypes.object,
is_navigated_from_deriv_go: PropTypes.bool,
loginid: PropTypes.string,
receipt: PropTypes.object,
resetPaymentAgentTransfer: PropTypes.func,
};

export default withRouter(
connect(({ client, modules }) => ({
connect(({ client, common, modules }) => ({
currency: client.currency,
is_navigated_from_deriv_go: common.is_navigated_from_deriv_go,
loginid: client.loginid,
receipt: modules.cashier.payment_agent_transfer.receipt,
resetPaymentAgentTransfer: modules.cashier.payment_agent_transfer.resetPaymentAgentTransfer,
Expand Down
Loading