Skip to content

Add player roster management with AI integration#16

Open
DigitalBlueprint239 wants to merge 1 commit into
masterfrom
claude/review-project-docs-XUB49
Open

Add player roster management with AI integration#16
DigitalBlueprint239 wants to merge 1 commit into
masterfrom
claude/review-project-docs-XUB49

Conversation

@DigitalBlueprint239

Copy link
Copy Markdown
Owner

Summary

Implement a complete player roster management system with Firestore persistence and AI awareness. Players are stored as subcollections under teams (teams/{teamId}/players/{playerId}), enabling multi-team support and real-time synchronization. The roster feeds structured player availability and position data into AI-generated practice plans.

Key Changes

New Roster Types & Services

  • src/types/roster.ts: Comprehensive football roster types including:

    • FootballPosition enum (22 positions: QB, RB, WR, TE, OL, DL, LB, DB, K, P, LS)
    • PositionGroup enum (Offense, Defense, Special Teams)
    • RosterPlayer interface with availability status, experience level, injury notes
    • RosterSummary for AI consumption with position group breakdowns
    • Human-readable labels and color mappings for UI display
  • src/services/roster-service.ts: Firestore CRUD operations

    • Real-time listener with subscribeToRoster() for live updates
    • Jersey number uniqueness validation per team
    • Auto-computed positionGroup based on position selection
    • Subcollection path: teams/{teamId}/players/{playerId}

Roster Context & State Management

  • src/contexts/RosterContext.tsx: React context provider
    • Real-time player list with automatic sorting (by position group → position → experience level)
    • RosterSummary computation with injury tracking and position group stats
    • getRosterContextForAI() method that formats roster data for AI prompts
    • Hooks: useRoster() for component access

UI Components

  • src/features/roster/PlayerRoster.tsx: Main roster view

    • Grouped display by Offense/Defense/Special Teams
    • Empty state with call-to-action
    • Floating action button for adding players
  • src/features/roster/AddPlayerForm.tsx: Slide-over form

    • Position dropdown grouped by position group
    • Experience level selector (Starter/Backup/Developmental)
    • Jersey number validation with duplicate detection
    • Form reset on successful submission
  • src/features/roster/PlayerDetail.tsx: Edit/delete slide-over

    • Full player editing (name, number, position, experience, availability)
    • Conditional injury note field (shown only when not fully available)
    • Coach notes textarea
    • Delete confirmation dialog
    • Jersey number change validation
  • src/features/roster/PlayerCard.tsx: Compact player display

    • Jersey number badge
    • Name and position
    • Experience level badge with color coding
    • Availability status indicator with tooltip
  • src/features/roster/RosterSummaryBar.tsx: Stats bar

    • Total players, available count, injured/limited count
    • Position group breakdowns

AI Integration

  • Practice Planner enhancement (src/features/practice-planner/PracticePlanner.tsx):

    • Empty roster prompt directing users to add players first
    • Roster context indicator showing player count and availability
    • Passes rosterSummary to AI service for roster-aware practice plan generation
  • AI Service update (src/services/ai-service.ts):

    • Includes roster summary in practice plan prompts
    • AI can now account for player availability, position depth, and injury status

Dashboard Integration

  • src/components/Dashboard.tsx:
    • New "Roster" tab (🏈) in main navigation
    • Roster stat card on overview showing live player count
    • Integrated PlayerRoster component

App Setup

  • src/App.tsx: Wrapped with RosterProvider for global roster state
  • src/types/firestore-schema.ts: Updated collection references to note subcollection usage

Notable Implementation Details

  1. Firestore Subcollection Structure: Players are stored under teams, enabling:
    • Multi-team support without data duplication
    • Team-scoped jersey number uniqueness
    • Automatic cleanup when teams are deleted

2

https://claude.ai/code/session_011J8e3UovjUyiKd1u5f8DWE

Build complete player roster feature end-to-end:
- Football-specific types (22 positions, position groups, experience levels)
- Firestore subcollection at teams/{teamId}/players/{playerId} with real-time listener
- Roster UI with depth-chart layout grouped by Offense/Defense/Special Teams
- Add/edit/delete players with jersey number uniqueness validation
- Availability status with color-coded indicators (green/yellow/red/grey)
- Roster summary bar with live counts pinned at top
- AI connection: getRosterContextForAI() feeds roster state into practice plan prompts
- Practice Planner shows empty-roster prompt when no players exist
- Dashboard stat card shows real player count from Firestore
- Fix PracticePlanner to use correct generatePracticePlan method

Files created:
- src/types/roster.ts
- src/services/roster-service.ts
- src/contexts/RosterContext.tsx
- src/features/roster/ (5 components)
- MASTER_TRACKER.md

Files modified:
- src/App.tsx (add RosterProvider)
- src/components/Dashboard.tsx (add Roster tab + live stats)
- src/features/practice-planner/PracticePlanner.tsx (fix AI method + roster context)
- src/services/ai-service.ts (add roster block to prompt)
- src/types/firestore-schema.ts (add subcollection path + rosterSummary field)

https://claude.ai/code/session_011J8e3UovjUyiKd1u5f8DWE
@netlify

netlify Bot commented Feb 24, 2026

Copy link
Copy Markdown

Deploy Preview for magical-starlight-0c1207 failed.

Name Link
🔨 Latest commit d9f7cda
🔍 Latest deploy log https://app.netlify.com/projects/magical-starlight-0c1207/deploys/699de8b7d607830008b36cb7

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.

2 participants