This repository has been archived by the owner on Jun 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Simplify error messages #2217
Merged
Merged
Simplify error messages #2217
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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', | ||||||
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', | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
SurplusMaxInvestment = `Your investment amount can't be above the maximum investment allowed`, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surplus means something different to me. What about |
||||||
} | ||||||
|
||||||
export default function InvestOption({ approveData, claim, optionIndex }: InvestOptionProps) { | ||||||
|
@@ -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) | ||||||
|
@@ -142,7 +141,7 @@ export default function InvestOption({ approveData, claim, optionIndex }: Invest | |||||
} | ||||||
|
||||||
if (balance.lessThan(maxCost)) { | ||||||
setInputError(ErrorMsgs.Initial) | ||||||
setInputError(ErrorMsgs.InsufficientBalance) | ||||||
} else { | ||||||
setMaxAmount() | ||||||
} | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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