index.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2017-2020 @polkadot/app-tech-comm authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the Apache-2.0 license. See the LICENSE file for details.
  4. import { Hash } from '@polkadot/types/interfaces';
  5. import { ComponentProps as Props } from '../types';
  6. import React from 'react';
  7. import { Button, Table } from '@polkadot/react-components';
  8. import { useTranslation } from '../translate';
  9. import Proposal from './Proposal';
  10. import Propose from './Propose';
  11. function Proposals ({ className, isMember, members, prime, proposals }: Props): React.ReactElement<Props> {
  12. const { t } = useTranslation();
  13. return (
  14. <div className={className}>
  15. <Button.Group>
  16. <Propose
  17. isMember={isMember}
  18. members={members}
  19. />
  20. </Button.Group>
  21. <Table>
  22. <Table.Head>
  23. <th
  24. className='start'
  25. colSpan={2}
  26. >
  27. <h1>{t('proposals')}</h1>
  28. </th>
  29. <th>{t('threshold')}</th>
  30. <th className='address'>{t('aye')}</th>
  31. <th className='address'>{t('nay')}</th>
  32. <th>&nbsp;</th>
  33. </Table.Head>
  34. <Table.Body empty={proposals && t('No committee proposals')}>
  35. {proposals?.map((hash: Hash): React.ReactNode => (
  36. <Proposal
  37. imageHash={hash.toHex()}
  38. key={hash.toHex()}
  39. prime={prime}
  40. />
  41. ))}
  42. </Table.Body>
  43. </Table>
  44. </div>
  45. );
  46. }
  47. export default React.memo(Proposals);