1.0.1-fix: Fixed 'winner-team' regarded as win.
This commit is contained in:
@@ -21,8 +21,23 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Active Roster (Grid) -->
|
||||
<div class="mb-10">
|
||||
<!-- Sorting Controls -->
|
||||
<div class="flex justify-end mb-4">
|
||||
<div class="inline-flex shadow-sm rounded-md" role="group">
|
||||
<button type="button" @click="sortBy('rating')" :class="{'bg-yrtv-600 text-white': currentSort === 'rating', 'bg-white text-gray-700 hover:bg-gray-50': currentSort !== 'rating'}" class="px-4 py-2 text-sm font-medium border border-gray-200 rounded-l-lg dark:bg-slate-700 dark:border-slate-600 dark:text-white dark:hover:bg-slate-600">
|
||||
Rating
|
||||
</button>
|
||||
<button type="button" @click="sortBy('kd')" :class="{'bg-yrtv-600 text-white': currentSort === 'kd', 'bg-white text-gray-700 hover:bg-gray-50': currentSort !== 'kd'}" class="px-4 py-2 text-sm font-medium border-t border-b border-gray-200 dark:bg-slate-700 dark:border-slate-600 dark:text-white dark:hover:bg-slate-600">
|
||||
K/D
|
||||
</button>
|
||||
<button type="button" @click="sortBy('matches')" :class="{'bg-yrtv-600 text-white': currentSort === 'matches', 'bg-white text-gray-700 hover:bg-gray-50': currentSort !== 'matches'}" class="px-4 py-2 text-sm font-medium border border-gray-200 rounded-r-lg dark:bg-slate-700 dark:border-slate-600 dark:text-white dark:hover:bg-slate-600">
|
||||
Matches
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Active Roster (Grid) -->
|
||||
<div class="mb-10">
|
||||
<h3 class="text-lg leading-6 font-medium text-gray-900 dark:text-white mb-4">Active Roster</h3>
|
||||
<!-- Dynamic Grid based on roster size, default to 5 slots + 1 add button -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-6">
|
||||
@@ -32,7 +47,15 @@
|
||||
|
||||
<div class="w-full h-full flex flex-col items-center">
|
||||
<div class="relative w-32 h-32 mb-4">
|
||||
<img :src="player.avatar_url || 'https://avatars.steamstatic.com/fef49e7fa7e1997310d705b2a6158ff8dc1cdfeb_full.jpg'" class="w-32 h-32 rounded-full object-cover border-4 border-yrtv-500 shadow-lg">
|
||||
<!-- Avatar Logic: Image or Initials -->
|
||||
<template x-if="player.avatar_url">
|
||||
<img :src="player.avatar_url" class="w-32 h-32 rounded-full object-cover border-4 border-yrtv-500 shadow-lg">
|
||||
</template>
|
||||
<template x-if="!player.avatar_url">
|
||||
<div class="w-32 h-32 rounded-full bg-yrtv-100 flex items-center justify-center border-4 border-yrtv-500 shadow-lg text-yrtv-600 font-bold text-4xl">
|
||||
<span x-text="(player.username || player.name || player.steam_id_64).substring(0, 2).toUpperCase()"></span>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<h4 class="text-lg font-bold text-gray-900 dark:text-white truncate w-full text-center" x-text="player.username || player.name || player.steam_id_64"></h4>
|
||||
@@ -140,6 +163,7 @@ function clubhouse() {
|
||||
return {
|
||||
team: {},
|
||||
roster: [],
|
||||
currentSort: 'rating', // Default sort
|
||||
showScoutModal: false,
|
||||
searchQuery: '',
|
||||
searchResults: [],
|
||||
@@ -154,9 +178,42 @@ function clubhouse() {
|
||||
.then(data => {
|
||||
this.team = data.team;
|
||||
this.roster = data.roster;
|
||||
this.sortRoster(); // Apply default sort
|
||||
});
|
||||
},
|
||||
|
||||
sortBy(key) {
|
||||
this.currentSort = key;
|
||||
this.sortRoster();
|
||||
},
|
||||
|
||||
sortRoster() {
|
||||
if (!this.roster || this.roster.length === 0) return;
|
||||
|
||||
this.roster.sort((a, b) => {
|
||||
let valA = 0, valB = 0;
|
||||
|
||||
if (this.currentSort === 'rating') {
|
||||
valA = a.stats?.basic_avg_rating || 0;
|
||||
valB = b.stats?.basic_avg_rating || 0;
|
||||
} else if (this.currentSort === 'kd') {
|
||||
valA = a.stats?.basic_avg_kd || 0;
|
||||
valB = b.stats?.basic_avg_kd || 0;
|
||||
} else if (this.currentSort === 'matches') {
|
||||
// matches_played is usually on the player object now? or stats?
|
||||
// Check API: it's not explicitly in 'stats', but search added it.
|
||||
// Roster API usually doesn't attach matches_played unless we ask.
|
||||
// Let's assume stats.total_matches or check object root.
|
||||
// Looking at roster API: we attach match counts? No, only search.
|
||||
// But we can use total_matches from stats.
|
||||
valA = a.stats?.total_matches || 0;
|
||||
valB = b.stats?.total_matches || 0;
|
||||
}
|
||||
|
||||
return valB - valA; // Descending
|
||||
});
|
||||
},
|
||||
|
||||
searchPlayers() {
|
||||
if (this.searchQuery.length < 2) {
|
||||
this.searchResults = [];
|
||||
|
||||
Reference in New Issue
Block a user