Link to Payout tab from actions (#2544)
This commit is contained in:
parent
92cfdc9be6
commit
a3ee0e3ee3
@ -5,6 +5,7 @@
|
||||
import { ActiveEraInfo, EraIndex } from '@polkadot/types/interfaces';
|
||||
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Trans } from 'react-i18next';
|
||||
import { Table } from '@polkadot/react-components';
|
||||
import { useCall, useApi, useOwnStashes } from '@polkadot/react-hooks';
|
||||
import { Option } from '@polkadot/types';
|
||||
@ -81,6 +82,9 @@ function Actions ({ allStashes, className, isInElection, next, validators }: Pro
|
||||
/>
|
||||
))}
|
||||
</Table>
|
||||
{api.query.staking.activeEra && (
|
||||
<Trans key='paymentMoved'>All applicable account payouts are now available on the <a href='#/staking/payout'>Payouts tab</a></Trans>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -109,6 +109,7 @@ function Payouts ({ className, isInElection }: Props): React.ReactElement<Props>
|
||||
<ElectionBanner isInElection={isInElection} />
|
||||
<Table
|
||||
empty={stashes && t('No pending payouts for your stashes')}
|
||||
emptySpinner={t('Retrieving info for all applicable eras, this will take some time')}
|
||||
header={[
|
||||
[t('payout/stash'), 'start'],
|
||||
[t('eras'), 'start'],
|
||||
|
||||
@ -12,16 +12,17 @@ interface Props {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
empty?: React.ReactNode;
|
||||
emptySpinner?: React.ReactNode;
|
||||
}
|
||||
|
||||
function Body ({ children, className, empty }: Props): React.ReactElement<Props> {
|
||||
function Body ({ children, className, empty, emptySpinner }: Props): React.ReactElement<Props> {
|
||||
return (
|
||||
<tbody className={className}>
|
||||
{children || (
|
||||
<tr><td colSpan={100}>{
|
||||
isString(empty)
|
||||
? <div className='empty'>{empty}</div>
|
||||
: empty || <Spinner />
|
||||
: empty || <Spinner label={emptySpinner} />
|
||||
}</td></tr>
|
||||
)}
|
||||
</tbody>
|
||||
|
||||
@ -12,6 +12,7 @@ interface TableProps {
|
||||
children: React.ReactNode;
|
||||
className?: string;
|
||||
empty?: React.ReactNode;
|
||||
emptySpinner?: React.ReactNode;
|
||||
filter?: React.ReactNode;
|
||||
header: [React.ReactNode?, string?, number?, (() => void)?][];
|
||||
isFixed?: boolean;
|
||||
@ -28,7 +29,7 @@ function extractKids (children: React.ReactNode): [boolean, React.ReactNode] {
|
||||
return [isEmpty, isEmpty ? null : kids];
|
||||
}
|
||||
|
||||
function Table ({ children, className, empty, filter, header, isFixed }: TableProps): React.ReactElement<TableProps> {
|
||||
function Table ({ children, className, empty, emptySpinner, filter, header, isFixed }: TableProps): React.ReactElement<TableProps> {
|
||||
const [isEmpty, kids] = extractKids(children);
|
||||
|
||||
return (
|
||||
@ -39,7 +40,10 @@ function Table ({ children, className, empty, filter, header, isFixed }: TablePr
|
||||
header={header}
|
||||
isEmpty={isEmpty}
|
||||
/>
|
||||
<Body empty={empty}>
|
||||
<Body
|
||||
empty={empty}
|
||||
emptySpinner={emptySpinner}
|
||||
>
|
||||
{kids}
|
||||
</Body>
|
||||
</table>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user