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

chore: migrate account statistics to ts #14

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
@@ -1,10 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import { MobileWrapper, Money, Text } from '@deriv/components';
import { localize } from '@deriv/translations';
import { connect } from 'Stores/connect';

const AccountStatistics = ({ account_statistics, currency }) => {
type TAccountStatistics = {
account_statistics: {
total_withdrawals: number;
total_deposits: number;
};
currency: string;
};

const AccountStatistics = ({ account_statistics, currency }: TAccountStatistics) => {
return (
<div className='statement__account-statistics'>
<div className='statement__account-statistics-item'>
Expand Down Expand Up @@ -59,12 +66,8 @@ const AccountStatistics = ({ account_statistics, currency }) => {
);
};

AccountStatistics.propTypes = {
account_statistics: PropTypes.object,
currency: PropTypes.string,
};

export default connect(({ modules, client }) => ({
// TODO: implement reports store TRootStore in types.ts
export default connect(({ modules, client }: any) => ({
account_statistics: modules.statement.account_statistics,
currency: client.currency,
}))(AccountStatistics);
2 changes: 1 addition & 1 deletion packages/reports/src/Containers/statement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getSupportedContracts } from '_common/contract';
import { connect } from 'Stores/connect';
import { getStatementTableColumnsTemplate } from '../Constants/data-table-constants';
import PlaceholderComponent from '../Components/placeholder-component.jsx';
import AccountStatistics from '../Components/account-statistics.jsx';
import AccountStatistics from '../Components/account-statistics';
import FilterComponent from '../Components/filter-component.jsx';
import { ReportsMeta } from '../Components/reports-meta.jsx';
import EmptyTradeHistoryMessage from '../Components/empty-trade-history-message.jsx';
Expand Down