Skip to content

feat(tokens): sort tokens by USD balance and launchpad ordering#7746

Open
yhabib wants to merge 10 commits intomainfrom
nns1-4333/tokens-page
Open

feat(tokens): sort tokens by USD balance and launchpad ordering#7746
yhabib wants to merge 10 commits intomainfrom
nns1-4333/tokens-page

Conversation

@yhabib
Copy link
Contributor

@yhabib yhabib commented Feb 26, 2026

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

  • Added compareTokensByUniverseOrder to tokens-table.utils.ts.
  • Made compareTokensByProject, compareTokensByBalance, and compareTokensForTokensTable accept a universeOrder parameter and use it as tiebreaker.
  • Added universeOrder prop to TokensTable and Tokens components, sourced from selectableUniversesStore in the tokens route.
  • Removed "title" from the default tokensTableOrderStore, keeping only "balance".

@yhabib yhabib requested a review from Copilot February 26, 2026 05:20
@yhabib yhabib changed the title mig feat(tokens): sort tokens by USD balance and launchpad ordering Feb 26, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 universeOrder parameter 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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same logic as for the staking table

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yhabib yhabib force-pushed the nns1-4333/stakings-page branch 2 times, most recently from d2dc412 to 4c3fab2 Compare February 26, 2026 11:56
Base automatically changed from nns1-4333/stakings-page to main February 26, 2026 12:14
@yhabib yhabib force-pushed the nns1-4333/tokens-page branch from 9fac78e to 6769374 Compare February 27, 2026 08:11
@yhabib yhabib requested a review from Copilot February 27, 2026 12:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yhabib yhabib marked this pull request as ready for review February 27, 2026 13:55
@yhabib yhabib requested a review from a team as a code owner February 27, 2026 13:55
@yhabib yhabib force-pushed the nns1-4333/tokens-page branch from e3fd9a3 to 99fe45d Compare February 27, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants