seed data
This commit is contained in:
@@ -51,6 +51,48 @@ function getChampionshipLabel(type?: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function getCategoryLabel(category?: string): string {
|
||||
if (!category) return '';
|
||||
|
||||
switch (category) {
|
||||
case 'driver':
|
||||
return 'Driver';
|
||||
case 'team':
|
||||
return 'Team';
|
||||
case 'nations':
|
||||
return 'Nations';
|
||||
case 'trophy':
|
||||
return 'Trophy';
|
||||
case 'endurance':
|
||||
return 'Endurance';
|
||||
case 'sprint':
|
||||
return 'Sprint';
|
||||
default:
|
||||
return category.charAt(0).toUpperCase() + category.slice(1);
|
||||
}
|
||||
}
|
||||
|
||||
function getCategoryColor(category?: string): string {
|
||||
if (!category) return 'bg-gray-500/20 text-gray-400 border-gray-500/30';
|
||||
|
||||
switch (category) {
|
||||
case 'driver':
|
||||
return 'bg-purple-500/20 text-purple-400 border-purple-500/30';
|
||||
case 'team':
|
||||
return 'bg-blue-500/20 text-blue-400 border-blue-500/30';
|
||||
case 'nations':
|
||||
return 'bg-green-500/20 text-green-400 border-green-500/30';
|
||||
case 'trophy':
|
||||
return 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30';
|
||||
case 'endurance':
|
||||
return 'bg-orange-500/20 text-orange-400 border-orange-500/30';
|
||||
case 'sprint':
|
||||
return 'bg-red-500/20 text-red-400 border-red-500/30';
|
||||
default:
|
||||
return 'bg-gray-500/20 text-gray-400 border-gray-500/30';
|
||||
}
|
||||
}
|
||||
|
||||
function getGameColor(gameId?: string): string {
|
||||
switch (gameId) {
|
||||
case 'iracing':
|
||||
@@ -81,6 +123,8 @@ export default function LeagueCard({ league, onClick }: LeagueCardProps) {
|
||||
const gameColorClass = getGameColor(league.scoring?.gameId);
|
||||
const isNew = isNewLeague(league.createdAt);
|
||||
const isTeamLeague = league.maxTeams && league.maxTeams > 0;
|
||||
const categoryLabel = getCategoryLabel(league.category);
|
||||
const categoryColorClass = getCategoryColor(league.category);
|
||||
|
||||
// Calculate fill percentage - use teams for team leagues, drivers otherwise
|
||||
const usedSlots = isTeamLeague ? (league.usedTeamSlots ?? 0) : (league.usedDriverSlots ?? 0);
|
||||
@@ -128,6 +172,11 @@ export default function LeagueCard({ league, onClick }: LeagueCardProps) {
|
||||
{league.scoring.gameName}
|
||||
</span>
|
||||
)}
|
||||
{league.category && (
|
||||
<span className={`px-2 py-0.5 rounded-full text-[10px] font-semibold border ${categoryColorClass}`}>
|
||||
{categoryLabel}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Championship Type Badge - Top Right */}
|
||||
|
||||
Reference in New Issue
Block a user