Commit e83774dd authored by zeroleak's avatar zeroleak
Browse files

cleanup

parent 6a82a9cd
......@@ -83,6 +83,8 @@ export default function TableGeneric({ columns, data, size='sm', /*onFetchData,
d => d.original
) : undefined
const onSelectActions = selectedItems ? onSelect.actions(selectedItems) : []
// Render the UI for your table
return (
<div className='table-generic'>
......@@ -91,8 +93,10 @@ export default function TableGeneric({ columns, data, size='sm', /*onFetchData,
{rowsOriginal.length} {onSelect.label} {onSelect.labelDetails? onSelect.labelDetails(rowsOriginal):''}
</span>}
{selectedItems && <span>
{selectedItems.length} {onSelect.label} {onSelect.labelDetails? onSelect.labelDetails(selectedItems):''} selected <Icon.ArrowRight size={12}/>{' '}
{onSelect.actions(selectedItems).map((action,i) => <span key={i}>{action}</span>)}
{selectedItems.length} {onSelect.label} {onSelect.labelDetails? onSelect.labelDetails(selectedItems):''} selected{' '}
{onSelectActions.length>0 && <span>
<Icon.ArrowRight size={12}/> {onSelect.actions(selectedItems).map((action,i) => <span key={i}>{action}</span>)}
</span>}
</span>}
</div>}
<BTable hover size={size} {...getTableProps()} className={className}>
......
......@@ -26,6 +26,23 @@ const UtxoControls = React.memo(({ utxo }) => {
)
});
const computeUtxosActions = utxos => {
const actions = []
let tx0Possible = true;
for (const utxo of utxos) {
if (utxo.account !== WHIRLPOOL_ACCOUNTS.DEPOSIT) {
tx0Possible = false
}
}
if (tx0Possible) {
actions.push(<button className='btn btn-sm btn-primary' title='Send to Premix' onClick={() => modalService.openTx0(utxos)}>Premix</button>)
}
return actions
}
/* eslint-disable react/prefer-stateless-function */
const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => {
......@@ -154,6 +171,8 @@ const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => {
const amountUtxosReadOnly = utxosReadOnly.map(utxo => utxo.value).reduce((total,current) => total+current, 0)
const key = tableKey+utils.computeUtxoDataKey(visibleUtxos);
return (
<div>
<div>
......@@ -167,9 +186,7 @@ const UtxosTable = ({ controls, pool, mixs, account, utxos, tableKey }) => {
onSelect={{
label: 'utxos',
labelDetails: utxos => '('+utils.toBtc(utils.sumUtxos(utxos))+' btc)',
actions: utxos => [
<button className='btn btn-sm btn-primary' title='Send to Premix' onClick={() => modalService.openTx0(utxos)}>Premix</button>
]
actions: computeUtxosActions
}}
/>
{visibleUtxos.length == 0 && <div className='text-center text-muted'><small>No utxo yet</small></div>}
......
......@@ -147,7 +147,7 @@ class App extends React.Component<Props> {
</div>}
</div>
<div className='col-md-10'>
{cliService.isLoggedIn() && (mixService.isReady() && poolsService.isReady() ? <MixStatus mixState={this.props.mix} poolsState={this.props.pools} mixActions={this.props.mixActions}/> : utils.spinner())}
{cliService.isLoggedIn() && mixService.isReady() && poolsService.isReady() && <MixStatus mixState={this.props.mix} poolsState={this.props.pools} mixActions={this.props.mixActions}/>}
{cliService.isCliStatusReady() && !cliService.isLoggedIn() && <div className='text-center'>
<Link to={routes.HOME}>
<FontAwesomeIcon icon={Icons.faLock} size='3x' color='#CCC'/>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment