website refactor

This commit is contained in:
2026-01-20 21:35:50 +01:00
parent 06207bf835
commit 51288234f4
42 changed files with 892 additions and 449 deletions

View File

@@ -34,12 +34,31 @@ export function TeamLeaderboardPageWrapper({ viewData }: ClientWrapperProps<Team
router.push('/teams');
};
// Apply filtering and sorting
const filteredAndSortedTeams = viewData.teams
.filter((team) => {
const matchesSearch = team.name.toLowerCase().includes(searchQuery.toLowerCase());
const matchesLevel = filterLevel === 'all' || team.performanceLevel === filterLevel;
return matchesSearch && matchesLevel;
})
.sort((a, b) => {
if (sortBy === 'rating') return (b.rating || 0) - (a.rating || 0);
if (sortBy === 'wins') return b.totalWins - a.totalWins;
if (sortBy === 'winRate') {
const rateA = a.totalRaces > 0 ? a.totalWins / a.totalRaces : 0;
const rateB = b.totalRaces > 0 ? b.totalWins / b.totalRaces : 0;
return rateB - rateA;
}
if (sortBy === 'races') return b.totalRaces - a.totalRaces;
return 0;
});
const templateViewData = {
teams: viewData.teams,
searchQuery,
filterLevel,
sortBy,
filteredAndSortedTeams: viewData.teams,
filteredAndSortedTeams,
};
return (