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

Vinu/migrated recent-transaction component to typescript #5791

Merged
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
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
@@ -1,14 +1,33 @@
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';
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 '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 +132,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
4 changes: 2 additions & 2 deletions packages/cashier/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"Images/*": ["public/images/*"],
"Pages/*": ["pages/*"],
"Stores/*": ["stores/*"],
"Types/*": ["types/*"],
"Types": ["types"],
"Utils/*": ["utils/*"],
},
"outDir": "./dist",
"rootDir": "./src",
"baseUrl": "src"
"baseUrl": "src",
},
"include": ["./src", "./src/**/*.ts", "./src/**/*.tsx", "globals.d.ts"]
}