Skip to content

Invoice Group Progress Leaderboard #445

Description

@Kingsman-99

Description

Groups of collaborators (e.g., freelancer pools, DAOs, creative teams) sharing a group invoice want a motivating view of each member's payment completion relative to their share, fostering accountability. This issue adds a progress leaderboard to /groups/[id] that ranks all recipient members by their percentage of their owed share received, displays a progress bar per member, and updates in real time as payments come in. The leaderboard respects privacy settings: members can opt out of being ranked.

Technical Context

Extend app/groups/[id]/page.tsx with a LeaderboardPanel tab. Create components/groups/GroupLeaderboard.tsx consuming data from GET /api/groups/[id]/leaderboard which returns LeaderboardEntry[] = { memberId, displayName, owedAmount, receivedAmount, percentComplete, rank, optedOut }. Rank is computed server-side, ordering by percentComplete descending. Poll the endpoint every 15 seconds using useSWR with refreshInterval. Members who have opted out appear as "Anonymous Member" with a dashed progress bar. The opt-out toggle lives in a member's group settings section on /groups/[id]/settings. Animate rank changes (position swap) using Framer Motion layout animations keyed by memberId.

Acceptance Criteria

  • The leaderboard renders members ranked by percentComplete descending and updates rank positions within 15 seconds of a payment confirmation
  • Rank position swaps animate smoothly using layout animations; no abrupt reordering is visible
  • Members who have opted out appear as "Anonymous Member" with a dashed progress bar; their actual amounts are not shown to other members
  • The opt-out toggle in group settings takes effect within one poll cycle (15 seconds or fewer) without requiring a page reload
  • A member at 100% completion displays a celebratory badge and is pinned to the top of the leaderboard regardless of join order
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions