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

thisyahlen/chore: make traders hub default ui #7836

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
f5a3f73
chore: remove classic ui from account switcher and header
thisyahlen-deriv Mar 8, 2023
5d3eda4
chore: redirect existing users to traders hub upon logging in
thisyahlen-deriv Mar 8, 2023
4b748c1
fix: comments
thisyahlen-deriv Mar 8, 2023
481a2a1
fix: notifications in traders hub
thisyahlen-deriv Mar 8, 2023
535a551
fix: redirect users to traders hub if they go to mt5 page
thisyahlen-deriv Mar 8, 2023
148a055
fix: refactor and remove mt5 and deriv x from platform switcher
thisyahlen-deriv Mar 8, 2023
0a5dcfd
fix: remove setisPreAppstore and exit traders hub modal
thisyahlen-deriv Mar 8, 2023
407d232
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 10, 2023
9961aef
fix: remove is_pre_appstore flag v1
thisyahlen-deriv Mar 10, 2023
9013cf6
fix: resolve conflicts
thisyahlen-deriv Mar 10, 2023
9f61dd1
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 10, 2023
2d1362c
fix: remove is_pre_appstore_flag from cashier
thisyahlen-deriv Mar 10, 2023
9ce4831
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 10, 2023
89bbbef
fix: remove is_pre_appstore from client
thisyahlen-deriv Mar 10, 2023
8a3da42
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 10, 2023
6436dd8
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 10, 2023
f0214e7
fix: conflicts
thisyahlen-deriv Mar 10, 2023
d80b6ee
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 10, 2023
e25a189
fix: refactor cashier
thisyahlen-deriv Mar 10, 2023
1593036
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 10, 2023
48db4bc
fix: comments
thisyahlen-deriv Mar 13, 2023
89d7665
fix: comments v2
thisyahlen-deriv Mar 13, 2023
557d331
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 13, 2023
8af8b61
chore: remove cfd-dashbord test
thisyahlen-deriv Mar 13, 2023
2d8f013
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 13, 2023
6b60294
fix: tests
thisyahlen-deriv Mar 13, 2023
52bb067
fix: toggle menu drawer remove exit traders hub
thisyahlen-deriv Mar 13, 2023
580aa3e
fix: clear tests
thisyahlen-deriv Mar 13, 2023
87bde47
fix: readd back deleted code
thisyahlen-deriv Mar 13, 2023
dd3f434
fix: comments v4
thisyahlen-deriv Mar 13, 2023
81048b3
fix: rename is_from_outside_cashier
thisyahlen-deriv Mar 13, 2023
0b002b7
fix: fix circleci
thisyahlen-deriv Mar 13, 2023
dbf1f43
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 14, 2023
2c5d43d
fix: remove mt5 and derivx from platform config
thisyahlen-deriv Mar 14, 2023
ef7d341
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 14, 2023
9a71e09
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 14, 2023
0ff688a
fix: readd back languages
thisyahlen-deriv Mar 14, 2023
ab4453f
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 14, 2023
986aa85
fix: redirect mt5 to deriv x to 404
thisyahlen-deriv Mar 15, 2023
a2b98cb
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 15, 2023
977b0dd
fix: conflicts
thisyahlen-deriv Mar 15, 2023
74b3ebf
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 15, 2023
5f26991
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 15, 2023
cdd9601
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 16, 2023
b877247
fix: remove exit traders hub modal from ui store
thisyahlen-deriv Mar 16, 2023
f2e2414
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 16, 2023
132e53d
fix: remove exit traders hub modal from ui store
thisyahlen-deriv Mar 16, 2023
26d62f7
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 17, 2023
3f0b8bf
fix: refactor account switcher and fix mf add button
thisyahlen-deriv Mar 17, 2023
6463001
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 17, 2023
619bc10
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 21, 2023
401e4bf
fix: removed unused
thisyahlen-deriv Mar 21, 2023
ac4945e
fix: notification
thisyahlen-deriv Mar 21, 2023
e370771
fix: conflicts and remove is_pre_appstore flag
thisyahlen-deriv Mar 21, 2023
717f70b
fix: tests
thisyahlen-deriv Mar 21, 2023
92bd910
fix: console error
thisyahlen-deriv Mar 21, 2023
29b9d83
fix: re-add back logged out status
thisyahlen-deriv Mar 21, 2023
6164389
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 21, 2023
1f1675f
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 21, 2023
478d3f7
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 21, 2023
6a2ee1f
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 21, 2023
0d96b82
fix: re-add back condition from vanuatu flow
thisyahlen-deriv Mar 21, 2023
cfe0822
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 21, 2023
cbcc618
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 21, 2023
7a31658
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 22, 2023
79a84e9
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 22, 2023
c2c9e14
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 23, 2023
e281dee
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 23, 2023
3619067
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 24, 2023
dc1fb08
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 24, 2023
2d999de
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 27, 2023
aa7408d
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 27, 2023
fde6531
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 30, 2023
edcd649
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 30, 2023
32b2ae4
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 30, 2023
122f49d
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 30, 2023
f104230
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 30, 2023
bc34117
Merge branch 'master' of github.com:binary-com/deriv-app into thisyah…
thisyahlen-deriv Mar 30, 2023
641974f
Merge branch 'master' into thisyahlen/88199/make_traders_hub_default_ui
thisyahlen-deriv Mar 30, 2023
9a0b005
fix: Trigger Build
thisyahlen-deriv Mar 30, 2023
344de5d
Merge branch 'thisyahlen/88199/make_traders_hub_default_ui' of github…
thisyahlen-deriv Mar 30, 2023
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
3 changes: 1 addition & 2 deletions packages/account/src/Components/Routes/binary-routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { TBinaryRoutes, TPlatformContext, TRoute } from 'Types';
import RouteWithSubRoutes from './route-with-sub-routes';

const BinaryRoutes = (props: TBinaryRoutes) => {
const { is_pre_appstore } = props;
const { is_appstore } = React.useContext<TPlatformContext>(PlatformContext);
thisyahlen-deriv marked this conversation as resolved.
Show resolved Hide resolved

return (
Expand All @@ -19,7 +18,7 @@ const BinaryRoutes = (props: TBinaryRoutes) => {
}
>
<Switch>
{getRoutesConfig({ is_appstore, is_pre_appstore }).map((route: TRoute, idx: number) => (
{getRoutesConfig({ is_appstore }).map((route: TRoute, idx: number) => (
<RouteWithSubRoutes key={idx} {...route} {...props} />
))}
</Switch>
Expand Down
14 changes: 2 additions & 12 deletions packages/account/src/Containers/account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'Styles/account.scss';

import { FadeWrapper, Icon, Loading, PageOverlay, Text, VerticalTab } from '@deriv/components';
import { PlatformContext, getSelectedRoute, isMobile, matchRoute, routes as shared_routes } from '@deriv/shared';

import AccountLimitInfo from '../Sections/Security/AccountLimits/account-limits-info.jsx';
import PropTypes from 'prop-types';
import React from 'react';
Expand Down Expand Up @@ -53,15 +52,14 @@ const TradingHubLogout = ({ logout }) => {
const PageOverlayWrapper = ({
is_from_derivgo,
is_appstore,
is_pre_appstore,
list_groups,
logout,
onClickClose,
selected_route,
subroutes,
history,
}) => {
const routeToPrevious = () => (is_pre_appstore ? history.push(shared_routes.traders_hub) : onClickClose());
const routeToPrevious = () => history.push(shared_routes.traders_hub);

if (isMobile() && selected_route) {
return (
Expand Down Expand Up @@ -105,7 +103,7 @@ const PageOverlayWrapper = ({
is_full_width
list={subroutes}
list_groups={list_groups}
extra_content={is_pre_appstore && <TradingHubLogout logout={logout} />}
extra_content={<TradingHubLogout logout={logout} />}
/>
</PageOverlay>
);
Expand All @@ -118,7 +116,6 @@ const Account = ({
is_from_derivgo,
is_logged_in,
is_logging_in,
is_pre_appstore,
is_virtual,
is_visible,
location,
Expand Down Expand Up @@ -146,10 +143,6 @@ const Account = ({

routes.forEach(menu_item => {
menu_item.subroutes.forEach(route => {
if (route.path === shared_routes.languages) {
route.is_hidden = !is_pre_appstore;
}

if (route.path === shared_routes.financial_assessment) {
route.is_disabled = is_virtual;
}
Expand Down Expand Up @@ -205,7 +198,6 @@ const Account = ({
<PageOverlayWrapper
is_from_derivgo={is_from_derivgo}
is_appstore={is_appstore}
is_pre_appstore={is_pre_appstore}
list_groups={list_groups}
logout={logout}
onClickClose={onClickClose}
Expand All @@ -226,7 +218,6 @@ Account.propTypes = {
is_from_derivgo: PropTypes.bool,
is_logged_in: PropTypes.bool,
is_logging_in: PropTypes.bool,
is_pre_appstore: PropTypes.bool,
is_virtual: PropTypes.bool,
is_visible: PropTypes.bool,
location: PropTypes.object,
Expand All @@ -244,7 +235,6 @@ export default connect(({ client, common, ui }) => ({
is_from_derivgo: common.is_from_derivgo,
is_logged_in: client.is_logged_in,
is_logging_in: client.is_logging_in,
is_pre_appstore: client.is_pre_appstore,
is_virtual: client.is_virtual,
is_visible: ui.is_account_settings_visible,
logout: client.logout,
Expand Down
1 change: 0 additions & 1 deletion packages/account/src/Types/common-prop.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export type TRouteConfig = TRoute & {
};

export type TBinaryRoutes = {
is_pre_appstore: boolean;
is_logged_in: boolean;
is_logging_in: boolean;
};
11 changes: 1 addition & 10 deletions packages/appstore/src/modules/onboarding/onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,7 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) =>
const number_of_steps = Object.keys(contents);
const { traders_hub, client } = useStores();
const { toggleIsTourOpen, selectAccountType, is_demo_low_risk, content_flag } = traders_hub;
const {
is_eu_country,
is_logged_in,
setIsPreAppStore,
is_landing_company_loaded,
prev_account_type,
setPrevAccountType,
} = client;
const { is_eu_country, is_logged_in, is_landing_company_loaded, prev_account_type, setPrevAccountType } = client;
const [step, setStep] = React.useState<number>(1);

const prevStep = () => {
Expand All @@ -46,7 +39,6 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) =>
const nextStep = () => {
if (step < number_of_steps.length) setStep(step + 1);
if (step === number_of_steps.length) {
setIsPreAppStore(true);
toggleIsTourOpen(true);
history.push(routes.traders_hub);
if (is_demo_low_risk) {
Expand All @@ -60,7 +52,6 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) =>
toggleIsTourOpen(false);
history.push(routes.traders_hub);
await selectAccountType(prev_account_type);
setIsPreAppStore(true);
};

const eu_user =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@ import { TAccountsList } from 'Types';
type TAccountPlatformIcon = {
size: number;
account: TAccountsList['account'];
is_pre_appstore: boolean;
icon_class_name?: string;
appstore_icon_class_name?: string;
appstoreIconOnClickHandler?: () => void;
};

const AccountPlatformIcon = ({
account,
is_pre_appstore,
size,
icon_class_name,
appstore_icon_class_name,
appstoreIconOnClickHandler,
}: TAccountPlatformIcon) => {
return is_pre_appstore && account.is_mt && account.platform_icon ? (
return account.is_mt && account.platform_icon ? (
<TradingPlatformIcon
icon={account.platform_icon}
size={size}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ describe('<Virtual />', () => {
beforeEach(() => {
mockRootStore = {
ui: { is_dark_mode_on: true, toggleAccountsDialog: jest.fn() },
client: { is_pre_appstore: true },
};
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import classNames from 'classnames';
import React from 'react';
import { withRouter, useHistory } from 'react-router-dom';
import { withRouter } from 'react-router-dom';
import { Text } from '@deriv/components';
import { isMobile, routes } from '@deriv/shared';
import { isMobile } from '@deriv/shared';
import { Localize } from '@deriv/translations';
import { useStore, observer } from '@deriv/stores';
import './virtual.scss';

const Virtual = observer(() => {
const {
ui: { is_dark_mode_on, toggleAccountsDialog },
client: { is_pre_appstore },
} = useStore();
const history = useHistory();

return (
<div className='cashier__wrapper' data-testid='dt_cashier_wrapper_id'>
Expand Down Expand Up @@ -46,12 +44,7 @@ const Virtual = observer(() => {
key={1}
className='virtual__account-switch-text'
onClick={() => {
if (is_pre_appstore) {
history.push(routes.trade);
thisyahlen-deriv marked this conversation as resolved.
Show resolved Hide resolved
toggleAccountsDialog();
} else {
toggleAccountsDialog();
}
toggleAccountsDialog();
}}
/>,
]}
Expand Down
7 changes: 3 additions & 4 deletions packages/cashier/src/containers/cashier/cashier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type TCashierProps = RouteComponentProps & {
routeBackInApp: TRootStore['common']['routeBackInApp'];
toggleCashier: TRootStore['ui']['toggleCashier'];
resetLastLocation: () => void;
is_pre_appstore: boolean;
};

type TCashierOptions = {
Expand Down Expand Up @@ -68,9 +67,9 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier
const { is_payment_agent_transfer_visible } = payment_agent_transfer;
const { is_payment_agent_visible } = payment_agent;
const { resetLastLocation } = account_prompt_dialog;
const { routeBackInApp, is_from_derivgo } = common;
const { is_from_derivgo } = common;
const { is_cashier_visible: is_visible, toggleCashier } = ui;
const { is_account_setting_loaded, is_logged_in, is_logging_in, is_pre_appstore } = client;
const { is_account_setting_loaded, is_logged_in, is_logging_in } = client;
const is_account_transfer_visible = useAccountTransferVisible();
const is_onramp_visible = useOnrampVisible();
const switchToReal = useSwitchToRealAccount();
Expand Down Expand Up @@ -99,7 +98,7 @@ const Cashier = observer(({ history, location, routes: routes_config }: TCashier
})();
}, [is_logged_in, onMount, setAccountSwitchListener]);

const onClickClose = () => (is_pre_appstore ? history.push(routes.traders_hub) : routeBackInApp(history));
const onClickClose = () => history.push(routes.traders_hub);
const getMenuOptions = () => {
const options: TCashierOptions[] = [];
routes_config.forEach(route => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,4 @@ describe('<AccountTransfer />', () => {

expect(await screen.findByText('mockedAccountTransferReceipt')).toBeInTheDocument();
});

it('should show the crypto transactions if triggered from recent transactions', async () => {
mockRootStore.modules.cashier.transaction_history.is_crypto_transactions_visible = true;

renderAccountTransfer();

expect(await screen.findByText('mockedCryptoTransactionsHistory')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('<AccountTransferForm />', () => {
renderAccountTransferForm();

expect(screen.getByTestId('dt_account_transfer_form_wrapper')).toBeInTheDocument();
expect(screen.getByText('Transfer between your accounts in Deriv')).toBeInTheDocument();
expect(screen.getByText('Cashier Error')).toBeInTheDocument();
});

it('should show loader if account_list.length === 0', () => {
Expand Down Expand Up @@ -218,19 +218,6 @@ describe('<AccountTransferForm />', () => {
expect(screen.getByText('Cashier Error')).toBeInTheDocument();
});

it('should show <AccountTransferNote /> component', () => {
(isMobile as jest.Mock).mockReturnValue(true);

renderAccountTransferForm();

expect(screen.getByText('Transfer limits may vary depending on the exchange rates.')).toBeInTheDocument();
expect(
screen.getByText(
'Transfers may be unavailable due to high volatility or technical issues and when the exchange markets are closed.'
)
).toBeInTheDocument();
});

it('should show proper hint about mt5 remained transfers', () => {
(isMobile as jest.Mock).mockReturnValue(true);
mockRootStore.client.account_limits = {
Expand Down Expand Up @@ -288,58 +275,4 @@ describe('<AccountTransferForm />', () => {

expect(screen.getByText('You have 1 transfer remaining for today.')).toBeInTheDocument();
});

it('should show proper note if transfer fee is 2% and is_crypto_to_crypto_transfer', () => {
(isMobile as jest.Mock).mockReturnValue(true);
mockRootStore.modules.cashier.account_transfer.selected_from.is_crypto = true;
mockRootStore.modules.cashier.account_transfer.selected_from.currency = 'BTC';
mockRootStore.modules.cashier.account_transfer.selected_to.is_crypto = true;
mockRootStore.modules.cashier.account_transfer.selected_to.currency = 'BTC';
mockRootStore.modules.cashier.account_transfer.transfer_fee = 2;

renderAccountTransferForm();

expect(
screen.getByText(
'We’ll charge a 2% transfer fee or 0 BTC, whichever is higher, for transfers between your Deriv cryptocurrency accounts. Please bear in mind that some transfers may not be possible.'
)
).toBeInTheDocument();
});

it('should show proper note if transfer fee is 2%, is_mt_transfer, and is_dxtrade_allowed is false', () => {
(isMobile as jest.Mock).mockReturnValue(true);
mockRootStore.modules.cashier.account_transfer.selected_from.is_mt = true;
mockRootStore.modules.cashier.account_transfer.selected_to.is_mt = true;
mockRootStore.modules.cashier.account_transfer.transfer_fee = 2;

renderAccountTransferForm();

expect(
screen.getByText(
'We’ll charge a 2% transfer fee or 0 USD, whichever is higher, for transfers between your Deriv cryptocurrency and Deriv MT5 accounts. Please bear in mind that some transfers may not be possible.'
)
).toBeInTheDocument();
});

it('should show proper note if transfer fee is 2% and is_mt_transfer is false', () => {
(isMobile as jest.Mock).mockReturnValue(true);
mockRootStore.modules.cashier.account_transfer.transfer_fee = 2;

renderAccountTransferForm();

expect(
screen.getByText(
'We’ll charge a 2% transfer fee or 0 USD, whichever is higher, for transfers between your Deriv fiat and Deriv cryptocurrency accounts. Please bear in mind that some transfers may not be possible.'
)
).toBeInTheDocument();
});

it('should show proper note if transfer fee is null', () => {
(isMobile as jest.Mock).mockReturnValue(true);
mockRootStore.modules.cashier.account_transfer.transfer_fee = null;

renderAccountTransferForm();

expect(screen.getByText('Please bear in mind that some transfers may not be possible.')).toBeInTheDocument();
});
});
Loading