ghost-portal/packages/app-tech-comm/src/Overview/Summary.tsx
Keith Ingram a69bdfeef1 Propose tech committee motions (#1996)
* Propose tech committe motions

* bug, ignore .vscode

* linting

* Some cleanups

* Move Propose back
2019-12-04 12:22:19 +01:00

41 lines
1.3 KiB
TypeScript

/* eslint-disable @typescript-eslint/camelcase */
// Copyright 2017-2019 @polkadot/app-tech-comm 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 { I18nProps } from '@polkadot/react-components/types';
import { ComponentProps } from '../types';
import React from 'react';
import { SummaryBox, CardSummary } from '@polkadot/react-components';
import { useApi, trackStream } from '@polkadot/react-hooks';
import { u32 } from '@polkadot/types';
import { formatNumber } from '@polkadot/util';
import translate from '../translate';
interface Props extends ComponentProps, I18nProps {}
function Summary ({ className, members, proposals, t }: Props): React.ReactElement<Props> {
const { api } = useApi();
const proposalCount = trackStream<u32>(api.query.technicalCommittee.proposalCount, []);
return (
<SummaryBox className={className}>
<CardSummary label={t('members')}>
{formatNumber(members?.length)}
</CardSummary>
<section>
<CardSummary label={t('proposals')}>
{formatNumber(proposals?.length)}
</CardSummary>
<CardSummary label={t('total')}>
{formatNumber(proposalCount)}
</CardSummary>
</section>
</SummaryBox>
);
}
export default translate(Summary);