-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable import button on maximum #5557
base: main
Are you sure you want to change the base?
Conversation
frontend/src/lib/i18n/en.json
Outdated
@@ -1061,6 +1061,7 @@ | |||
"link_to_dashboard": "https://dashboard.internetcomputer.org/canister/$canisterId", | |||
"add_index_canister": "Add Index Canister", | |||
"add_index_description": "Transaction history is not available. To see this token’s transaction history in the NNS dapp, you need to provide an index canister. <strong>Note:</strong> not all tokens have index canisters.", | |||
"failed_tooltip": "The NNS dapp couldn’t load an imported token. Please try again later, or contact the developers." | |||
"failed_tooltip": "The NNS dapp couldn’t load an imported token. Please try again later, or contact the developers.", | |||
"maximum_reached_tooltip": "You can import maximum $max tokens." |
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.
How about "You've already imported the maximum number of $max tokens. You need to remove another token before you can import more."
?
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.
Thanks, updated to "You can import maximum $max tokens. You need to remove a token before you can import more."
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.
The main reason I suggested a different message is because "You can import maximum $max tokens." is not grammatically correct English. If you want to keep it as close as possible to the original, it should at least be "You can import a maximum of $max tokens."
I suggested something longer because I thought it would be more helpful and natural. But mostly I don't want it to be broken English.
frontend/src/lib/pages/Tokens.svelte
Outdated
> | ||
<IconPlus />{$i18n.import_token.import_token} | ||
</button> | ||
{#if maximumImportedTokensReached} |
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.
You don't need an if/else
with the button element in both cases.
The Tooltip
is automatically disabled if the text
attribute is empty or absent.
So you can just only pass the text
attribute if the maximum is reached.
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.
Thanks, didn't know about the text attribute. Done.
|
||
setImportedTokens(MAX_IMPORTED_TOKENS - 1); | ||
const po = renderPage([]); | ||
|
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.
Add await runResolvedPromises();
here as well for consistency to make sure that's not the only reason why the expectations below are different.
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.
Why not. Done.
Motivation
Due to backend validation, it is currently not possible to import more than 20 tokens. To improve the user experience, we disable the import button when the user has already imported the maximum number of custom tokens.
Changes
Tests
Todos
Not necessary.