import React from 'react'; import { Table } from 'semantic-ui-react'; import BN from 'bn.js'; import { I18nProps } from '@polkadot/react-components/types'; import { ApiProps } from '@polkadot/react-api/types'; import { withCalls } from '@polkadot/react-api/with'; import { AccountId } from '@polkadot/types/interfaces'; import { formatNumber } from '@polkadot/util'; import translate from './translate'; import Applicant from './Applicant'; import ApplyForm from './ApplyForm'; import Section from '@polkadot/joy-utils/Section'; import { queryToProp } from '@polkadot/joy-utils/index'; import { withMyAccount, MyAccountProps } from '@polkadot/joy-utils/MyAccount'; type Props = ApiProps & I18nProps & MyAccountProps & { candidacyLimit?: BN; applicants?: Array; }; class Applicants extends React.PureComponent { private renderTable = (applicants: Array) => ( # Applicant Total stake Actions {applicants.map((accountId, index) => ( ))}
) render () { const { myAddress, applicants = [], candidacyLimit = new BN(0) } = this.props; const title = Applicants {applicants.length}/{formatNumber(candidacyLimit)}; return <>
{!applicants.length ? No applicants yet : this.renderTable(applicants) }
; } } // inject the actual API calls automatically into props export default translate( withCalls( queryToProp('query.councilElection.candidacyLimit'), queryToProp('query.councilElection.applicants') )(withMyAccount(Applicants)) );