From 2807978f90c31764b7ce2ef720d711f6d6d2c1af Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Fri, 25 Sep 2020 13:51:00 +0200 Subject: [PATCH] Allow close select with multi members (#3764) --- packages/page-council/src/Motions/Close.tsx | 91 +++++++++++++++++++ packages/page-council/src/Motions/Motion.tsx | 49 ++++++---- packages/page-council/src/Motions/index.tsx | 2 +- .../page-tech-comm/src/Proposals/Close.tsx | 90 ++++++++++++++++++ .../page-tech-comm/src/Proposals/Proposal.tsx | 47 +++++++--- 5 files changed, 247 insertions(+), 32 deletions(-) create mode 100644 packages/page-council/src/Motions/Close.tsx create mode 100644 packages/page-tech-comm/src/Proposals/Close.tsx diff --git a/packages/page-council/src/Motions/Close.tsx b/packages/page-council/src/Motions/Close.tsx new file mode 100644 index 0000000000..1619a95e8b --- /dev/null +++ b/packages/page-council/src/Motions/Close.tsx @@ -0,0 +1,91 @@ +// Copyright 2017-2020 @polkadot/app-council authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import { Hash, Proposal, ProposalIndex } from '@polkadot/types/interfaces'; + +import React, { useState } from 'react'; +import { Button, InputAddress, Modal, ProposedAction, TxButton } from '@polkadot/react-components'; +import { useApi, useToggle, useWeight } from '@polkadot/react-hooks'; + +import { useTranslation } from '../translate'; + +interface Props { + hasFailed: boolean; + hash: Hash; + idNumber: ProposalIndex; + members: string[]; + proposal: Proposal; +} + +function Close ({ hasFailed, hash, idNumber, members, proposal }: Props): React.ReactElement | null { + const { t } = useTranslation(); + const { api } = useApi(); + const [isOpen, toggleOpen] = useToggle(); + const [accountId, setAccountId] = useState(null); + const [proposalWeight, proposalLength] = useWeight(proposal); + + // protect against older versions + if (!api.tx.council.close) { + return null; + } + + return ( + <> + {isOpen && ( + ('Close proposal')} + size='large' + > + + + + + + +

{t('The proposal that will be affected. Once closed for the current voting round, it would need to be re-submitted to council for a subsequent voting round.')}

+
+
+ + + ('Select the account you wish close the proposal with.')} + label={t('sending account')} + onChange={setAccountId} + type='account' + /> + + +

{t('The council account that will apply the close for the current round.')}

+
+
+
+ + + +
+ )} +