From 708aa6cf95e36e036bb8de5594ea9da571d64c55 Mon Sep 17 00:00:00 2001 From: MiZiet <55240109+MiZiet@users.noreply.github.com> Date: Wed, 20 Jan 2021 15:33:23 +0100 Subject: [PATCH] Add tooltips for bounty status (#4450) * Add BountyStatusDisplay component * Implement help tooltip in BountyStatusDisplay * Add BountyStatusDisplay translations * Add styling to BountyStatusDisplay * Update translations * Add missing types * Add missing translation * Update local imports * Update local imports * Rename BountyStatusDisplay to BountyStatusView * Rewrite bounty status helpers * Add review suggestion * Change useMemo to useRef in BountyStatusView --- .../apps/public/locales/en/app-bounties.json | 6 ++ .../apps/public/locales/en/translation.json | 19 ++---- packages/page-bounties/src/Bounty.tsx | 18 ++---- .../page-bounties/src/BountyStatusView.tsx | 61 +++++++++++++++++++ .../page-bounties/src/VotingDescription.tsx | 8 +-- .../src/helpers/extendedStatuses.ts | 5 +- .../src/helpers/getBountyStatus.spec.ts | 4 +- .../src/helpers/getBountyStatus.ts | 8 +-- packages/page-bounties/src/helpers/index.tsx | 2 +- .../{truncateTitle.ts => stringHelpers.ts} | 4 ++ .../src/helpers/truncateTitle.spec.ts | 2 +- packages/page-bounties/src/types.ts | 7 ++- 12 files changed, 103 insertions(+), 41 deletions(-) create mode 100644 packages/page-bounties/src/BountyStatusView.tsx rename packages/page-bounties/src/helpers/{truncateTitle.ts => stringHelpers.ts} (71%) diff --git a/packages/apps/public/locales/en/app-bounties.json b/packages/apps/public/locales/en/app-bounties.json index 546a7f53ff..3a6d97efb7 100644 --- a/packages/apps/public/locales/en/app-bounties.json +++ b/packages/apps/public/locales/en/app-bounties.json @@ -3,6 +3,7 @@ "Accept": "Accept", "Account does not have enough funds.": "Account does not have enough funds.", "Add Bounty": "Add Bounty", + "After a bounty was proposed the council decides whether to fund it or not.": "After a bounty was proposed the council decides whether to fund it or not.", "Allocation value is smaller than the minimum bounty value.": "Allocation value is smaller than the minimum bounty value.", "Approval under voting": "Approval under voting", "Approve": "Approve", @@ -12,6 +13,7 @@ "Choose a curator whose background and expertise is such that they are capable of determining when the task is complete.": "Choose a curator whose background and expertise is such that they are capable of determining when the task is complete.", "Claim": "Claim", "Claimable": "Claimable", + "Curator has been proposed by council. The bounty is waiting for curator to accept the role.": "Curator has been proposed by council. The bounty is waiting for curator to accept the role.", "Curator under voting": "Curator under voting", "Curator's deposit": "Curator's deposit", "Curator's fee": "Curator's fee", @@ -43,6 +45,10 @@ "This action will create a Council motion to either approve or reject the Bounty.": "This action will create a Council motion to either approve or reject the Bounty.", "This action will extend expiry time of the selected bounty.": "This action will extend expiry time of the selected bounty.", "This amount will be reserved from origin account and returned on approval or slashed upon rejection.": "This amount will be reserved from origin account and returned on approval or slashed upon rejection.", + "This bounty has received approval and is currently being implemented.": "This bounty has received approval and is currently being implemented.", + "This bounty is approved and funded.": "This bounty is approved and funded.", + "This bounty was approved by the council. When next treasury spend period comes, it will get funded.": "This bounty was approved by the council. When next treasury spend period comes, it will get funded.", + "This bounty was completed and the beneficiary was awarded by the curator. Claiming the payout will be possible after delay has passed.": "This bounty was completed and the beneficiary was awarded by the curator. Claiming the payout will be possible after delay has passed.", "Title too long": "Title too long", "Unassign curator under voting": "Unassign curator under voting", "Value": "Value", diff --git a/packages/apps/public/locales/en/translation.json b/packages/apps/public/locales/en/translation.json index 1b97f5c4f2..63c214406b 100644 --- a/packages/apps/public/locales/en/translation.json +++ b/packages/apps/public/locales/en/translation.json @@ -9,13 +9,13 @@ "Add an existing contract": "", "Add proxy": "", "Address index {{index}}": "", + "After a bounty was proposed the council decides whether to fund it or not.": "", "All stashes": "", "All voters may alter their votes any number of times prior to the close of the poll.": "", "An account that is to receive the rewards": "", "Any combination of the four options may be approved of by the voter. There is no need to select only one option!": "", "Approval under voting": "", "Approving of all or none of the options is equivalent and will not affect the outcome of the poll.": "", - "Asset ID": "", "Authorize transaction": "", "Bond": "", "Cancel": "", @@ -30,6 +30,7 @@ "Contracts": "", "Controller account": "", "Create a backup file for this account": "", + "Curator has been proposed by council. The bounty is waiting for curator to accept the role.": "", "Curator under voting": "", "Curator's deposit": "", "Curator's fee": "", @@ -49,7 +50,6 @@ "Governance": "", "If you have not claimed rewards straight after the end of the era, the validator is in the active set and you are seeing no rewards, this would mean that the reward payout transaction was made by another account on your behalf. Always check your favorite explorer to see any historic payouts made to your accounts.": "", "Inactive": "", - "Info": "", "Initiate recovery for another": "", "Light theme (default)": "", "Locked funds (e.g. for staking) are counted.": "", @@ -66,7 +66,6 @@ "No change": "", "No change from the original 2017 sale definitions; will mean a total of 10 million DOT from genesis.": "", "No discretionary lock-voting is in place; all DOT used to vote counts the same.": "", - "No items": "", "No sub identities set.": "", "Nominating": "", "Nominators": "", @@ -82,7 +81,6 @@ "Retrieving nominators": "", "Retrieving validators": "", "Save": "", - "Select the account to use for this action.": "", "Set on-chain identity": "", "Set on-chain sub-identities": "", "Settings": "", @@ -98,7 +96,6 @@ "Split of 10x from the original sale; will mean a total of 100 million DOT from genesis. Apparent DOT price would be 10x lower and apparent account balances 10x higher.": "", "Stash account (do not increase the amount at stake)": "", "Stash account (increase the amount at stake)": "", - "Submit": "", "Submit (no signature)": "", "Swap to a non-executing approval type, with subsequent calls providing the actual call data.": "", "The account type (derivation) to use": "", @@ -123,6 +120,10 @@ "The sending account that will be used to send this transaction. Any applicable fees will be paid by this account.": "", "The signatory is one of the allowed accounts on the multisig, making a recorded approval for the transaction.": "", "The specified value is too large and does not allow funds to pay future transaction fees.": "", + "This bounty has received approval and is currently being implemented.": "", + "This bounty is approved and funded.": "", + "This bounty was approved by the council. When next treasury spend period comes, it will get funded.": "", + "This bounty was completed and the beneficiary was awarded by the curator. Claiming the payout will be possible after delay has passed.": "", "This could either be an approval for the hash or with full call details. The call as last approval triggers execution.": "", "This is a developer tool that allows you to execute selected snippets in a limited context.": "", "This is not a valid JSON object.": "", @@ -153,7 +154,6 @@ "activate": "", "address copied": "", "address index": "", - "address {{index}}": "", "available": "", "available to be unlocked": "", "aye": "", @@ -220,7 +220,6 @@ "overall/validator": "", "own": "", "own stake": "", - "paid": "", "parachain": "", "parachains": "", "parent": "", @@ -241,14 +240,12 @@ "recent blocks": "", "recently": "", "referenda": "", - "relay parent": "", "remaining": "", "reporters": "", "rewards": "", "role": "", "runners up": "", "scheduled": "", - "scheduling": "", "secret": "", "sending from my account": "", "signer": "", @@ -257,8 +254,6 @@ "state": "", "status": "", "strikes": "", - "sub name": "", - "swap to id": "", "tags": "", "the payment account": "", "threshold": "", @@ -274,7 +269,6 @@ "upcoming": "", "update due": "", "upgrade": "", - "using my account": "", "validation": "", "validator {{index}}": "", "validators": "", @@ -282,7 +276,6 @@ "vote using my account": "", "votes": "", "voting end": "", - "watermark": "", "yesterday": "", "{{balance}} voted": "", "{{count}} key/value pairs encoded for submission": "", diff --git a/packages/page-bounties/src/Bounty.tsx b/packages/page-bounties/src/Bounty.tsx index 737f5a51c1..bb7030c2de 100644 --- a/packages/page-bounties/src/Bounty.tsx +++ b/packages/page-bounties/src/Bounty.tsx @@ -13,9 +13,9 @@ import { BlockToTime, FormatBalance } from '@polkadot/react-query'; import { formatNumber } from '@polkadot/util'; import { BountyActions } from './BountyActions'; +import BountyStatusView from './BountyStatusView'; import { getBountyStatus, truncateTitle } from './helpers'; import { useTranslation } from './translate'; -import VotingDescription from './VotingDescription'; interface Props { bestNumber: BlockNumber; @@ -54,17 +54,11 @@ function Bounty ({ bestNumber, bounty, className = '', description, index, propo <>