// @flow import * as icons from 'constants/icons'; import React from 'react'; import { FormField } from 'component/common/form'; import Button from 'component/button'; import FileExporter from 'component/common/file-exporter'; import { TRANSACTIONS, TX_LIST } from 'lbry-redux'; import * as PAGES from 'constants/pages'; import TransactionListTable from 'component/transactionListTable'; import RefreshTransactionButton from 'component/transactionRefreshButton'; import Paginate from 'component/common/paginate'; type Props = { emptyMessage: ?string, filterSetting: string, loading: boolean, myClaims: any, setTransactionFilter: string => void, slim?: boolean, title: string, allTransactions: Array, transactions: Array, transactionCount?: number, history: { replace: string => void }, }; function TransactionList(props: Props) { const { emptyMessage, slim, filterSetting, title, transactions, loading, history, transactionCount, allTransactions, } = props; // Flow offers little support for Object.values() typing. // https://github.com/facebook/flow/issues/2221 // $FlowFixMe const transactionTypes: Array = Object.values(TRANSACTIONS); function capitalize(string: string) { return string.charAt(0).toUpperCase() + string.slice(1); } function handleFilterChanged(event: SyntheticInputEvent<*>) { props.setTransactionFilter(event.target.value); history.replace(`/$/${PAGES.TRANSACTIONS}`); // } return (

{title}

{/* @if TARGET='app' */} {!slim && ( )} {/* @endif */} {!slim && ( } > {transactionTypes.map(tt => ( ))} )} {slim &&
{((loading && !transactions.length) || !transactions.length) && (

{loading ? __('Loading') : emptyMessage || __('No transactions.')}

)} {!!transactions && !!transactions.length && } {!slim && !!transactionCount && ( history.replace(`/$/${PAGES.TRANSACTIONS}?page=${Number(page)}`)} totalPages={Math.ceil(transactionCount / TX_LIST.PAGE_SIZE)} /> )}
); } export default TransactionList;