Skip to content

Feat/comparison circle and peers bookmarking together - #96

Open
Vandan647 wants to merge 2 commits into
vicharanashala:mainfrom
Vandan647:feat/comparison-circle
Open

Feat/comparison circle and peers bookmarking together #96
Vandan647 wants to merge 2 commits into
vicharanashala:mainfrom
Vandan647:feat/comparison-circle

Conversation

@Vandan647

Copy link
Copy Markdown

🔵 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

  1. Student opens dashboard → ⭐ Peers tab → scrolls to 🔵 My Comparison Circle
  2. Search for any active student → click + Add (up to 10 members)
  3. A ranked leaderboard appears: Rank, Name, SP, Level, Badges
  4. Your own row is highlighted green with a (you) tag
  5. Remove any member with the button
  6. A capacity bar shows 0/10 → 10/10 members

Files changed

New:

  • server/models/ComparisonCircle.js — Mongoose model (owner + members[])
    Modified:
  • server/server.jsresolveCircleOwner helper + 3 API routes:
    • GET /api/comparison-circle
    • POST /api/comparison-circle/members
    • DELETE /api/comparison-circle/members/:id
  • client/src/main.jsxComparisonCircleSection component inside PeersTab
  • client/src/styles.css — capacity bar, add-row, leaderboard, badge styles

Notes

  • Circle data persists in MongoDB (one circle per student, unique owner index)
  • Leaderboard computed with same badge logic as the main leaderboard
  • Max 10 members enforced both server-side (members.9: $exists: false) and client-side
Screenshot from 2026-07-18 15-54-37 Screenshot from 2026-07-18 15-54-40

Vandan647 and others added 2 commits July 1, 2026 14:55
- 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>
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