Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: restore submit proposal button #11218

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions packages/page-treasury/src/Overview/ProposalCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

import type { Option, u128 } from '@polkadot/types';
import type { Permill } from '@polkadot/types/interfaces';
import type { BN } from '@polkadot/util';

import React, { useMemo, useState } from 'react';

import { Button, InputAddress, InputBalance, MarkWarning, Modal, Static, TxButton } from '@polkadot/react-components';
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';

Expand All @@ -28,11 +27,15 @@ function Propose ({ className }: Props): React.ReactElement<Props> | null {

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>).unwrap().toString()
: 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]
);
Expand Down Expand Up @@ -83,11 +86,13 @@ function Propose ({ className }: Props): React.ReactElement<Props> | null {
>
{bondPercentage}
</Static>
<InputBalance
defaultValue={bondMin}
isDisabled
label={t('minimum bond')}
/>
{bondMin && (
<InputBalance
defaultValue={bondMin}
isDisabled
label={t('minimum bond')}
/>
)}
{bondMax && (
<InputBalance
defaultValue={bondMax}
Expand Down
10 changes: 3 additions & 7 deletions packages/page-treasury/src/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ function Overview ({ className, isMember, members }: Props): React.ReactElement<
approvalCount={info?.approvals.length}
proposalCount={info?.proposals.length}
/>
{
api.tx.treasury.proposeSpend
? <Button.Group>
<ProposalCreate />
</Button.Group>
: <></>
}
<Button.Group>
<ProposalCreate />
</Button.Group>
<Proposals
isMember={isMember}
members={members}
Expand Down
Loading