Skip to content

feat: support prime leaderboard user rank card#5638

Open
cuzz-venus wants to merge 5 commits into
feat/prime-last-cycle-summaryfrom
feat/prime-rank-card
Open

feat: support prime leaderboard user rank card#5638
cuzz-venus wants to merge 5 commits into
feat/prime-last-cycle-summaryfrom
feat/prime-rank-card

Conversation

@cuzz-venus

@cuzz-venus cuzz-venus commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Jira ticket(s)

VPD-1332

Changes

  • Adds the Prime Leaderboard user rank card (rank, Prime score, eligibility), the Rules modal, and the Stake XVS flow that reuses the shared VenusVaultModal with a Prime rank footer.
image image image

@changeset-bot

changeset-bot Bot commented Jun 16, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0f43b3e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel

vercel Bot commented Jun 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dapp-preview Ready Ready Preview Jun 17, 2026 11:46am
dapp-testnet Ready Ready Preview Jun 17, 2026 11:46am
venus.io Ready Ready Preview Jun 17, 2026 11:46am

Request Review

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds the Prime Leaderboard user rank card, including a connected/disconnected state, eligibility messaging, a Rules modal, and a "Stake XVS" flow that reuses the shared VenusVaultModal with an injected Prime rank footer. VenusVaultModal is also promoted from a VaultCard-private sub-module to a top-level container so it can be shared.

  • Rank card UI with RankSummary, EligibilityStatus, and RankActions sub-components; all driven by useGetPrimeRank, which currently returns hardcoded placeholder data pending API integration (confirmed intentional testnet mock data per prior thread).
  • VenusVaultModal refactored to a shared container and extended with hidePrimeLeaderboardLink so the stake modal opened from the leaderboard page suppresses the redundant leaderboard link in its footer.
  • All new strings are fully translated across all 7 supported locales; i18n key/component mappings are consistent.

Confidence Score: 5/5

Safe to merge — all new UI is behind the existing primeLeaderboard feature flag and the hardcoded placeholder data is intentional for testnet.

All changes are additive and feature-flagged. The hardcoded placeholder data in useGetPrimeRank (rank, score, eligibility) was confirmed as intentional testnet mock data in a prior thread. No real user balances or transactions are affected by the placeholder values. The VenusVaultModal refactor is a pure rename/move with no behavioural change. Tests cover the new components, and i18n strings are complete and consistent across all seven locales.

apps/evm/src/containers/PrimeRank/useGetPrimeRank/index.ts — contains hardcoded placeholder values that will need to be replaced with real API data before the feature goes live on mainnet.

Important Files Changed

Filename Overview
apps/evm/src/containers/PrimeRank/useGetPrimeRank/index.ts New hook that returns entirely hardcoded placeholder rank data (rank 2, score 542.5M, eligible) — all real data paths are pending an API integration TODO.
apps/evm/src/containers/VenusVaultModal/StakeForm/index.tsx Adds Prime rank footer below existing vault earnings footer when primeLeaderboard feature flag is on and the vault is GOVERNANCE category; feature-gated correctly.
apps/evm/src/containers/VenusVaultModal/index.tsx Promoted from VaultCard sub-module to a top-level container; adds hidePrimeLeaderboardLink prop threaded down to StakeForm.
apps/evm/src/pages/PrimeLeaderboard/StakeXvsModal/index.tsx Wraps VenusVaultModal for the leaderboard Stake XVS action; returns null during vault data loading (no spinner shown), which was flagged in a prior review thread (developer noted this is testnet mock data).
apps/evm/src/pages/PrimeLeaderboard/RankCard/index.tsx Replaced placeholder 'Rank Card' stub with full connected/disconnected rank card UI; delegates sub-sections to RankSummary, EligibilityStatus, and RankActions.
apps/evm/src/pages/PrimeLeaderboard/RulesModal/index.tsx New modal explaining Prime scoring rules with a hardcoded BOOST_TIERS table and i18n'd content; clean implementation.
apps/evm/src/pages/PrimeLeaderboard/RankSection/index.tsx Thin container that wires useGetPrimeRank and wallet connection into RankCard; straightforward.
apps/evm/src/libs/translations/translations/en.json Adds rankCard, rankFooter, and rulesModal translation keys; all interpolation variables and Trans component keys are consistent with their consuming components.

Reviews (3): Last reviewed commit: "feat: support prime rank card" | Re-trigger Greptile

Comment on lines +16 to +20
| undefined;

if (!xvsVault) {
return null;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Silent null return during vault data loading

When a user clicks "Stake XVS" before useGetVaults has finished fetching (e.g., on initial page load), vaults will be an empty array and xvsVault will be undefined. The component returns null, so VenusVaultModal is never rendered — the modal simply doesn't appear with no loading indicator or error feedback. Consider rendering a loading spinner (or keeping the VenusVaultModal with a skeleton) while the vault data is in flight so users understand the action was registered.

Comment on lines +12 to +22
const placeholderRankData: PrimeRankData = {
hasStakedXvs: true,
isCandidate: true,
isPrime: true,
hasSupplied: true,
rank: 2,
primeScore: 542_500_000,
gapXvsTokens: 5_432,
};

export const useGetPrimeRank = (): PrimeRankData => placeholderRankData;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Hardcoded placeholder visible to all connected users

Every connected user who visits the Prime Leaderboard will see rank #2, score 542.5M, and the congratulatory "Congrats! You're in the Top 500 during last cycle and qualified for Prime Rewards." message because isPrime: true, hasSupplied: true, and isCandidate: true are hardcoded. This data feeds into both RankSection (the leaderboard page card) and the Footer shown inside the VenusVaultModal stake tab (when primeLeaderboard feature flag is on). If the feature flag for the page or the modal footer is enabled before the API integration lands, users will see completely incorrect eligibility status and rank numbers.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

mock data for testnet

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./apps/evm

Status Category Percentage Covered / Total
🔵 Lines 81.79% 48502 / 59296
🔵 Statements 81.79% 48502 / 59296
🔵 Functions 62.41% 671 / 1075
🔵 Branches 72.87% 5484 / 7525
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/evm/src/components/Icon/icons/barChart.tsx 100% 50% 100% 100%
apps/evm/src/components/Icon/icons/graduationCap.tsx 100% 50% 100% 100%
apps/evm/src/components/Icon/icons/index.ts 99.04% 0% 100% 99.04% 1
apps/evm/src/containers/PrimeRank/EligibilityStatus/index.tsx 100% 88.88% 100% 100%
apps/evm/src/containers/PrimeRank/Footer/index.tsx 100% 0% 100% 100%
apps/evm/src/containers/PrimeRank/getRankLabels/index.ts 91.66% 0% 100% 91.66% 1
apps/evm/src/containers/PrimeRank/useGetPrimeRank/index.ts 100% 0% 100% 100%
apps/evm/src/containers/VaultCard/index.tsx 76.68% 69.76% 0% 76.68% 52-56, 59-61, 65, 94-96, 120-139, 210-227, 256-261, 267-270
apps/evm/src/containers/VaultCard/Simplified/index.tsx 91.39% 0% 0% 91.39% 46, 88, 90-95
apps/evm/src/pages/PrimeLeaderboard/index.tsx 100% 60% 100% 100%
apps/evm/src/pages/PrimeLeaderboard/RankCard/index.tsx 100% 0% 100% 100%
apps/evm/src/pages/PrimeLeaderboard/RankCard/ConnectPrompt/index.tsx 100% 0% 100% 100%
apps/evm/src/pages/PrimeLeaderboard/RankCard/RankActions/index.tsx 100% 0% 0% 100%
apps/evm/src/pages/PrimeLeaderboard/RankCard/RankSummary/index.tsx 100% 0% 100% 100%
apps/evm/src/pages/PrimeLeaderboard/RankSection/index.tsx 93.33% 0% 0% 93.33% 19
apps/evm/src/pages/PrimeLeaderboard/RulesModal/constants.ts 100% 0% 100% 100%
apps/evm/src/pages/PrimeLeaderboard/RulesModal/index.tsx 100% 50% 100% 100%
apps/evm/src/pages/PrimeLeaderboard/StakeXvsModal/index.tsx 100% 33.33% 100% 100%
Generated in workflow #13661 for commit 0f43b3e by the Vitest Coverage Report Action

@cuzz-venus

Copy link
Copy Markdown
Contributor Author

@greptile review again

1 similar comment
@cuzz-venus

Copy link
Copy Markdown
Contributor Author

@greptile review again

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.

1 participant