Add info about the nominators state (#3420)

* add info about the nominators state

* Apply suggestions from code review

* remove duplicated info

* Apply suggestions from code review

Co-authored-by: Jaco Greeff <jacogr@gmail.com>
This commit is contained in:
Thibaut Sardan 2020-08-14 20:12:00 +02:00 committed by GitHub
parent 2ec81e19d8
commit 4d1c18fec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 12 deletions

View File

@ -20,7 +20,10 @@ function ListNominees ({ nominating, stashId }: Props): React.ReactElement<Props
return (
<>
{nomsActive && nomsActive.length !== 0 && (
<Expander summary={t<string>('Active nominations ({{count}})', { replace: { count: nomsActive.length } })}>
<Expander
help={t<string>('The validators selected by the Phragmen algorithm to nominate for this era.')}
summary={t<string>('Active nominations ({{count}})', { replace: { count: nomsActive.length } })}
>
{nomsActive.map((nomineeId, index): React.ReactNode => (
<AddressMini
key={index}
@ -31,7 +34,10 @@ function ListNominees ({ nominating, stashId }: Props): React.ReactElement<Props
</Expander>
)}
{nomsInactive && nomsInactive.length !== 0 && (
<Expander summary={t<string>('Inactive nominations ({{count}})', { replace: { count: nomsInactive.length } })}>
<Expander
help={t<string>('The elected validator list that did not get selected by the Phragmen algorithm for this era. However they may be selected in the future.')}
summary={t<string>('Inactive nominations ({{count}})', { replace: { count: nomsInactive.length } })}
>
{nomsInactive.map((nomineeId, index): React.ReactNode => (
<AddressMini
key={index}
@ -42,7 +48,10 @@ function ListNominees ({ nominating, stashId }: Props): React.ReactElement<Props
</Expander>
)}
{nomsChilled && nomsChilled.length !== 0 && (
<Expander summary={t<string>('Renomination required ({{count}})', { replace: { count: nomsChilled.length } })}>
<Expander
help={t<string>('The validators that got slashed and for which your nomination got auto-chilled. Re-nominating these will make them available to the Phragmen algorithm.')}
summary={t<string>('Renomination required ({{count}})', { replace: { count: nomsChilled.length } })}
>
{nomsChilled.map((nomineeId, index): React.ReactNode => (
<AddressMini
key={index}
@ -53,7 +62,10 @@ function ListNominees ({ nominating, stashId }: Props): React.ReactElement<Props
</Expander>
)}
{nomsWaiting && nomsWaiting.length !== 0 && (
<Expander summary={t<string>('Waiting nominations ({{count}})', { replace: { count: nomsWaiting.length } })}>
<Expander
help={t<string>('The validators that are not in the validator set because they need more nominations or because they have willingly stop validating. Any nominations made before the next election will also appear here.')}
summary={t<string>('Waiting nominations ({{count}})', { replace: { count: nomsWaiting.length } })}
>
{nomsWaiting.map((nomineeId, index): React.ReactNode => (
<AddressMini
key={index}

View File

@ -21,13 +21,6 @@ Nomination (using the controller account as set as part of the bonding) is a pro
You can stop nominating at any point in time, using the controller account. You can also bond more funds using the stash account.
The "Account actions" tab show the current state of your account's nominations.
Validators that you have selected (up to 16) can be in 4 states:
- Active nominations: The validators selected by the Phragmen algorithm to nominate for this era.
- Inactive nominations: The active validator list from which the algorithm can select for upcomming eras.
- Waiting nominations: The validators that are not in the validator set. More nominations are required for them to get in.
- Renomination required: The validators that will never be selected again by the Phragmen algorithm. Either because they stopped validating, or because they got slashed while you were one of their nominator. If you wish to nominate them again, you need to manually select them again.
# Validating
Validators run nodes that author blocks. The primary requirement here is the ability to run a node that is available 24/7 and is well-connected to the network.

View File

@ -4,6 +4,7 @@
import React, { useMemo } from 'react';
import styled from 'styled-components';
import { LabelHelp } from '@polkadot/react-components';
import { useToggle } from '@polkadot/react-hooks';
import { Text } from '@polkadot/types';
@ -17,6 +18,7 @@ interface Meta {
export interface Props {
children?: React.ReactNode;
className?: string;
help?: string;
isOpen?: boolean;
summary?: React.ReactNode;
summaryMeta?: Meta;
@ -40,7 +42,7 @@ function formatMeta (meta?: Meta): React.ReactNode | null {
).join(' ');
}
function Expander ({ children, className = '', isOpen, summary, summaryMeta, summarySub, withDot, withHidden }: Props): React.ReactElement<Props> {
function Expander ({ children, className = '', help, isOpen, summary, summaryMeta, summarySub, withDot, withHidden }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const [isExpanded, toggleExpanded] = useToggle(isOpen);
const headerMain = useMemo(
@ -63,6 +65,7 @@ function Expander ({ children, className = '', isOpen, summary, summaryMeta, sum
onClick={toggleExpanded}
>
<div className='ui--Expander-summary-header'>
{help && <LabelHelp help={help}/>}
{hasContent
? <Icon icon={isExpanded ? 'angle-double-down' : 'angle-double-right'} />
: withDot