-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
feat: Token Network Filter UI [Extension] #27884
feat: Token Network Filter UI [Extension] #27884
Conversation
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Demo of WIP: Screen.Recording.2024-10-17.at.7.43.44.AM.mov |
…g custom filter logic
…om:MetaMask/metamask-extension into feat/mmassets-432_network-filter-extension
Builds ready [441d4cf]
Page Load Metrics (2190 ± 100 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
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.
LGTM
…om:MetaMask/metamask-extension into feat/mmassets-432_network-filter-extension
…ld not break the app
Builds ready [cf78624]
Page Load Metrics (1824 ± 43 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [82255bc]
Page Load Metrics (1888 ± 101 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
const allNetworks = useSelector(getNetworkConfigurationsByChainId); | ||
const isTestnet = useSelector(getIsTestnet); | ||
const { tokenNetworkFilter, showNativeTokenAsMainBalance } = | ||
useSelector(getPreferences); |
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.
in the future , we can use this component somewhere else , like on this PR for example , my suggestion is to make it more generic.
same think for the popover
src={currentNetwork?.rpcPrefs?.imageUrl} | ||
/> | ||
</Box> | ||
</SelectableListItem> |
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 future improvement , we need to implement a storybook + unit test for this.
can you add a todo for that ?
{ name: 'Token4', symbol: 'T4', chainId: '0x89', balance: 150 }, | ||
]; | ||
|
||
test('filters by inclusive chainId', () => { |
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.
QQ: should we use it
by convention here ? most of tests are using it
but i'm wondering if we should respect this rule
Builds ready [d45f754]
Page Load Metrics (2079 ± 131 ms)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
Adds Token network filter controls. Note that this is not fully functional, and is currently blocked by two PRs before it can be fully integrated:
In the meantime, this PR is set behind a feature flag
FILTER_TOKENS_TOGGLE
and can be run as follows:FILTER_TOKENS_TOGGLE=1 yarn webpack --watch
Alternatively:
FILTER_TOKENS_TOGGLE=1 yarn start
Included in this PR:
tokenNetworkFilter
preference to PreferencesController to manage which chains should be considered when filtering tokens{ [chainId]: true) }
this is meant to be flexible enough to support multiple chains in the future.filterAssets
function in a similar style tosortAssets
it should be configuration based, and should be extensible enough to support filtering assets by deeply nested values (NFT traits), and to also support complex filter types (like price ranges).Not included in this PR:
Related issues
https://github.com/orgs/MetaMask/projects/85/views/35?pane=issue&itemId=82217837
https://consensyssoftware.atlassian.net/browse/MMASSETS-430
Manual testing steps
Token Filter selection should persist through refresh
Current chain balance should reflect the balance of the current chain
Should visibly match designs: https://www.figma.com/design/aMYisczaJyEsYl1TYdcPUL/Portfolio-View?node-id=5750-47217&node-type=canvas&t=EjOUPnqy7tWZE6sV-0
Screenshots/Recordings
Screen.Recording.2024-10-22.at.10.46.39.AM.mov
Pre-merge author checklist
Pre-merge reviewer checklist