From 862f06cfa8684a5c1e6a3744e64cb2ec80b9561d Mon Sep 17 00:00:00 2001 From: Jaco Date: Sun, 24 Oct 2021 16:04:07 +0200 Subject: [PATCH] Hide society unbid for vouch (#6396) * Hide society unbid for vouch * Linting --- packages/page-society/src/Candidates/Bid.tsx | 22 ++++++++++--------- .../page-society/src/Candidates/BidType.tsx | 4 ++-- packages/page-society/src/Candidates/Bids.tsx | 4 ++-- .../page-society/src/Suspended/Suspension.tsx | 5 +++-- packages/page-society/src/Suspended/index.tsx | 7 +++--- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/packages/page-society/src/Candidates/Bid.tsx b/packages/page-society/src/Candidates/Bid.tsx index e099987b39..a35823ee75 100644 --- a/packages/page-society/src/Candidates/Bid.tsx +++ b/packages/page-society/src/Candidates/Bid.tsx @@ -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 { @@ -41,14 +41,16 @@ function BidRow ({ index, value: { kind, value, who } }: Props): React.ReactElem - ('Unbid')} - params={[index]} - tx={api.tx.society.unbid} - /> + {!kind.isVouch && ( + ('Unbid')} + params={[index]} + tx={api.tx.society.unbid} + /> + )} ); diff --git a/packages/page-society/src/Candidates/BidType.tsx b/packages/page-society/src/Candidates/BidType.tsx index 48efed7ebd..71425457ac 100644 --- a/packages/page-society/src/Candidates/BidType.tsx +++ b/packages/page-society/src/Candidates/BidType.tsx @@ -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 { diff --git a/packages/page-society/src/Candidates/Bids.tsx b/packages/page-society/src/Candidates/Bids.tsx index f58ee0b57d..edd71cfaed 100644 --- a/packages/page-society/src/Candidates/Bids.tsx +++ b/packages/page-society/src/Candidates/Bids.tsx @@ -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 { const { t } = useTranslation(); const { api } = useApi(); - const bids = useCall(api.query.society.bids); + const bids = useCall(api.query.society.bids); const headerRef = useRef([ [t('bids'), 'start'], diff --git a/packages/page-society/src/Suspended/Suspension.tsx b/packages/page-society/src/Suspended/Suspension.tsx index bc54d057cc..b6c33d2514 100644 --- a/packages/page-society/src/Suspended/Suspension.tsx +++ b/packages/page-society/src/Suspended/Suspension.tsx @@ -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; } diff --git a/packages/page-society/src/Suspended/index.tsx b/packages/page-society/src/Suspended/index.tsx index 5602bb9df2..3840caa866 100644 --- a/packages/page-society/src/Suspended/index.tsx +++ b/packages/page-society/src/Suspended/index.tsx @@ -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>][]): CandidateSuspend[] => + transform: (entries: [StorageKey<[AccountId]>, Option>][]): CandidateSuspend[] => entries .filter(([{ args: [accountId] }, opt]) => opt.isSome && accountId) .map(([{ args: [accountId] }, opt]) => {