feat(tokens): sort tokens by USD balance and launchpad ordering#7746
feat(tokens): sort tokens by USD balance and launchpad ordering#7746
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces universe-based ordering for token sorting in the tokens table. The "mig" title suggests this may be part of a migration, though the minimal PR description doesn't provide context. The changes modify the token sorting logic to incorporate a new universeOrder parameter throughout the sorting stack and removes the "title" column from the default sort order.
Changes:
- Added
universeOrderparameter to token sorting functions to enable custom universe-based ordering - Removed "title" column from default tokens table sort order, leaving only "balance"
- Updated all token sorting comparators to incorporate universe order as a tiebreaker
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
frontend/src/lib/utils/tokens-table.utils.ts |
Implemented compareTokensByUniverseOrder function and added universeOrder parameter to compareTokensByProject, compareTokensByBalance, and compareTokensForTokensTable |
frontend/src/lib/stores/tokens-table.store.ts |
Removed "title" column from default table order array |
frontend/src/lib/components/tokens/TokensTable/TokensTable.svelte |
Added universeOrder prop and passed it to sorting comparators |
frontend/src/lib/pages/Tokens.svelte |
Added universeOrder prop and passed it down to all TokensTable instances |
frontend/src/routes/(app)/(nns)/tokens/+page.svelte |
Computed universeOrder from selectableUniversesStore and passed it to sorting functions and Tokens component |
frontend/src/tests/lib/utils/tokens-table.utils.spec.ts |
Updated tests to call compareTokensByProject with empty universeOrder array and added universeOrder parameter to test expectations |
frontend/src/tests/lib/stores/tokens-table.store.spec.ts |
Removed "title" column from expected default order in tests |
frontend/src/tests/lib/pages/Tokens.spec.ts |
Removed "title" column from expected default order in tests |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| templateColumns: ["1fr"], | ||
| comparator: enableSorting ? compareTokensByProject : undefined, | ||
| comparator: enableSorting | ||
| ? compareTokensByProject(universeOrder) |
There was a problem hiding this comment.
same logic as for the staking table
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d2dc412 to
4c3fab2
Compare
9fac78e to
6769374
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e3fd9a3 to
99fe45d
Compare
Motivation
The tokens page sorted SNS projects alphabetically as a tiebreaker. It should use the launchpad ordering (featured, market cap, activity, treasury) instead, consistent with the staking and proposals pages.
Changes
compareTokensByUniverseOrdertotokens-table.utils.ts.compareTokensByProject,compareTokensByBalance, andcompareTokensForTokensTableaccept auniverseOrderparameter and use it as tiebreaker.universeOrderprop toTokensTableandTokenscomponents, sourced fromselectableUniversesStorein the tokens route."title"from the defaulttokensTableOrderStore, keeping only"balance".