'use client'; import { useState, useMemo } from 'react'; import { Users, Trophy, Search, Plus, Sparkles, Crown, Star, TrendingUp, Shield, Zap, UserPlus, ChevronRight, Timer, Target, Award, Handshake, MessageCircle, Calendar, } from 'lucide-react'; import TeamCard from '@/components/teams/TeamCard'; import Button from '@/components/ui/Button'; import Card from '@/components/ui/Card'; import Input from '@/components/ui/Input'; import Heading from '@/components/ui/Heading'; import CreateTeamForm from '@/components/teams/CreateTeamForm'; import WhyJoinTeamSection from '@/components/teams/WhyJoinTeamSection'; import SkillLevelSection from '@/components/teams/SkillLevelSection'; import FeaturedRecruiting from '@/components/teams/FeaturedRecruiting'; import TeamLeaderboardPreview from '@/components/teams/TeamLeaderboardPreview'; import type { TeamSummaryViewModel } from '@/lib/view-models/TeamSummaryViewModel'; // ============================================================================ // TYPES // ============================================================================ type TeamDisplayData = TeamSummaryViewModel; type SkillLevel = 'pro' | 'advanced' | 'intermediate' | 'beginner'; // ============================================================================ // SKILL LEVEL CONFIG // ============================================================================ const SKILL_LEVELS: { id: SkillLevel; label: string; icon: React.ElementType; color: string; bgColor: string; borderColor: string; description: string; }[] = [ { id: 'pro', label: 'Pro', icon: Crown, color: 'text-yellow-400', bgColor: 'bg-yellow-400/10', borderColor: 'border-yellow-400/30', description: 'Elite competition, sponsored teams', }, { id: 'advanced', label: 'Advanced', icon: Star, color: 'text-purple-400', bgColor: 'bg-purple-400/10', borderColor: 'border-purple-400/30', description: 'Competitive racing, high consistency', }, { id: 'intermediate', label: 'Intermediate', icon: TrendingUp, color: 'text-primary-blue', bgColor: 'bg-primary-blue/10', borderColor: 'border-primary-blue/30', description: 'Growing skills, regular practice', }, { id: 'beginner', label: 'Beginner', icon: Shield, color: 'text-green-400', bgColor: 'bg-green-400/10', borderColor: 'border-green-400/30', description: 'Learning the basics, friendly environment', }, ]; // ============================================================================ // TEMPLATE PROPS // ============================================================================ export interface TeamsTemplateProps { // Data props teams: TeamDisplayData[]; isLoading?: boolean; // UI state props searchQuery: string; showCreateForm: boolean; // Derived data props teamsByLevel: Record; topTeams: TeamDisplayData[]; recruitingCount: number; filteredTeams: TeamDisplayData[]; // Event handlers onSearchChange: (query: string) => void; onShowCreateForm: () => void; onHideCreateForm: () => void; onTeamClick: (teamId: string) => void; onCreateSuccess: (teamId: string) => void; onBrowseTeams: () => void; onSkillLevelClick: (level: SkillLevel) => void; } // ============================================================================ // MAIN TEMPLATE COMPONENT // ============================================================================ export default function TeamsTemplate({ teams, isLoading = false, searchQuery, showCreateForm, teamsByLevel, topTeams, recruitingCount, filteredTeams, onSearchChange, onShowCreateForm, onHideCreateForm, onTeamClick, onCreateSuccess, onBrowseTeams, onSkillLevelClick, }: TeamsTemplateProps) { // Show create form view if (showCreateForm) { return (

Create New Team

); } // Show loading state if (isLoading) { return (

Loading teams...

); } return (
{/* Hero Section - Different from Leagues */}
{/* Main Hero Card */}
{/* Background decorations */}
{/* Badge */}
Team Racing
Find Your Crew

Solo racing is great. Team racing is unforgettable. Join a team that matches your skill level and ambitions.

{/* Quick Stats */}
{teams.length} Teams
{recruitingCount} Recruiting
{/* CTA Buttons */}
{/* Skill Level Quick Nav */}

Find Your Level

{SKILL_LEVELS.map((level) => { const LevelIcon = level.icon; const count = teamsByLevel[level.id]?.length || 0; return ( ); })}
{/* Search and Filter Bar - Same style as Leagues */}
{/* Search */}
onSearchChange(e.target.value)} className="pl-11" />
{/* Why Join Section */} {!searchQuery && } {/* Team Leaderboard Preview */} {!searchQuery && } {/* Featured Recruiting */} {!searchQuery && } {/* Teams by Skill Level */} {teams.length === 0 ? (
No teams yet

Be the first to create a racing team. Gather drivers and compete together in endurance events.

) : filteredTeams.length === 0 ? (

No teams found matching "{searchQuery}"

) : (
{SKILL_LEVELS.map((level, index) => (
))}
)}
); }