diff --git a/packages/app-council/src/Motions/Motion.tsx b/packages/app-council/src/Motions/Motion.tsx index 76b97bb5b2..da1a4ffea5 100644 --- a/packages/app-council/src/Motions/Motion.tsx +++ b/packages/app-council/src/Motions/Motion.tsx @@ -9,8 +9,10 @@ import BN from 'bn.js'; import React from 'react'; import { Option } from '@polkadot/types'; -import { ActionItem, InputAddress, Labelled, Voting } from '@polkadot/react-components'; +import { AddressMini, Voting } from '@polkadot/react-components'; import { withCalls, withMulti } from '@polkadot/react-api'; +import ProposalCell from '@polkadot/app-democracy/Overview/ProposalCell'; +import { formatNumber } from '@polkadot/util'; import translate from '../translate'; @@ -29,58 +31,42 @@ function Motion ({ className, hash, proposal, t, votes }: Props): React.ReactEle const { ayes, index, nays, threshold } = votes; return ( - +

{formatNumber(index)}

+ + + + {formatNumber(ayes.length)}/{formatNumber(threshold)} + + + {ayes.map((address, index): React.ReactNode => ( + + ))} + + + {nays.map((address, index): React.ReactNode => ( + + ))} + + - } - expandNested - idNumber={index} - proposal={proposal} - > -
-

{t('ayes ({{ayes}}/{{threshold}} to approve)', { - replace: { - ayes: ayes.length, - threshold: threshold.toString() - } - })}

- {ayes.map((address, index): React.ReactNode => ( - - - - ))} -

{t('nays ({{nays}})', { - replace: { - nays: nays.length - } - })}

- {nays.map((address, index): React.ReactNode => ( - - - - ))} -
-
+ + ); } diff --git a/packages/app-council/src/Motions/index.tsx b/packages/app-council/src/Motions/index.tsx index 5a430bd6f0..6f9afa04bf 100644 --- a/packages/app-council/src/Motions/index.tsx +++ b/packages/app-council/src/Motions/index.tsx @@ -6,7 +6,7 @@ import { Hash } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/react-components/types'; import React from 'react'; -import { CardGrid } from '@polkadot/react-components'; +import { Table } from '@polkadot/react-components'; import Motion from './Motion'; import Propose from './Propose'; @@ -16,22 +16,26 @@ interface Props extends I18nProps { motions?: Hash[]; } -function Proposals ({ motions, t }: Props): React.ReactElement { +function Proposals ({ className, motions, t }: Props): React.ReactElement { return ( - +
+ + {motions?.length + ? ( + + + {motions?.map((hash: Hash): React.ReactNode => ( + + ))} + +
+ ) + : t('No council motions') } - > - {motions?.map((hash: Hash): React.ReactNode => ( - - ))} - +
); } diff --git a/packages/app-democracy/src/Overview/Proposal.tsx b/packages/app-democracy/src/Overview/Proposal.tsx index 142969270c..ec21bd6b64 100644 --- a/packages/app-democracy/src/Overview/Proposal.tsx +++ b/packages/app-democracy/src/Overview/Proposal.tsx @@ -22,7 +22,7 @@ interface Props extends I18nProps { function Proposal ({ className, t, value: { balance, index, proposal, proposer, seconds } }: Props): React.ReactElement { return ( - {formatNumber(index)} +

{formatNumber(index)}

diff --git a/packages/app-democracy/src/Overview/ProposalCell.tsx b/packages/app-democracy/src/Overview/ProposalCell.tsx index 112db37e00..06faa6bec0 100644 --- a/packages/app-democracy/src/Overview/ProposalCell.tsx +++ b/packages/app-democracy/src/Overview/ProposalCell.tsx @@ -28,6 +28,7 @@ function ProposalCell ({ className, proposal, t }: Props): React.ReactElement diff --git a/packages/app-democracy/src/Overview/Referendum.tsx b/packages/app-democracy/src/Overview/Referendum.tsx index 9c18376815..afb6102f55 100644 --- a/packages/app-democracy/src/Overview/Referendum.tsx +++ b/packages/app-democracy/src/Overview/Referendum.tsx @@ -84,7 +84,7 @@ function Referendum ({ chain_bestNumber, className, democracy_enactmentPeriod, d return ( - {formatNumber(value.index)} +

{formatNumber(value.index)}

diff --git a/packages/app-tech-comm/src/Proposals/Proposal.tsx b/packages/app-tech-comm/src/Proposals/Proposal.tsx index 0fd8dc6346..a76afcfc9d 100644 --- a/packages/app-tech-comm/src/Proposals/Proposal.tsx +++ b/packages/app-tech-comm/src/Proposals/Proposal.tsx @@ -8,10 +8,12 @@ import { I18nProps } from '@polkadot/react-components/types'; import React from 'react'; import { useApi, trackStream } from '@polkadot/react-hooks'; import { Option } from '@polkadot/types'; - -import { ActionItem, InputAddress, Labelled, Voting } from '@polkadot/react-components'; +import { AddressMini } from '@polkadot/react-components'; +import ProposalCell from '@polkadot/app-democracy/Overview/ProposalCell'; +import { formatNumber } from '@polkadot/util'; import translate from '../translate'; +import Voting from './Voting'; interface Props extends I18nProps { hash: string; @@ -29,57 +31,40 @@ function Proposal ({ className, hash, t }: Props): React.ReactElement | n const { ayes, index, nays, threshold } = votes.unwrap(); return ( - +

{formatNumber(index)}

+ + + + {formatNumber(ayes.length)}/{formatNumber(threshold)} + + + {ayes.map((address, index): React.ReactNode => ( + + ))} + + + {nays.map((address, index): React.ReactNode => ( + + ))} + + - } - expandNested - idNumber={index} - proposal={proposal} - > -
-

{t('ayes ({{ayes}}/{{threshold}} to approve)', { - replace: { - ayes: ayes.length, - threshold: threshold.toString() - } - })}

- {ayes.map((address, index): React.ReactNode => ( - - - - ))} -

{t('nays ({{nays}})', { - replace: { - nays: nays.length - } - })}

- {nays.map((address, index): React.ReactNode => ( - - - - ))} -
-
+ + ); } diff --git a/packages/app-tech-comm/src/Proposals/index.tsx b/packages/app-tech-comm/src/Proposals/index.tsx index b848c7e5c5..96b3707651 100644 --- a/packages/app-tech-comm/src/Proposals/index.tsx +++ b/packages/app-tech-comm/src/Proposals/index.tsx @@ -6,7 +6,7 @@ import { Hash } from '@polkadot/types/interfaces'; import { I18nProps } from '@polkadot/react-components/types'; import React from 'react'; -import { CardGrid } from '@polkadot/react-components'; +import { Table } from '@polkadot/react-components'; import Proposal from './Proposal'; import translate from '../translate'; @@ -15,20 +15,26 @@ interface Props extends I18nProps { proposals?: Hash[]; } -function Proposals ({ proposals, t }: Props): React.ReactElement { +function Proposals ({ className, proposals, t }: Props): React.ReactElement { return ( - } - > - {proposals?.map((hash: Hash): React.ReactNode => ( - - ))} - +
+ {/* */} + {proposals?.length + ? ( + + + {proposals?.map((hash: Hash): React.ReactNode => ( + + ))} + +
+ ) + : t('No committee proposals') + } +
); } diff --git a/packages/react-components/src/Call.tsx b/packages/react-components/src/Call.tsx index 9dff4a8f49..99c76b2fe0 100644 --- a/packages/react-components/src/Call.tsx +++ b/packages/react-components/src/Call.tsx @@ -18,13 +18,14 @@ import translate from './translate'; export interface Props extends I18nProps, BareProps { children?: React.ReactNode; + labelHash?: React.ReactNode; value: IExtrinsic | IMethod; withHash?: boolean; mortality?: string; tip?: BN; } -function Call ({ children, className, style, mortality, tip, value, withHash, t }: Props): React.ReactElement { +function Call ({ children, className, labelHash, style, mortality, tip, value, withHash, t }: Props): React.ReactElement { const params = GenericCall.filterOrigin(value.meta).map(({ name, type }): { name: string; type: TypeDef } => ({ name: name.toString(), type: getTypeDef(type.toString()) @@ -46,7 +47,7 @@ function Call ({ children, className, style, mortality, tip, value, withHash, t {hash && ( {hash.toHex()}