fix: restore submit proposal button (#11218)
* fix: restore submit proposal button again * chore: check if bondMin is not null
This commit is contained in:
parent
399cf2c2ed
commit
8ecdfe34a2
@ -3,13 +3,12 @@
|
|||||||
|
|
||||||
import type { Option, u128 } from '@polkadot/types';
|
import type { Option, u128 } from '@polkadot/types';
|
||||||
import type { Permill } from '@polkadot/types/interfaces';
|
import type { Permill } from '@polkadot/types/interfaces';
|
||||||
import type { BN } from '@polkadot/util';
|
|
||||||
|
|
||||||
import React, { useMemo, useState } from 'react';
|
import React, { useMemo, useState } from 'react';
|
||||||
|
|
||||||
import { Button, InputAddress, InputBalance, MarkWarning, Modal, Static, TxButton } from '@polkadot/react-components';
|
import { Button, InputAddress, InputBalance, MarkWarning, Modal, Static, TxButton } from '@polkadot/react-components';
|
||||||
import { useApi, useToggle } from '@polkadot/react-hooks';
|
import { useApi, useToggle } from '@polkadot/react-hooks';
|
||||||
import { BN_HUNDRED, BN_MILLION } from '@polkadot/util';
|
import { BN, BN_HUNDRED, BN_MILLION } from '@polkadot/util';
|
||||||
|
|
||||||
import { useTranslation } from '../translate.js';
|
import { useTranslation } from '../translate.js';
|
||||||
|
|
||||||
@ -28,11 +27,15 @@ function Propose ({ className }: Props): React.ReactElement<Props> | null {
|
|||||||
|
|
||||||
const [bondMin, bondMax, bondPercentage] = useMemo(
|
const [bondMin, bondMax, bondPercentage] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
(api.consts.treasury.proposalBondMinimum as u128).toString(),
|
api.consts.treasury.proposalBondMinimum
|
||||||
|
? (api.consts.treasury.proposalBondMinimum as u128).toString()
|
||||||
|
: null,
|
||||||
(api.consts.treasury.proposalBondMaximum as Option<u128>)?.isSome
|
(api.consts.treasury.proposalBondMaximum as Option<u128>)?.isSome
|
||||||
? (api.consts.treasury.proposalBondMaximum as Option<u128>).unwrap().toString()
|
? (api.consts.treasury.proposalBondMaximum as Option<u128>).unwrap().toString()
|
||||||
: null,
|
: null,
|
||||||
`${(api.consts.treasury.proposalBond as Permill).mul(BN_HUNDRED).div(BN_MILLION).toNumber().toFixed(2)}%`
|
api.consts.treasury.proposalBond
|
||||||
|
? `${(api.consts.treasury.proposalBond as Permill).mul(BN_HUNDRED).div(BN_MILLION).toNumber().toFixed(2)}%`
|
||||||
|
: `${new BN(0).toNumber().toFixed(2)}%`
|
||||||
],
|
],
|
||||||
[api]
|
[api]
|
||||||
);
|
);
|
||||||
@ -83,11 +86,13 @@ function Propose ({ className }: Props): React.ReactElement<Props> | null {
|
|||||||
>
|
>
|
||||||
{bondPercentage}
|
{bondPercentage}
|
||||||
</Static>
|
</Static>
|
||||||
<InputBalance
|
{bondMin && (
|
||||||
defaultValue={bondMin}
|
<InputBalance
|
||||||
isDisabled
|
defaultValue={bondMin}
|
||||||
label={t('minimum bond')}
|
isDisabled
|
||||||
/>
|
label={t('minimum bond')}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{bondMax && (
|
{bondMax && (
|
||||||
<InputBalance
|
<InputBalance
|
||||||
defaultValue={bondMax}
|
defaultValue={bondMax}
|
||||||
|
|||||||
@ -28,13 +28,9 @@ function Overview ({ className, isMember, members }: Props): React.ReactElement<
|
|||||||
approvalCount={info?.approvals.length}
|
approvalCount={info?.approvals.length}
|
||||||
proposalCount={info?.proposals.length}
|
proposalCount={info?.proposals.length}
|
||||||
/>
|
/>
|
||||||
{
|
<Button.Group>
|
||||||
api.tx.treasury.proposeSpend
|
<ProposalCreate />
|
||||||
? <Button.Group>
|
</Button.Group>
|
||||||
<ProposalCreate />
|
|
||||||
</Button.Group>
|
|
||||||
: <></>
|
|
||||||
}
|
|
||||||
<Proposals
|
<Proposals
|
||||||
isMember={isMember}
|
isMember={isMember}
|
||||||
members={members}
|
members={members}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user