Skip to content

[Feature] Compare mode — side-by-side player stat comparison #14

@grovecj

Description

@grovecj

Summary

Allow users to select 2 or more players and compare their stats side-by-side.

Details

Backend

  • GET /api/v1/compare?players={platform1}:{tag1},{platform2}:{tag2},...
  • Fetches stats for all specified players (in parallel)
  • Returns an array of player stat objects
  • Max 4 players per comparison (to keep UI manageable)

Frontend — Compare Flow

  1. Entry points:
    • "Compare" button on any player's stats page → adds them as first comparison target
    • /compare route with empty state prompting user to add players
    • Direct URL with query params: /compare?p=uno:player1,xbl:player2
  2. Player selection:
  3. Comparison table:
    • Rows = stats (K/D, Wins, Kills, etc.)
    • Columns = players
    • Highlight best value in each row (green bold) and worst (red subtle)
    • Percentage difference from the "best" shown in each cell

Frontend — Compare Visualizations

  • Overlaid radar chart: All players on one radar chart with different colors
  • Grouped bar chart: Side-by-side bars per stat per player
  • Toggle between table view and chart view

Pinia Store (useCompareStore)

interface CompareStore {
  players: PlayerIdentifier[]  // { platform, gamertag }
  statsMap: Map<string, PlayerStats>
  addPlayer(platform: string, gamertag: string): void
  removePlayer(gamertag: string): void
  fetchAllStats(): Promise<void>
}

Acceptance Criteria

  • Can add 2-4 players for comparison
  • Side-by-side stat table with best/worst highlighting
  • Overlaid radar chart with per-player colors
  • Grouped bar chart comparison
  • Players addable from search or squad quick-add
  • Handles mixed results (one player private, others public)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions