// Copyright 2017-2020 @polkadot/app-democracy authors & contributors // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. import { BlockNumber, Hash, ReferendumIndex } from '@polkadot/types/interfaces'; import React from 'react'; import { Spinner, Table } from '@polkadot/react-components'; import { useApi, useCall } from '@polkadot/react-hooks'; import { useTranslation } from '../translate'; import DispatchEntry from './DispatchEntry'; interface Props { className?: string; } function DispatchQueue ({ className }: Props): React.ReactElement | null { const { t } = useTranslation(); const { api } = useApi(); const queued = useCall<[BlockNumber, Hash, ReferendumIndex][]>(api.query.democracy.dispatchQueue, []); if (!queued?.length) { return null; } return (

{t('dispatch queue')}

{queued ? queued.length ? ( {queued.map(([blockNumber, hash, referendumIndex]): React.ReactNode => ( ))}
) : t('nothing queued to be executed') : }
); } export default React.memo(DispatchQueue);