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

george / rm78412 / repalce connect in withdrawal page #6809

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
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ describe('<ErrorDialog />', () => {
const error = {
code: error_code,
message: 'Error is occured',
setErrorMessage(value) {
this.message = value;
setErrorMessage({ code, message }) {
this.message = message;
},
};
const { unmount } = render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ErrorDialog = ({ className, disableApp, enableApp, error = {} }: TErrorDia

const dismissError = React.useCallback(() => {
if (error.setErrorMessage) {
error.setErrorMessage('', null, false);
error.setErrorMessage({ code: '', message: '' }, null, false);
}
setErrorVisibility(false);
}, [error]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ describe('<Error />', () => {
const history = createBrowserHistory();
const error = {
code: error_code,
setErrorMessage(value) {
this.message = value;
setErrorMessage({ code, message }) {
this.message = message;
},
message: '',
};
Expand Down
17 changes: 4 additions & 13 deletions packages/cashier/src/components/error/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { Button, Icon, ButtonLink, StaticUrl, Text } from '@deriv/components';
import { isMobile } from '@deriv/shared';
import { localize, Localize } from '@deriv/translations';
import ErrorStore from 'Stores/error-store';
import './error.scss';

type TErrorComponentProps = {
Expand All @@ -17,16 +18,6 @@ type TErrorFields = {
[k: string]: string;
};

type TErrorProps = {
error: {
onClickButton?: () => void;
setErrorMessage?: (message: string) => void;
message?: JSX.Element | string;
code?: string;
fields?: string[];
};
};

const ErrorComponent = ({ header, message, button_link, onClickButton, button_text, footer }: TErrorComponentProps) => (
<div className='cashier__wrapper cashier__wrapper-error'>
<Icon icon='IcCashierError' className='error__icon' />
Expand Down Expand Up @@ -56,7 +47,7 @@ const ErrorComponent = ({ header, message, button_link, onClickButton, button_te
</div>
);

const Error = ({ error }: TErrorProps) => {
const Error = ({ error }: { error: ErrorStore }) => {
const error_fields: TErrorFields = {
address_city: localize('Town/City'),
address_line_1: localize('First line of home address'),
Expand All @@ -75,7 +66,7 @@ const Error = ({ error }: TErrorProps) => {
};

const clearErrorMessage = () => {
error.setErrorMessage?.('');
error.setErrorMessage?.({ code: '', message: '' });
};

let AccountError;
Expand Down Expand Up @@ -104,7 +95,7 @@ const Error = ({ error }: TErrorProps) => {
}
/>
&nbsp;
{error.fields ? (
{Array.isArray(error.fields) ? (
<Localize
i18n_default_text={'Please update your {{details}} to continue.'}
values={{
Expand Down
2 changes: 1 addition & 1 deletion packages/cashier/src/components/side-note/side-note.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type TSideNoteProps = {
has_bullets?: boolean;
has_title?: boolean;
is_mobile?: boolean;
side_notes?: TSideNotesProps[];
side_notes?: TSideNotesProps;
title?: string | JSX.Element;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,12 @@ import AccountTransferReceipt from './account-transfer-receipt';
import AccountTransferForm from './account-transfer-form';
import AccountTransferNoAccount from './account-transfer-no-account';
import AccountTransferLocked from './account-transfer-locked';
import ErrorStore from 'Stores/error-store';

type TAccountTransferProps = {
accounts_list: Array<TAccountsList>;
container: string;
error: {
is_show_full_page: boolean;
message: string;
};
error: ErrorStore;
has_no_account: boolean;
has_no_accounts_balance: boolean;
is_cashier_locked: boolean;
Expand Down
Loading