diff --git a/packages/page-society/src/Candidates/VouchFor.tsx b/packages/page-society/src/Candidates/VouchFor.tsx new file mode 100644 index 0000000000..ef6c4ee9ab --- /dev/null +++ b/packages/page-society/src/Candidates/VouchFor.tsx @@ -0,0 +1,76 @@ +// Copyright 2017-2021 @polkadot/app-society authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type BN from 'bn.js'; + +import React, { useState } from 'react'; + +import { InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; +import { useApi } from '@polkadot/react-hooks'; + +import { useTranslation } from '../translate'; + +interface Props { + allMembers: string[]; + onClose: () => void; +} + +function VouchNew ({ allMembers, onClose }: Props): React.ReactElement { + const { t } = useTranslation(); + const { api } = useApi(); + const [amount, setAmount] = useState(); + const [tip, setTip] = useState(); + const [accountId, setAccount] = useState(); + const [candidateId, setCandidate] = useState(); + + return ( + ('Vouch for a new candidate')} + onClose={onClose} + size='large' + > + + ('Your member account that the vouch is made from.')}> + ('member account')} + onChange={setAccount} + type='account' + /> + + ('The candidate/bid account. Once accepted this account will become a member.')}> + ('bid account')} + onChange={setCandidate} + /> + + ('The amount to tie to your bid. The lowest bidder moves forward.')}> + ('bid amount')} + onChange={setAmount} + /> + + ('The amount you wish to be tipped for your bid.')}> + ('tip amount')} + onChange={setTip} + /> + + + + ('Vouch')} + onStart={onClose} + params={[candidateId, amount, tip]} + tx={api.tx.society.vouch} + /> + + + ); +} + +export default React.memo(VouchNew); diff --git a/packages/page-society/src/Candidates/index.tsx b/packages/page-society/src/Candidates/index.tsx index 65e6e8bed5..d99546945b 100644 --- a/packages/page-society/src/Candidates/index.tsx +++ b/packages/page-society/src/Candidates/index.tsx @@ -12,6 +12,7 @@ import { useTranslation } from '../translate'; import BidNew from './BidNew'; import Bids from './Bids'; import AllCandidates from './Candidates'; +import VouchFor from './VouchFor'; interface Props { allMembers: string[]; @@ -24,6 +25,7 @@ interface Props { function Candidates ({ allMembers, candidates, className, isMember, ownMembers }: Props): React.ReactElement { const { t } = useTranslation(); const [isBidOpen, toggleBidOpen] = useToggle(); + const [isVouchOpen, toggleVouchOpen] = useToggle(); return (
@@ -33,9 +35,21 @@ function Candidates ({ allMembers, candidates, className, isMember, ownMembers } label={t('Submit bid')} onClick={toggleBidOpen} /> +