'use client'; import { useState, useEffect } from 'react'; import Card from '@/components/ui/Card'; import { useServices } from '@/lib/services/ServiceProvider'; interface TeamStandingsProps { teamId: string; leagues: string[]; } export default function TeamStandings({ teamId, leagues }: TeamStandingsProps) { const { leagueService } = useServices(); const [standings, setStandings] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { const load = async () => { try { // For demo purposes, create mock standings const mockStandings = leagues.map(leagueId => ({ leagueId, leagueName: `League ${leagueId}`, position: Math.floor(Math.random() * 10) + 1, points: Math.floor(Math.random() * 100), wins: Math.floor(Math.random() * 5), racesCompleted: Math.floor(Math.random() * 10), })); setStandings(mockStandings); } catch (error) { console.error('Failed to load standings:', error); } finally { setLoading(false); } }; void load(); }, [teamId, leagues]); if (loading) { return (
Loading standings...
); } return (

League Standings

{standings.map((standing) => (

{standing.leagueName}

P{standing.position}
{standing.points}
Points
{standing.wins}
Wins
{standing.racesCompleted}
Races
))}
{standings.length === 0 && (
No standings available yet.
)}
); }