fix: Fix player profile loading with API transformer and improve UI layout

- Add LegacyPlayerProfile transformer to handle API response format mismatch
- Transform avatar hashes to full Steam CDN URLs
- Map team IDs correctly (API 1/2 -> Schema 2/3)
- Calculate aggregate stats (avg_kills, avg_deaths, win_rate) from matches
- Reduce featured matches on homepage from 6 to 3
- Show 4 recent matches on player profile instead of 10
- Display recent matches in 4-column grid on desktop (side-by-side)

Fixes "Player not found" error for all player profiles.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-05 00:43:50 +01:00
parent 62bfdc8090
commit a861b1c1b6
5 changed files with 152 additions and 10 deletions

View File

@@ -10,11 +10,11 @@ export const load: PageLoad = async ({ parent }) => {
await parent();
try {
// Load featured matches (limit to 6 for homepage)
const matchesData = await api.matches.getMatches({ limit: 6 });
// Load featured matches (limit to 3 for homepage)
const matchesData = await api.matches.getMatches({ limit: 3 });
return {
featuredMatches: matchesData.matches.slice(0, 6), // Ensure max 6 matches
featuredMatches: matchesData.matches.slice(0, 3), // Ensure max 3 matches
meta: {
title: 'CS2.WTF - Statistics for CS2 Matchmaking',
description: