cleanup, pagesize change

This commit is contained in:
jessop 2019-09-25 14:12:02 -04:00 committed by Sean Yesmunt
parent 5078bd6699
commit ca0476c6bb
2 changed files with 11 additions and 7 deletions

View file

@ -4,7 +4,8 @@ import React from 'react';
import { FormField } from 'component/common/form'; import { FormField } from 'component/common/form';
import Button from 'component/button'; import Button from 'component/button';
import FileExporter from 'component/common/file-exporter'; import FileExporter from 'component/common/file-exporter';
import { TRANSACTIONS } from 'lbry-redux'; import { TRANSACTIONS, TX_LIST } from 'lbry-redux';
import * as PAGES from 'constants/pages';
import TransactionListTable from 'component/transactionListTable'; import TransactionListTable from 'component/transactionListTable';
import RefreshTransactionButton from 'component/transactionRefreshButton'; import RefreshTransactionButton from 'component/transactionRefreshButton';
import Spinner from 'component/spinner'; import Spinner from 'component/spinner';
@ -25,7 +26,6 @@ type Props = {
function TransactionList(props: Props) { function TransactionList(props: Props) {
const { emptyMessage, slim, filterSetting, title, transactions, loading, history, transactionCount } = props; const { emptyMessage, slim, filterSetting, title, transactions, loading, history, transactionCount } = props;
const PAGE_SIZE = 20;
// Flow offers little support for Object.values() typing. // Flow offers little support for Object.values() typing.
// https://github.com/facebook/flow/issues/2221 // https://github.com/facebook/flow/issues/2221
// $FlowFixMe // $FlowFixMe
@ -37,7 +37,7 @@ function TransactionList(props: Props) {
function handleFilterChanged(event: SyntheticInputEvent<*>) { function handleFilterChanged(event: SyntheticInputEvent<*>) {
props.setTransactionFilter(event.target.value); props.setTransactionFilter(event.target.value);
history.replace(`#/$/transactions`); // history.replace(`/$/${PAGES.TRANSACTIONS}`); //
} }
return ( return (
@ -50,7 +50,12 @@ function TransactionList(props: Props) {
</span> </span>
<div className="card__actions--inline"> <div className="card__actions--inline">
{slim && ( {slim && (
<Button button="link" className="button--alt" navigate="/$/transactions" label={__('Full History')} /> <Button
button="link"
className="button--alt"
navigate={`/$/${PAGES.TRANSACTIONS}`}
label={__('Full History')}
/>
)} )}
<RefreshTransactionButton /> <RefreshTransactionButton />
</div> </div>
@ -99,8 +104,8 @@ function TransactionList(props: Props) {
{!!transactions && !!transactions.length && <TransactionListTable transactionList={transactions} />} {!!transactions && !!transactions.length && <TransactionListTable transactionList={transactions} />}
{!slim && !!transactionCount && ( {!slim && !!transactionCount && (
<Paginate <Paginate
onPageChange={page => history.replace(`#/$/transactions?page=${Number(page)}`)} onPageChange={page => history.replace(`/$/${PAGES.TRANSACTIONS}?page=${Number(page)}`)}
totalPages={Math.ceil(transactionCount / PAGE_SIZE)} totalPages={Math.ceil(transactionCount / TX_LIST.PAGE_SIZE)}
/> />
)} )}
</React.Fragment> </React.Fragment>

View file

@ -13,7 +13,6 @@ type Props = {
transactionList: Array<any>, transactionList: Array<any>,
}; };
// class TransactionList extends React.PureComponent<Props> {
function TransactionListTable(props: Props) { function TransactionListTable(props: Props) {
const { emptyMessage, rewards, loading, transactionList } = props; const { emptyMessage, rewards, loading, transactionList } = props;