Feat/comparison circle and peers bookmarking together - #96
Open
Vandan647 wants to merge 2 commits into
Open
Conversation
- Add ⭐ Peers tab to student dashboard - Search any student by name via /api/search - Star/bookmark peers for quick access (persisted in localStorage) - Side-by-side comparison modal: SP balance, rank, level, league - Starred peers section for fast access without re-searching - Visual win/lose indicators in the comparison view - Fully responsive layout for mobile
Adds a private Comparison Circle feature to the Spurti student dashboard.
## What this PR adds
A new '🔵 My Comparison Circle' section inside the existing ⭐ Peers tab,
letting each student build a private leaderboard with up to 10 selected peers.
## How it works
1. Student opens their dashboard → ⭐ Peers tab → scrolls to Comparison Circle
2. Searches for any active student and clicks '+ Add' (up to 10 members)
3. A ranked leaderboard appears showing Rank, SP, Level, and Badges for all
circle members + the student themselves
4. The student's own row is highlighted green with a '(you)' tag
5. Members can be removed at any time with the ✕ button
6. A capacity bar (0/10 → 10/10) shows how full the circle is
## Files changed
New:
- server/models/ComparisonCircle.js — Mongoose model (owner + members[])
Modified:
- server/server.js — resolveCircleOwner helper + 3 API routes:
GET /api/comparison-circle — fetch circle + ranked leaderboard
POST /api/comparison-circle/members — add a member (max 10)
DELETE /api/comparison-circle/members/:id — remove a member
- client/src/main.jsx — ComparisonCircleSection component inside PeersTab
- client/src/styles.css — capacity bar, add-row, leaderboard, badge styles
## Design notes
- Circle data persists in MongoDB (ComparisonCircle collection)
- Auth uses student email passed as query param from the client profile state
(compatible with the search+confirm login flow used by this fork)
- One circle per student (unique owner index)
- Leaderboard ranked by totalSp descending, includes badges computed
from attendance + poll + SP data (same logic as main leaderboard)
Co-authored-by: MansiSingh <mannumansi0562@gmail.com>
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.
🔵 Private Comparison Circle
What this PR adds
A Private Comparison Circle section inside the existing ⭐ Peers tab,
letting each student build their own private leaderboard with up to 10 selected peers.
How it works
0/10 → 10/10membersFiles changed
New:
server/models/ComparisonCircle.js— Mongoose model (owner + members[])Modified:
server/server.js—resolveCircleOwnerhelper + 3 API routes:GET /api/comparison-circlePOST /api/comparison-circle/membersDELETE /api/comparison-circle/members/:idclient/src/main.jsx—ComparisonCircleSectioncomponent insidePeersTabclient/src/styles.css— capacity bar, add-row, leaderboard, badge stylesNotes
members.9: $exists: false) and client-side