Skip to content

Commit

Permalink
migrated recent-transaction component to typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
vinu-deriv committed Jun 22, 2022
1 parent 0fe46fd commit 95cc7a9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
3 changes: 0 additions & 3 deletions packages/cashier/src/components/recent-transaction/index.js

This file was deleted.

3 changes: 3 additions & 0 deletions packages/cashier/src/components/recent-transaction/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import RecentTransaction from './recent-transaction';

export default RecentTransaction;
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,30 @@ import { ButtonLink, Text, Icon } from '@deriv/components';
import { Localize } from '@deriv/translations';
import { epochToMoment } from '@deriv/shared';
import { connect } from 'Stores/connect';
import RootStore from 'Stores/types';
import { getStatus } from 'Constants/transaction-status';
import './recent-transaction.scss';

const RecentTransaction = ({ crypto_transactions, currency, onMount, setIsCryptoTransactionsVisible }) => {
type TRecentTransactionProps = {
crypto_transactions: {
address_hash: string;
status_code: string;
submit_date: Date;
transaction_hash: string;
transaction_type: string;
amount: number;
}[];
currency: string;
onMount: () => void;
setIsCryptoTransactionsVisible: (visible: boolean) => void;
};

const RecentTransaction = ({
crypto_transactions,
currency,
onMount,
setIsCryptoTransactionsVisible,
}: TRecentTransactionProps) => {
React.useEffect(() => {
onMount();
}, [onMount]);
Expand Down Expand Up @@ -113,14 +133,7 @@ const RecentTransaction = ({ crypto_transactions, currency, onMount, setIsCrypto
);
};

RecentTransaction.propTypes = {
crypto_transactions: PropTypes.array,
currency: PropTypes.string,
onMount: PropTypes.func,
setIsCryptoTransactionsVisible: PropTypes.func,
};

export default connect(({ modules, client }) => ({
export default connect(({ modules, client }: RootStore) => ({
crypto_transactions: modules.cashier.transaction_history.crypto_transactions,
currency: client.currency,
onMount: modules.cashier.transaction_history.onMount,
Expand Down

0 comments on commit 95cc7a9

Please sign in to comment.