Hide society unbid for vouch (#6396)
* Hide society unbid for vouch * Linting
This commit is contained in:
parent
f6c21d03b5
commit
862f06cfa8
@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/app-society authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Bid } from '@polkadot/types/interfaces';
|
||||
import type { PalletSocietyBid } from '@polkadot/types/lookup';
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
@ -14,7 +14,7 @@ import BidType from './BidType';
|
||||
|
||||
interface Props {
|
||||
index: number;
|
||||
value: Bid;
|
||||
value: PalletSocietyBid;
|
||||
}
|
||||
|
||||
function BidRow ({ index, value: { kind, value, who } }: Props): React.ReactElement<Props> {
|
||||
@ -41,14 +41,16 @@ function BidRow ({ index, value: { kind, value, who } }: Props): React.ReactElem
|
||||
<FormatBalance value={value} />
|
||||
</td>
|
||||
<td className='button'>
|
||||
<TxButton
|
||||
accountId={who}
|
||||
icon='times'
|
||||
isDisabled={!isBidder}
|
||||
label={t<string>('Unbid')}
|
||||
params={[index]}
|
||||
tx={api.tx.society.unbid}
|
||||
/>
|
||||
{!kind.isVouch && (
|
||||
<TxButton
|
||||
accountId={who}
|
||||
icon='times'
|
||||
isDisabled={!isBidder}
|
||||
label={t<string>('Unbid')}
|
||||
params={[index]}
|
||||
tx={api.tx.society.unbid}
|
||||
/>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
|
||||
@ -1,14 +1,14 @@
|
||||
// Copyright 2017-2021 @polkadot/app-society authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { BidKind } from '@polkadot/types/interfaces';
|
||||
import type { PalletSocietyBidKind } from '@polkadot/types/lookup';
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { AddressSmall } from '@polkadot/react-components';
|
||||
|
||||
interface Props {
|
||||
value?: BidKind;
|
||||
value?: PalletSocietyBidKind;
|
||||
}
|
||||
|
||||
function BidType ({ value }: Props): React.ReactElement<Props> {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/app-society authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Bid } from '@polkadot/types/interfaces';
|
||||
import type { PalletSocietyBid } from '@polkadot/types/lookup';
|
||||
|
||||
import React, { useRef } from 'react';
|
||||
|
||||
@ -18,7 +18,7 @@ interface Props {
|
||||
function Bids ({ className }: Props): React.ReactElement<Props> {
|
||||
const { t } = useTranslation();
|
||||
const { api } = useApi();
|
||||
const bids = useCall<Bid[]>(api.query.society.bids);
|
||||
const bids = useCall<PalletSocietyBid[]>(api.query.society.bids);
|
||||
|
||||
const headerRef = useRef([
|
||||
[t('bids'), 'start'],
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
// Copyright 2017-2021 @polkadot/app-society authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { AccountId, BalanceOf, BidKind } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, BalanceOf } from '@polkadot/types/interfaces';
|
||||
import type { PalletSocietyBidKind } from '@polkadot/types/lookup';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
@ -12,7 +13,7 @@ import BidType from '../Candidates/BidType';
|
||||
|
||||
interface Props {
|
||||
balance?: BalanceOf;
|
||||
bid?: BidKind;
|
||||
bid?: PalletSocietyBidKind;
|
||||
value: AccountId;
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Option, StorageKey } from '@polkadot/types';
|
||||
import type { AccountId, BalanceOf, BidKind } from '@polkadot/types/interfaces';
|
||||
import type { AccountId, BalanceOf } from '@polkadot/types/interfaces';
|
||||
import type { PalletSocietyBidKind } from '@polkadot/types/lookup';
|
||||
import type { ITuple } from '@polkadot/types/types';
|
||||
|
||||
import React, { useRef } from 'react';
|
||||
@ -20,11 +21,11 @@ interface Props {
|
||||
interface CandidateSuspend {
|
||||
accountId: AccountId;
|
||||
balance: BalanceOf;
|
||||
bid: BidKind;
|
||||
bid: PalletSocietyBidKind;
|
||||
}
|
||||
|
||||
const optExtractCandidates = {
|
||||
transform: (entries: [StorageKey<[AccountId]>, Option<ITuple<[BalanceOf, BidKind]>>][]): CandidateSuspend[] =>
|
||||
transform: (entries: [StorageKey<[AccountId]>, Option<ITuple<[BalanceOf, PalletSocietyBidKind]>>][]): CandidateSuspend[] =>
|
||||
entries
|
||||
.filter(([{ args: [accountId] }, opt]) => opt.isSome && accountId)
|
||||
.map(([{ args: [accountId] }, opt]) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user