diff --git a/packages/apps/public/locales/en/app-bounties.json b/packages/apps/public/locales/en/app-bounties.json
index d8ab21f000..6327266528 100644
--- a/packages/apps/public/locales/en/app-bounties.json
+++ b/packages/apps/public/locales/en/app-bounties.json
@@ -1,4 +1,5 @@
{
+ "Accept": "Accept",
"Account does not have enough funds.": "Account does not have enough funds.",
"Add Bounty": "Add Bounty",
"Allocation value is smaller than the minimum bounty value.": "Allocation value is smaller than the minimum bounty value.",
@@ -6,7 +7,7 @@
"Bond is estimated based on bountyDepositBase and dataDepositPerByte constants.": "Bond is estimated based on bountyDepositBase and dataDepositPerByte constants.",
"Bounties": "Bounties",
"Calculated bond for bounty": "Calculated bond for bounty",
- "Claim Bounty": "Claim Bounty",
+ "Claim": "Claim",
"Claimable": "Claimable",
"Curators deposit": "Curators deposit",
"Curators fee": "Curators fee",
@@ -15,6 +16,7 @@
"No open bounties": "No open bounties",
"Proposer": "Proposer",
"Proposer bond depends on bounty title length.": "Proposer bond depends on bounty title length.",
+ "Reject": "Reject",
"Select the account you wish to propose the bounty from.": "Select the account you wish to propose the bounty from.",
"The description of this bounty": "The description of this bounty",
"The total payment amount of this bounty, curators fee included.": "The total payment amount of this bounty, curators fee included.",
diff --git a/packages/page-bounties/src/Bounty.tsx b/packages/page-bounties/src/Bounty.tsx
index 79d11fde43..e56618be75 100644
--- a/packages/page-bounties/src/Bounty.tsx
+++ b/packages/page-bounties/src/Bounty.tsx
@@ -11,7 +11,7 @@ import { AddressSmall, Icon, LinkExternal } from '@polkadot/react-components';
import { BlockToTime, FormatBalance } from '@polkadot/react-query';
import { formatNumber } from '@polkadot/util';
-import BountyClaim from './BountyClaim';
+import { BountyActions } from './BountyActions';
import { getBountyStatus } from './helpers';
import { useTranslation } from './translate';
@@ -58,13 +58,11 @@ function Bounty ({ bestNumber, bounty, className = '', description, index }: Pro
{beneficiary ? : EMPTY_CELL} |
|
- {beneficiary && blocksUntilPayout && (
-
- )}
+
|
getBountyStatus(status), [status]);
+
+ const { beneficiary, curator, unlockAt } = updateStatus();
+
+ const blocksUntilPayout = useMemo(() => unlockAt?.sub(bestNumber), [bestNumber, unlockAt]);
+
+ return (
+ <>
+ {status.isCuratorProposed && curator &&
+ }
+ {status.isPendingPayout && beneficiary && blocksUntilPayout &&
+ }
+ >
+ );
+}
diff --git a/packages/page-bounties/src/BountyClaim.tsx b/packages/page-bounties/src/BountyClaimAction.tsx
similarity index 79%
rename from packages/page-bounties/src/BountyClaim.tsx
rename to packages/page-bounties/src/BountyClaimAction.tsx
index b7064fed21..c218ddf163 100644
--- a/packages/page-bounties/src/BountyClaim.tsx
+++ b/packages/page-bounties/src/BountyClaimAction.tsx
@@ -18,22 +18,22 @@ interface Props {
payoutDue: BN;
}
-function BountyClaim ({ beneficiaryId, index, payoutDue }: Props) {
+function BountyClaimAction ({ beneficiaryId, index, payoutDue }: Props) {
const { t } = useTranslation();
const { api } = useApi();
- const { allAccounts, hasAccounts } = useAccounts();
+ const { allAccounts } = useAccounts();
const isBountyClaimable = useMemo(
() => isClaimable(allAccounts, beneficiaryId, payoutDue),
[allAccounts, beneficiaryId, payoutDue]
);
- return hasAccounts && isBountyClaimable
+ return isBountyClaimable
? (
('Claim Bounty')}
+ label={t('Claim')}
params={[index]}
tx={(api.tx.bounties || api.tx.treasury).claimBounty}
/>
@@ -41,4 +41,4 @@ function BountyClaim ({ beneficiaryId, index, payoutDue }: Props) {
: null;
}
-export default React.memo(BountyClaim);
+export default React.memo(BountyClaimAction);
diff --git a/packages/page-bounties/src/BountyCuratorProposedActions.tsx b/packages/page-bounties/src/BountyCuratorProposedActions.tsx
new file mode 100644
index 0000000000..bb413c4b99
--- /dev/null
+++ b/packages/page-bounties/src/BountyCuratorProposedActions.tsx
@@ -0,0 +1,47 @@
+// Copyright 2017-2020 @polkadot/app-bounties authors & contributors
+// SPDX-License-Identifier: Apache-2.0
+
+import type { AccountId } from '@polkadot/types/interfaces';
+
+import React, { useMemo } from 'react';
+
+import { TxButton } from '@polkadot/react-components';
+import { useAccounts, useApi } from '@polkadot/react-hooks';
+
+import { useTranslation } from './translate';
+
+interface Props {
+ curatorId: AccountId;
+ index: number;
+}
+
+function BountyCuratorProposedActions ({ curatorId, index }: Props) {
+ const { t } = useTranslation();
+ const { api } = useApi();
+ const { allAccounts } = useAccounts();
+
+ const isCurator = useMemo(() => allAccounts.includes(curatorId.toString()), [allAccounts, curatorId]);
+
+ return isCurator
+ ? (
+ <>
+ ('Accept')}
+ params={[index]}
+ tx={(api.tx.bounties || api.tx.treasury).acceptCurator}
+ />
+ ('Reject')}
+ params={[index]}
+ tx={(api.tx.bounties || api.tx.treasury).unassignCurator}
+ />
+ >
+ )
+ : null;
+}
+
+export default React.memo(BountyCuratorProposedActions);
|