lbry-desktop/ui/component/transactionListTable/view.jsx
jessopb 3034f4ce6c
bring in styles (#7542)
* bring in ody styles; modify; cleanup

* workflow

* workflow

* v0.52.6-alpha.teststyles.1

* fix hook

* v0.52.6-alpha.teststyles.2

* style fixes

* fix pagination styling

* v0.52.6-alpha.teststyles.3

* wallet icon was bad

* restore deploy script

* fixes

* fix player close button

* modal inputs

* cleanup

* cleanup

* fix staked indicator

* fix profile menu button skel delay

* fix view-all-playlists hover

* fix overlay buttons on collection page

* fix header buttons
2022-04-17 13:04:56 -04:00

64 lines
2.1 KiB
JavaScript

// @flow
import * as MODALS from 'constants/modal_types';
import React from 'react';
import TxoListItem from 'component/transactionListTableItem';
import Spinner from 'component/spinner';
import LbcSymbol from 'component/common/lbc-symbol';
type Props = {
emptyMessage: ?string,
loading: boolean,
openModal: (id: string, { tx: Txo, cb: (string) => void }) => void,
rewards: {},
txos: Array<Txo>,
};
function TransactionListTable(props: Props) {
const { emptyMessage, rewards, loading, txos } = props;
const REVOCABLE_TYPES = ['channel', 'stream', 'repost', 'support', 'claim', 'collection'];
function revokeClaim(tx: any, cb: (string) => void) {
props.openModal(MODALS.CONFIRM_CLAIM_REVOKE, { tx, cb });
}
return (
<React.Fragment>
{!loading && !txos.length && <h2 className="main--empty empty">{emptyMessage || __('No transactions.')}</h2>}
{loading && (
<h2 className="main--empty empty">
<Spinner delayed />
</h2>
)}
{!loading && !!txos.length && (
<div className="table__wrapper">
<table className="table table--transactions">
<thead>
<tr>
<th className="table-column-lbc-date">{__('Date')}</th>
<th className="table-column-lbc-type">{<>{__('Type')}</>}</th>
<th>{__('Details')} </th>
<th className="table-column-lbc-transaction">{__('Transaction')}</th>
<th className="table__item--align-right">
<LbcSymbol size={18} />
</th>
</tr>
</thead>
<tbody>
{txos &&
txos.map((t, i) => (
<TxoListItem
key={`${t.txid}:${t.nout}-${i}`}
txo={t}
reward={rewards && rewards[t.txid]}
isRevokeable={t.is_my_output && !t.is_spent && REVOCABLE_TYPES.includes(t.type)}
revokeClaim={revokeClaim}
/>
))}
</tbody>
</table>
</div>
)}
</React.Fragment>
);
}
export default TransactionListTable;