import React, {useMemo } from 'react';
import { useTable, useSortBy } from 'react-table';
import Spinner from './spinner';
import { PromiseArea } from '../util/enum';
import { convertQaToCommaStr } from '../util/utils';
import IconQuestionCircle from './icons/question-circle';
import ReactTooltip from 'react-tooltip';
function Table({ columns, data, tableId }: any) {
const {
getTableProps,
getTableBodyProps,
headerGroups,
rows,
prepareRow,
} = useTable(
{
columns,
data,
initialState : {
sortBy: [
{
id: "blkNumCountdown",
desc: false
}
]
}
}, useSortBy);
return (
{headerGroups.map(headerGroup => (
{headerGroup.headers.map(column => (
| {column.render('Header')} |
))}
))}
{rows.map((row, i) => {
prepareRow(row)
return (
{row.cells.map(cell => {
return | {cell.render('Cell')} |
})}
)
})}
);
}
function ExplorerPendingWithdrawalTable(props: any) {
const data = props.data;
const totalWithdrawAmt = props.totalWithdrawAmt;
const columns = useMemo(
() => [
{
Header: 'pending blocks till claim',
accessor: 'blkNumCountdown'
},
{
Header: 'progress',
accessor: 'progress',
Cell: ({ row }: any) => {row.original.progress}%
},
{
Header: 'amount (ZIL)',
accessor: 'amount',
Cell: ({ row }: any) => {convertQaToCommaStr(row.original.amount)}
}
], []
);
return (
Pending Stake Withdrawals
0 ? 'collapse show' : 'collapse' } aria-labelledby="complete-withdraw-accordion-header" data-parent="#complete-withdraw-explorer-accordion">
{ data.length === 0 &&
You have no ZILs ready for withdrawal yet. }
When you initiate a stake withdrawal, the amount is not withdrawn immediately.
The amount is processed at a certain block number and only available to withdraw
once the required block number is reached.
);
}
export default ExplorerPendingWithdrawalTable;