diff --git a/src/app/players/[id]/profile/page.tsx b/src/app/players/[id]/profile/page.tsx index c4067a8..6aa17b5 100644 --- a/src/app/players/[id]/profile/page.tsx +++ b/src/app/players/[id]/profile/page.tsx @@ -35,6 +35,40 @@ export default async function PlayerProfilePage({ params }: PageProps) { orderBy: { gamesPlayed: "desc" }, }) + // Get tournaments participated in + const tournaments = await prisma.event.findMany({ + where: { + participants: { + some: { + playerId: playerId, + }, + }, + }, + orderBy: { eventDate: "desc" }, + take: 10, + }) + + // Get recent matches (last 10 games played) + const recentMatches = await prisma.match.findMany({ + where: { + OR: [ + { team1P1Id: playerId }, + { team1P2Id: playerId }, + { team2P1Id: playerId }, + { team2P2Id: playerId }, + ], + }, + include: { + team1P1: true, + team1P2: true, + team2P1: true, + team2P2: true, + event: true, + }, + orderBy: { playedAt: "desc" }, + take: 10, + }) + // Use direct player stats for overall statistics (more accurate and consistent with rankings page) const totalGames = player.gamesPlayed const totalWins = player.wins @@ -95,6 +129,171 @@ export default async function PlayerProfilePage({ params }: PageProps) { + {/* Tournaments Participated */} +
No tournament data available yet.
+ ) : ( +| + Tournament + | ++ Date + | ++ Format + | ++ Status + | +
|---|---|---|---|
| + + {tournament.name} + + | ++ {tournament.eventDate + ? new Date(tournament.eventDate).toLocaleDateString() + : "N/A"} + | ++ {tournament.format} + | ++ + {tournament.status} + + | +
No game data available yet.
+ ) : ( +| + Date + | ++ Tournament + | ++ Team + | ++ Opponents + | ++ Score + | ++ Result + | +
|---|---|---|---|---|---|
| + {match.playedAt + ? new Date(match.playedAt).toLocaleDateString() + : "N/A"} + | ++ {match.event?.name || "N/A"} + | ++ + {teammate.name} + + | ++ {opponents.map((opponent, index) => ( + + + {opponent.name} + + {index < opponents.length - 1 ? ", " : ""} + + ))} + | ++ {teamScore} - {opponentScore} + | ++ + {teamWon ? 'Win' : 'Loss'} + + | +