Don';t assume council with treasury (#8409)
This commit is contained in:
parent
73f74d22b3
commit
ba7b715c69
@ -6,8 +6,9 @@ import type { DeriveTreasuryProposal } from '@polkadot/api-derive/types';
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { AddressMini, AddressSmall, LinkExternal } from '@polkadot/react-components';
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
import { FormatBalance } from '@polkadot/react-query';
|
||||
import { formatNumber } from '@polkadot/util';
|
||||
import { formatNumber, isFunction } from '@polkadot/util';
|
||||
|
||||
import { useTranslation } from '../translate';
|
||||
import Council from './Council';
|
||||
@ -22,7 +23,9 @@ interface Props {
|
||||
|
||||
function ProposalDisplay ({ className = '', isMember, members, proposal: { council, id, proposal }, withSend }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
|
||||
const hasCouncil = isFunction(api.tx.council?.propose);
|
||||
const hasProposals = useMemo(
|
||||
() => !!council
|
||||
.map(({ votes }) => votes ? votes.index.toNumber() : -1)
|
||||
@ -49,15 +52,17 @@ function ProposalDisplay ({ className = '', isMember, members, proposal: { counc
|
||||
<FormatBalance value={proposal.bond} />
|
||||
</td>
|
||||
<td className={hasProposals ? 'middle' : 'button'}>
|
||||
{hasProposals
|
||||
? <a href='#/council/motions'>{t('Voting')}</a>
|
||||
: withSend && (
|
||||
<Council
|
||||
id={id}
|
||||
isDisabled={!isMember}
|
||||
members={members}
|
||||
/>
|
||||
)
|
||||
{hasCouncil
|
||||
? hasProposals
|
||||
? <a href='#/council/motions'>{t('Voting')}</a>
|
||||
: withSend && (
|
||||
<Council
|
||||
id={id}
|
||||
isDisabled={!isMember}
|
||||
members={members}
|
||||
/>
|
||||
)
|
||||
: null
|
||||
}
|
||||
</td>
|
||||
<td className='links'>
|
||||
|
||||
@ -99,7 +99,7 @@ function Propose ({ className }: Props): React.ReactElement<Props> | null {
|
||||
label={t<string>('maximum bond')}
|
||||
/>
|
||||
)}
|
||||
<MarkWarning content={t<string>('Be aware that once submitted the proposal will be put to a council vote. If the proposal is rejected due to a lack of info, invalid requirements or non-benefit to the network as a whole, the full bond posted (as describe above) will be lost.')} />
|
||||
<MarkWarning content={t<string>('Be aware that once submitted the proposal will be put to a vote. If the proposal is rejected due to a lack of info, invalid requirements or non-benefit to the network as a whole, the full bond posted (as describe above) will be lost.')} />
|
||||
</Modal.Columns>
|
||||
</Modal.Content>
|
||||
<Modal.Actions>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user