From e9b5f72e8b0a902005be8a20d9fca256bbd27e0b Mon Sep 17 00:00:00 2001 From: kwingram25 Date: Sun, 14 Jul 2019 20:26:32 +0100 Subject: [PATCH] Change council to collective/elections (#1398) * Change council to collective/elections * fix proposal type * package --- .../{app-council => app-collective}/LICENSE | 0 packages/app-collective/README.md | 1 + .../package.json | 4 +-- .../src/Overview/Candidate.tsx | 0 .../src/Overview/Member.tsx | 2 +- .../src/Overview/Members.tsx | 14 ++++----- .../src/Overview/Summary.tsx | 30 +++++++++---------- .../src/Overview/index.tsx | 0 .../src/Proposals/Proposal.tsx} | 18 +++++------ .../src/Proposals}/Propose.tsx | 10 +++---- .../src/Proposals}/Summary.tsx | 0 .../src/Proposals}/index.tsx | 24 +++++++-------- .../src/index.tsx | 10 +++---- .../src/translate.ts | 4 +-- packages/app-council/README.md | 1 - .../app-explorer/src/BlockInfo/Extrinsics.tsx | 2 +- .../app-treasury/src/Overview/Approve.tsx | 8 ++--- .../app-treasury/src/Overview/Proposals.tsx | 2 +- .../src/{council.ts => collective.ts} | 10 +++---- packages/apps-routing/src/index.ts | 6 ++-- packages/ui-app/src/Voting.tsx | 14 ++++----- tsconfig.json | 4 +-- 22 files changed, 82 insertions(+), 82 deletions(-) rename packages/{app-council => app-collective}/LICENSE (100%) create mode 100644 packages/app-collective/README.md rename packages/{app-council => app-collective}/package.json (83%) rename packages/{app-council => app-collective}/src/Overview/Candidate.tsx (100%) rename packages/{app-council => app-collective}/src/Overview/Member.tsx (95%) rename packages/{app-council => app-collective}/src/Overview/Members.tsx (81%) rename packages/{app-council => app-collective}/src/Overview/Summary.tsx (59%) rename packages/{app-council => app-collective}/src/Overview/index.tsx (100%) rename packages/{app-council/src/Motions/Motion.tsx => app-collective/src/Proposals/Proposal.tsx} (88%) rename packages/{app-council/src/Motions => app-collective/src/Proposals}/Propose.tsx (92%) rename packages/{app-council/src/Motions => app-collective/src/Proposals}/Summary.tsx (100%) rename packages/{app-council/src/Motions => app-collective/src/Proposals}/index.tsx (64%) rename packages/{app-council => app-collective}/src/index.tsx (85%) rename packages/{app-council => app-collective}/src/translate.ts (59%) delete mode 100644 packages/app-council/README.md rename packages/apps-routing/src/{council.ts => collective.ts} (68%) diff --git a/packages/app-council/LICENSE b/packages/app-collective/LICENSE similarity index 100% rename from packages/app-council/LICENSE rename to packages/app-collective/LICENSE diff --git a/packages/app-collective/README.md b/packages/app-collective/README.md new file mode 100644 index 0000000000..8bf4850104 --- /dev/null +++ b/packages/app-collective/README.md @@ -0,0 +1 @@ +# @polkadot/app-collective diff --git a/packages/app-council/package.json b/packages/app-collective/package.json similarity index 83% rename from packages/app-council/package.json rename to packages/app-collective/package.json index b26911aec6..ed1b384610 100644 --- a/packages/app-council/package.json +++ b/packages/app-collective/package.json @@ -1,7 +1,7 @@ { - "name": "@polkadot/app-council", + "name": "@polkadot/app-collective", "version": "0.34.0-beta.60", - "description": "Council", + "description": "Collective", "main": "index.js", "scripts": {}, "author": "Jaco Greeff ", diff --git a/packages/app-council/src/Overview/Candidate.tsx b/packages/app-collective/src/Overview/Candidate.tsx similarity index 100% rename from packages/app-council/src/Overview/Candidate.tsx rename to packages/app-collective/src/Overview/Candidate.tsx diff --git a/packages/app-council/src/Overview/Member.tsx b/packages/app-collective/src/Overview/Member.tsx similarity index 95% rename from packages/app-council/src/Overview/Member.tsx rename to packages/app-collective/src/Overview/Member.tsx index b2c2264726..92cd2f5603 100644 --- a/packages/app-council/src/Overview/Member.tsx +++ b/packages/app-collective/src/Overview/Member.tsx @@ -23,7 +23,7 @@ class Member extends React.PureComponent { return ( #{formatNumber(block)}} - defaultName='council member' + defaultName='collective member' value={address} /> ); diff --git a/packages/app-council/src/Overview/Members.tsx b/packages/app-collective/src/Overview/Members.tsx similarity index 81% rename from packages/app-council/src/Overview/Members.tsx rename to packages/app-collective/src/Overview/Members.tsx index f77ac03772..7903c7882e 100644 --- a/packages/app-council/src/Overview/Members.tsx +++ b/packages/app-collective/src/Overview/Members.tsx @@ -14,13 +14,13 @@ import Candidate from './Candidate'; import Member from './Member'; type Props = I18nProps & { - council_activeCouncil?: Array<[string, BlockNumber]> - council_candidates?: Array + elections_members?: Array<[string, BlockNumber]> + elections_candidates?: Array }; class Members extends React.PureComponent { render () { - const { council_activeCouncil = [], council_candidates = [], t } = this.props; + const { elections_members = [], elections_candidates = [], t } = this.props; return ( @@ -28,7 +28,7 @@ class Members extends React.PureComponent { emptyText={t('No members found')} headerText={t('members')} > - {council_activeCouncil.map(([address, block]) => ( + {elections_members.map(([address, block]) => ( { emptyText={t('No members found')} headerText={t('candidates')} > - {council_candidates.map((address) => ( + {elections_candidates.map((address) => ( { export default translate( withCalls( - ['query.council.activeCouncil', { + ['query.elections.members', { transform: (active: Array<[AccountId, BlockNumber]>) => active.map(([accountId, blockNumber]) => [accountId.toString(), blockNumber]) }], - ['query.council.candidates', { + ['query.elections.candidates', { transform: (candidates: Array) => candidates.map((accountId) => accountId.toString()) }] diff --git a/packages/app-council/src/Overview/Summary.tsx b/packages/app-collective/src/Overview/Summary.tsx similarity index 59% rename from packages/app-council/src/Overview/Summary.tsx rename to packages/app-collective/src/Overview/Summary.tsx index a42bb7af3f..2a75668bd9 100644 --- a/packages/app-council/src/Overview/Summary.tsx +++ b/packages/app-collective/src/Overview/Summary.tsx @@ -14,36 +14,36 @@ import { formatNumber } from '@polkadot/util'; import translate from '../translate'; type Props = I18nProps & { - council_activeCouncil?: Array<[AccountId, BlockNumber]> - council_candidateCount?: BN, - council_desiredSeats?: BN, - council_termDuration?: BN, - council_voteCount?: BN + elections_members?: Array<[AccountId, BlockNumber]> + elections_candidateCount?: BN, + elections_desiredSeats?: BN, + elections_termDuration?: BN, + elections_voteCount?: BN }; class Summary extends React.PureComponent { render () { - const { council_activeCouncil = [], council_candidateCount = new BN(0), council_desiredSeats = new BN(1), council_termDuration = new BN(0), council_voteCount = new BN(0), t } = this.props; + const { elections_members = [], elections_candidateCount = new BN(0), elections_desiredSeats = new BN(1), elections_termDuration = new BN(0), elections_voteCount = new BN(0), t } = this.props; return (
- {formatNumber(council_activeCouncil.length)}/{formatNumber(council_desiredSeats)} + {formatNumber(elections_members.length)}/{formatNumber(elections_desiredSeats)} - {formatNumber(council_candidateCount)} + {formatNumber(elections_candidateCount)}
- {formatNumber(council_voteCount)} + {formatNumber(elections_voteCount)}
- {formatNumber(council_termDuration)} + {formatNumber(elections_termDuration)}
@@ -53,10 +53,10 @@ class Summary extends React.PureComponent { export default translate( withCalls( - 'query.council.activeCouncil', - 'query.council.candidateCount', - 'query.council.desiredSeats', - 'query.council.termDuration', - 'query.council.voteCount' + 'query.elections.members', + 'query.elections.candidateCount', + 'query.elections.desiredSeats', + 'query.elections.termDuration', + 'query.elections.voteCount' )(Summary) ); diff --git a/packages/app-council/src/Overview/index.tsx b/packages/app-collective/src/Overview/index.tsx similarity index 100% rename from packages/app-council/src/Overview/index.tsx rename to packages/app-collective/src/Overview/index.tsx diff --git a/packages/app-council/src/Motions/Motion.tsx b/packages/app-collective/src/Proposals/Proposal.tsx similarity index 88% rename from packages/app-council/src/Motions/Motion.tsx rename to packages/app-collective/src/Proposals/Proposal.tsx index f948f51aa6..f23d1f112c 100644 --- a/packages/app-council/src/Motions/Motion.tsx +++ b/packages/app-collective/src/Proposals/Proposal.tsx @@ -3,7 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { I18nProps } from '@polkadot/ui-app/types'; -import { Option, Proposal, Votes } from '@polkadot/types'; +import { Option, Proposal as ProposalType, Votes } from '@polkadot/types'; import BN from 'bn.js'; import React from 'react'; @@ -16,7 +16,7 @@ import translate from '../translate'; type Props = I18nProps & { chain_bestNumber?: BN, hash: string, - proposal: Proposal | null, + proposal: ProposalType | null, votes: Votes | null }; @@ -26,7 +26,7 @@ type State = { votedAye: number }; -class Motion extends React.PureComponent { +class Proposal extends React.PureComponent { state: State = { votedTotal: 0, votedAye: 0, @@ -64,7 +64,7 @@ class Motion extends React.PureComponent { accessory={ @@ -140,8 +140,8 @@ class Motion extends React.PureComponent { } export default withMulti( - styled(Motion as React.ComponentClass)` - .democracy--Motion-results { + styled(Proposal as React.ComponentClass)` + .democracy--Proposal-results { margin-bottom: 1em; &.chart { @@ -152,15 +152,15 @@ export default withMulti( translate, withCalls( [ - 'query.councilMotions.proposalOf', + 'query.collective.proposalOf', { paramName: 'hash', propName: 'proposal', - transform: (value: Option) => value.unwrapOr(null) + transform: (value: Option) => value.unwrapOr(null) } ], [ - 'query.councilMotions.voting', + 'query.collective.voting', { paramName: 'hash', propName: 'votes', diff --git a/packages/app-council/src/Motions/Propose.tsx b/packages/app-collective/src/Proposals/Propose.tsx similarity index 92% rename from packages/app-council/src/Motions/Propose.tsx rename to packages/app-collective/src/Proposals/Propose.tsx index 6ccc18c8b0..0697f24816 100644 --- a/packages/app-council/src/Motions/Propose.tsx +++ b/packages/app-collective/src/Proposals/Propose.tsx @@ -43,9 +43,9 @@ class Propose extends TxModal { return null; } - headerText = () => this.props.t('Propose a council motion'); + headerText = () => this.props.t('Make a collective proposal'); - txMethod = () => 'councilMotions.propose'; + txMethod = () => 'collective.propose'; txParams = () => { const { method, threshold } = this.state; @@ -72,7 +72,7 @@ class Propose extends TxModal {