From 5a5b23dcaaa0a103a33563da45e54221567fb52e Mon Sep 17 00:00:00 2001 From: Harshal Dulera Date: Sat, 7 Dec 2024 17:19:11 +0530 Subject: [PATCH] feat: implement custom scrollbar styling for leaderboard --- packages/nextjs/app/leaderboard/page.tsx | 48 +++++++++++------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/packages/nextjs/app/leaderboard/page.tsx b/packages/nextjs/app/leaderboard/page.tsx index eaf9c0b..2b6fbf5 100644 --- a/packages/nextjs/app/leaderboard/page.tsx +++ b/packages/nextjs/app/leaderboard/page.tsx @@ -11,13 +11,25 @@ interface LeaderboardEntry { } export default function Leaderboard() { - // Extended sample data for scrolling - const leaderboardData: LeaderboardEntry[] = Array.from({ length: 50 }, (_, i) => ({ - rank: i + 1, - address: `0x${Math.random().toString(16).slice(2, 6)}...${Math.random().toString(16).slice(2, 6)}`, - score: Math.floor(1500 - (i * 20) + Math.random() * 10), - eth: Number((2.5 - (i * 0.05) + Math.random() * 0.1).toFixed(2)), - })); + // Static sample data + const leaderboardData: LeaderboardEntry[] = [ + { rank: 1, address: "0x1234...5678", score: 1500, eth: 2.50 }, + { rank: 2, address: "0x8765...4321", score: 1450, eth: 2.45 }, + { rank: 3, address: "0x9876...1234", score: 1400, eth: 2.40 }, + { rank: 4, address: "0x5432...8765", score: 1350, eth: 2.35 }, + { rank: 5, address: "0x2468...1357", score: 1300, eth: 2.30 }, + ]; + + // Generate additional entries with predictable values + const extendedData = [...leaderboardData]; + for (let i = leaderboardData.length + 1; i <= 50; i++) { + extendedData.push({ + rank: i, + address: `0x${i.toString().padStart(4, '0')}...${(1000 - i).toString().padStart(4, '0')}`, + score: Math.max(0, 1500 - (i * 20)), + eth: Number((2.5 - (i * 0.05)).toFixed(2)) + }); + } return (
@@ -47,7 +59,7 @@ export default function Leaderboard() { {/* Scrollable Content */}
- {leaderboardData.map((entry, index) => ( + {extendedData.map((entry, index) => (
- {entry.score} + {entry.score}
{entry.eth} ETH @@ -88,24 +100,6 @@ export default function Leaderboard() {
- - {/* Fixed Stats Section */} -
-
-
-

100+

-

Total Stakers

-
-
-

50 ETH

-

Total Staked

-
-
-

10%

-

APY

-
-
-
); } \ No newline at end of file