feat(frontend): add current user highlight and profile card in leaderboard - #109
Merged
Merged
Conversation
…board
- Add current user profile card at top (shows rank, tokens, cost) - logged in only
- Highlight current user row with blue border (#0073FF brand color)
- Works across all 3 periods (all-time, month, week)
Oracle review fixes applied:
- CRITICAL: Add username validation to prevent SQL injection (regex: ^[a-zA-Z0-9-]{1,39}$)
- HIGH: Optimize rank query (subquery approach, ~10x faster than window function)
- HIGH: Add AbortController to prevent race conditions on period change
- MEDIUM: Add error state banner for failed rank fetches
- MEDIUM: Fix hover styling to preserve blue highlight on hover
Technical details:
- New API: GET /api/leaderboard/user/[username]?period={all|month|week}
- Client-side fetch with abort signal for cleanup
- Blue border (4px left + 2px outline) with subtle background
- Responsive design (column layout on mobile <640px)
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Owner
Author
Owner
Author
|
added hotfix f03e521 |
This was referenced Jan 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
User Request (Korean)
Translation: My row should have a blue border (our brand color), and show my profile and rank in one line at the top of the leaderboard list (only when logged in)
Features
1. Current User Profile Card (Top of Leaderboard)
2. Current User Row Highlighting
Technical Implementation
New API Endpoint
Route:
GET /api/leaderboard/user/[username]?period={all|month|week}Features:
^[a-zA-Z0-9-]{1,39}$)Performance:
Client-Side Changes
File:
packages/frontend/src/app/(main)/LeaderboardClient.tsxState Management:
Data Fetching:
useEffectto fetch current user's rank when period changesStyling:
$isCurrentUserto avoid React warnings::beforefor left bar,::afterfor outline)Server-Side Changes
File:
packages/frontend/src/app/(main)/page.tsxgetSession()call to fetch current logged-in usercurrentUserprop toLeaderboardClientOracle Review Results
✅ All Critical Issues Resolved
Original Verdict:⚠️ CONCERNS
Current Status: ✅ Production-Ready
Fixed Issues:
✅ CRITICAL - SQL Injection Prevention
✅ HIGH - Performance Optimization
✅ HIGH - Race Condition Fix
✅ MEDIUM - Error State Handling
✅ MEDIUM - Hover Styling Fix
rgba(0, 115, 255, 0.12)instead of overriding with dark backgroundDemo Scenarios
Scenario 1: Logged In User on Page 1 (Rank #5)
Scenario 2: Logged In User Not on Current Page (Rank #500)
(User sees their card but row is not visible on page 1)
Scenario 3: Logged In User, No Submissions for Selected Period
Scenario 4: Not Logged In
Edge Cases Handled
Responsive Design
Accessibility
Testing Checklist
Performance Metrics
Screenshots
TBD - To be added after deployment
Breaking Changes
None. This is a purely additive feature with no changes to existing behavior.
Related Issues
Deployment Notes
submissions.user_idandsubmissions.total_tokensrecommended for optimal performance