Skip to content

Commit

Permalink
fix(cashier): 🐛 Not displaying Recent Transactions table on clickin…
Browse files Browse the repository at this point in the history
…g `view all` button (#9760)

Co-authored-by: Farzin Mirzaie <farzin@deriv.com>
  • Loading branch information
farzin-deriv and Farzin Mirzaie committed Aug 21, 2023
1 parent 6ad6607 commit 09733d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 21 deletions.
11 changes: 2 additions & 9 deletions packages/cashier/src/pages/account-transfer/account-transfer.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import React from 'react';
import { Loading } from '@deriv/components';
import { routes, WS } from '@deriv/shared';
import { WS } from '@deriv/shared';
import { useStore, observer } from '@deriv/stores';
import Error from '../../components/error';
import NoBalance from '../../components/no-balance';
import { Virtual } from '../../components/cashier-container';
import CashierLocked from '../../components/cashier-locked';
import CryptoTransactionsHistory from '../../components/crypto-transactions-history';
import AccountTransferReceipt from './account-transfer-receipt';
import AccountTransferForm from './account-transfer-form';
import AccountTransferNoAccount from './account-transfer-no-account';
Expand All @@ -24,8 +23,7 @@ type TAccountTransferProps = {

const AccountTransfer = observer(({ onClickDeposit, onClickNotes, onClose, setSideNotes }: TAccountTransferProps) => {
const { client } = useStore();
const { account_transfer, general_store, transaction_history } = useCashierStore();

const { account_transfer, general_store } = useCashierStore();
const {
accounts_list,
error,
Expand All @@ -39,10 +37,8 @@ const AccountTransfer = observer(({ onClickDeposit, onClickNotes, onClose, setSi
} = account_transfer;
const { is_loading } = general_store;
const is_cashier_locked = useCashierLocked();
const { is_crypto_transactions_visible } = transaction_history;
const { is_switching, is_virtual } = client;
const [is_loading_status, setIsLoadingStatus] = React.useState(true);
const is_from_outside_cashier = !location.pathname.startsWith(routes.cashier);

React.useEffect(() => {
onMount();
Expand Down Expand Up @@ -91,9 +87,6 @@ const AccountTransfer = observer(({ onClickDeposit, onClickNotes, onClose, setSi
if (is_transfer_confirm) {
return <AccountTransferReceipt onClose={onClose} />;
}
if (!is_from_outside_cashier && is_crypto_transactions_visible) {
return <CryptoTransactionsHistory />;
}

return (
<AccountTransferForm
Expand Down
26 changes: 14 additions & 12 deletions packages/cashier/src/pages/withdrawal/withdrawal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,25 @@ const Withdrawal = observer(({ setSideNotes }: TWithdrawalProps) => {
...(/^(eUSDT)$/i.test(currency) ? [<USDTSideNote type='eusdt' key={1} />] : []),
];

setSideNotes?.([
...side_notes.map((side_note, index) => (
<SideNote has_title={false} key={index}>
{side_note}
</SideNote>
)),
]);
if (is_crypto_transactions_visible) {
setSideNotes?.([]);
} else {
setSideNotes?.([
...side_notes.map((side_note, index) => (
<SideNote has_title={false} key={index}>
{side_note}
</SideNote>
)),
]);
}
} else setSideNotes?.([]);
}

return () => {
setSideNotes?.([]);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currency, tab_index]);
}, [currency, tab_index, is_crypto_transactions_visible]);

// TODO: Fix if conditions, use else if and combine conditions when possible
if (is_system_maintenance) {
Expand All @@ -139,6 +143,8 @@ const Withdrawal = observer(({ setSideNotes }: TWithdrawalProps) => {
return <WithdrawalLocked />;
}

if (is_crypto_transactions_visible) return <CryptoTransactionsHistory />;

if (!Number(balance)) {
return (
<>
Expand Down Expand Up @@ -169,10 +175,6 @@ const Withdrawal = observer(({ setSideNotes }: TWithdrawalProps) => {
return <CryptoWithdrawReceipt />;
}

if (is_crypto_transactions_visible) {
return <CryptoTransactionsHistory />;
}

return (
<>
<WithdrawalVerificationEmail />
Expand Down

1 comment on commit 09733d0

@vercel
Copy link

@vercel vercel bot commented on 09733d0 Aug 21, 2023

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.binary.sx
deriv-app-git-master.binary.sx
binary.sx

Please sign in to comment.