Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Simplify error messages #2217

Merged
merged 2 commits into from
Jan 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/custom/pages/Claim/InvestmentFlow/InvestOption.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ import { ONE_HUNDRED_PERCENT, ZERO_PERCENT } from 'constants/misc'
import { PERCENTAGE_PRECISION } from 'constants/index'

enum ErrorMsgs {
Initial = 'Insufficient balance to cover the selected investment amount. Either modify the investment amount or unselect the investment option to move forward',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to tells users that they can either modify OR unselect it, which can only be done in the first screen.

Also, you can't change the amount when claiming for someone else, we should distinguish that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to tells users that they can either modify OR unselect it, which can only be done in the first screen.
Also, you can't change the amount when claiming for someone else, we should distinguish that

My thinking is that messages should be shorter and Insufficient balance to cover investment amount works for 100% investments where you don't have enough tokens, or for self claiming.

I'll ask for suggestions, not too strongly opinionated so happy to go either way as long as we keep it short.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

short is fine by me

Balance = 'Insufficient balance to cover the selected investment amount, please modify the selected amount to move forward',
MaxCost = 'Selected amount is higher than available investment amount, please modify the input amount to move forward',
InsufficientBalance = 'Insufficient balance to cover the investment',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the investment sounds weird, I would say:

Suggested change
InsufficientBalance = 'Insufficient balance to cover the investment',
InsufficientBalance = 'Insufficient balance to cover investment amount',

SurplusMaxInvestment = `Your investment amount can't be above the maximum investment allowed`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surplus means something different to me. What about OverMaxInvestment

}

export default function InvestOption({ approveData, claim, optionIndex }: InvestOptionProps) {
Expand Down Expand Up @@ -82,8 +81,8 @@ export default function InvestOption({ approveData, claim, optionIndex }: Invest

let errorMsg = null

if (parsedAmount.greaterThan(maxCost)) errorMsg = ErrorMsgs.MaxCost
else if (parsedAmount.greaterThan(balance)) errorMsg = ErrorMsgs.Balance
if (parsedAmount.greaterThan(maxCost)) errorMsg = ErrorMsgs.SurplusMaxInvestment
else if (parsedAmount.greaterThan(balance)) errorMsg = ErrorMsgs.InsufficientBalance

if (errorMsg) {
setInputError(errorMsg)
Expand Down Expand Up @@ -142,7 +141,7 @@ export default function InvestOption({ approveData, claim, optionIndex }: Invest
}

if (balance.lessThan(maxCost)) {
setInputError(ErrorMsgs.Initial)
setInputError(ErrorMsgs.InsufficientBalance)
} else {
setMaxAmount()
}
Expand Down