-
Notifications
You must be signed in to change notification settings - Fork 473
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
[Spam tokens] manually hide tokens #1377
Conversation
Branch preview✅ Deploy successful! https://spam_tokens_manually_hide--webcore.review-web-core.5afe.dev |
ESLint Summary View Full Report
Report generated by eslint-plus-action |
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.
I would suggest rethinking the terminology. E.g. UserTokenBlocklist instead of HiddenAssets.
- remove SelectDialog => add ToggleButton - change icon order for hiding / unhiding - improve sticky TokenMenu positioning - make buttons the same size in TokenMenu
- Moves hiddenAssetsSlice into settingsSlice - renames variables / hooks - moves TokenMenu inside of AssetsTable - adjusts tests
ESLint Summary View Full Report
Report generated by eslint-plus-action |
- show text in toggle button instead of tooltip - rename TokenListSelect to HiddenTokenToggle - increase size of hide token / show token button in assetTable
- click on IconButton immediately hides token with collapse animation - rename apply -> save - header button will only open menu but not toggle it - in hide token menu all tokens are shown, not just the hidden ones - checkboxes when in hide token menu instead of eye-icon - add Deselect all button
- New property collapsed for rows of EnhancedTable - collapsed rows will be collapsed by wrapping it's Cells in Collapse - fixes tests
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.
As you TODO says, there's a lot of new logic inside the AssetsTable that would be good to extract into a module dedicated to token hiding.
- reverts useBalances changes - adds useVisibleBalance - does not change the fiatTotal anymore - hidden balances only have an effect on AssetTable, Asset Autocompletions is SendAssetForm and SpendingLimitForm
src/hooks/useVisibleBalances.ts
Outdated
return { | ||
...balances, | ||
balances: { | ||
items: items.filter((item) => !hiddenTokens.includes(item.tokenInfo.address)), | ||
fiatTotal, | ||
}, |
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.
Bear in mind this will filter the list and create a new object on each render. Would be good to memo it.
import { useCallback, useState } from 'react' | ||
|
||
// This is the default for MUI Collapse | ||
export const COLLAPSE_TIMEOUT_MS = 300 |
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.
No need to export it, it's used in the same module.
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 test is using it.
There is some overlap/spacing issues on smaller screens. Do we have mobile designs? cc @liliiaorlenko |
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.
Looks good from my side, apart from the remaining comments.
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.
👍
- adjusts total balance in useVisibleBalances() - uses useVisibleBalances in Overview and SidebarHeader - hides "Hide Tokens" button in mobile - moves analytics into useMetaEvents
ESLint Summary View Full Report
Report generated by eslint-plus-action |
Hey @francovenica I addresses most issues:
For the questions:
|
Yes, all the issues were addressed. The GTM calls are also working fine (not 10 calls just by refreshing the page anymore) |
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.
Looks good!
Btw according to the SafeBalanceResponse type, items
and fiatTotal
are the only fields in this object, so you don't need the ...balances
.
@katspaugh {
balances: SafeBalanceResponse
loading: boolean
error?: string
} So I spread to use the |
What it solves
Unwanted / spam tokens could not be hidden from the interface.
Resolves #1337
How this PR fixes it
useBalances
to get all or only not hidden tokensHow to test it
getBalance
Analytics changes
Screenshots