refactoring the wallet iteration

This commit is contained in:
Anthony 2021-08-18 20:06:12 +02:00
parent b3d3a1a454
commit f1715660f8
No known key found for this signature in database
GPG key ID: C386D3C93D50E356
2 changed files with 65 additions and 17 deletions

View file

@ -49,6 +49,11 @@ class CreditAmount extends React.PureComponent<Props> {
isFiat, isFiat,
} = this.props; } = this.props;
const minimumRenderableAmount = 10 ** (-1 * precision); const minimumRenderableAmount = 10 ** (-1 * precision);
// return null, otherwise it will try and convert undefined to a string
if (amount === undefined) {
return null;
}
const fullPrice = formatFullPrice(amount, 2); const fullPrice = formatFullPrice(amount, 2);
const isFree = parseFloat(amount) === 0; const isFree = parseFloat(amount) === 0;

View file

@ -188,24 +188,50 @@ function TxoList(props: Props) {
return ( return (
<Card <Card
title={<div className="table__header-text">{__(`Transactions`)}</div>} title={
titleActions={ <><div className="table__header-text" style={{width: '124px', display: 'inline-block'}}>{__(`Transactions`)}</div>
<div className="card__actions--inline"> <div style={{display: 'inline-block'}}>
{!isFetchingTransactions && transactionsFile === null && ( <fieldset-section>
<label>{<span className="error__text">{__('Failed to process fetched data.')}</span>}</label> <div className={'txo__radios'}>
)} <Button
<div className="txo__export"> button="alt"
<FileExporter onClick={(e) => handleChange({ dkey: TXO.ACTIVE, value: 'active' })}
data={transactionsFile} className={classnames(`button-toggle`, {
label={__('Export')} 'button-toggle--active': TXO.ACTIVE === TXO.ACTIVE,
tooltip={__('Fetch transaction data for export')} })}
defaultFileName={'transactions-history.csv'} label={__('LBRY Credits')}
onFetch={() => fetchTransactions()} />
progressMsg={isFetchingTransactions ? __('Fetching data') : ''} <Button
button="alt"
onClick={(e) => handleChange({ dkey: TXO.ACTIVE, value: 'spent' })}
className={classnames(`button-toggle`, {
'button-toggle--active': active === 'spent',
})}
label={__('USD')}
/> />
</div> </div>
<Button button="alt" icon={ICONS.REFRESH} label={__('Refresh')} onClick={() => fetchTxoPage()} /> </fieldset-section>
</div> </div>
</>
}
titleActions={ <></>
// <div className="card__actions--inline">
// {!isFetchingTransactions && transactionsFile === null && (
// <label>{<span className="error__text">{__('Failed to process fetched data.')}</span>}</label>
// )}
// <div className="txo__export">
// <FileExporter
// data={transactionsFile}
// label={__('Export')}
// tooltip={__('Fetch transaction data for export')}
// defaultFileName={'transactions-history.csv'}
// onFetch={() => fetchTransactions()}
// progressMsg={isFetchingTransactions ? __('Fetching data') : ''}
// />
// </div>
// <Button button="alt" icon={ICONS.REFRESH} label={__('Refresh')} onClick={() => fetchTxoPage()} />
// </div>
} }
isBodyList isBodyList
body={ body={
@ -288,8 +314,25 @@ function TxoList(props: Props) {
</fieldset-section> </fieldset-section>
</div> </div>
)} )}
<div className="card__actions--inline" style={{marginLeft: '200px'}}>
{!isFetchingTransactions && transactionsFile === null && (
<label>{<span className="error__text">{__('Failed to process fetched data.')}</span>}</label>
)}
<div className="txo__export">
<FileExporter
data={transactionsFile}
label={__('Export')}
tooltip={__('Fetch transaction data for export')}
defaultFileName={'transactions-history.csv'}
onFetch={() => fetchTransactions()}
progressMsg={isFetchingTransactions ? __('Fetching data') : ''}
/>
</div>
<Button button="alt" icon={ICONS.REFRESH} label={__('Refresh')} onClick={() => fetchTxoPage()} />
</div> </div>
</div> </div>
</div>
{/* listing of the transactions */}
<TransactionListTable txos={txoPage} /> <TransactionListTable txos={txoPage} />
<Paginate totalPages={Math.ceil(txoItemCount / Number(pageSize))} /> <Paginate totalPages={Math.ceil(txoItemCount / Number(pageSize))} />
</div> </div>