import React, { useState } from 'react'; import { Tournament, Game, LiveMatch, NewsArticle } from '../types'; import { Trophy, Calendar, Users, Gamepad2, ArrowRight, Sparkles, Volume2, ShieldAlert, X } from 'lucide-react'; import { TRANSLATIONS, Language } from '../translations'; import { motion } from 'motion/react'; import { PrizePoolBadge } from './PrizePoolBadge'; import { TournamentCalendar } from './TournamentCalendar'; interface HomeViewProps { tournaments: Tournament[]; games: Game[]; liveMatches: LiveMatch[]; news: NewsArticle[]; setCurrentView: (view: string) => void; onSelectTournament: (id: string) => void; currentLanguage: Language; } export const HomeView: React.FC = ({ tournaments, games, liveMatches, news, setCurrentView, onSelectTournament, currentLanguage, }) => { const [activeSlide, setActiveSlide] = useState(0); const [selectedArticle, setSelectedArticle] = useState(null); const t = TRANSLATIONS[currentLanguage] || TRANSLATIONS['EN']; // Filter tournaments for upcoming slider const keyTournaments = tournaments.filter((t) => t.status === 'upcoming'); const ongoingTournaments = tournaments.filter((t) => t.status === 'ongoing'); // Multi-language stats labels mapper const getStatsLabel = (labelKey: string) => { const statsStrings: Record> = { EN: { active: 'Active Gladiators', prizes: 'Championship Prize Pools', rooms: 'Live Battle Rooms', hostings: 'Successfully Hosted' }, UZ: { active: 'Faol Gladiatorlar', prizes: 'Chempionat Mukofot Jamgʻarmalari', rooms: 'Jonli Jang Xonalari', hostings: 'Muvaffaqiyatli Oʻtkazilgan' }, RU: { active: 'Активные Гладиаторы', prizes: 'Призовые Фонды Чемпионатов', rooms: 'Игровые Комнаты Онлайн', hostings: 'Успешно Проведено' } }; return statsStrings[currentLanguage]?.[labelKey] || statsStrings['EN'][labelKey]; }; const stats = [ { label: getStatsLabel('active'), value: '142,850', icon: }, { label: getStatsLabel('prizes'), value: '$840,000+', icon: }, { label: getStatsLabel('rooms'), value: '42 Matches', icon: }, { label: getStatsLabel('hostings'), value: '1,280+', icon: }, ]; // Local helper UI phrases const localUi = { EN: { seasonAnnounce: 'CYBER ARENA SEASON 4 REGISTRATION OPEN', liveMatchStation: 'LIVE MATCH STATION', vs: 'V / S', rank: 'Standings rank', watchStream: 'Watch Stream Now', allTourneys: 'All Tourneys', liveStreamDeck: 'Live Stream Deck', liveSim: 'LIVE SIM', tuneStream: 'Tune into stream channel', combatDisciplines: 'Active Combat Disciplines', pressCenter: 'Arena Press Center', pressSub: 'Official platform statements, roster exchanges, patch updates.', articleViews: 'VIEWS', readArticle: 'Read article' }, UZ: { seasonAnnounce: 'KIBER ARENA 4-MAVSUM RO‘YXATDAN O‘TISH OCHIQ', liveMatchStation: 'JONLI MATCH STANSIYASI', vs: 'V / S', rank: 'Guruh reytingi', watchStream: 'Hozir tomosha qilish', allTourneys: 'Barcha turnirlar', liveStreamDeck: 'Jonli o‘yinlar stoli', liveSim: 'JONLI SIM', tuneStream: 'Translyatsiyani ko‘rish', combatDisciplines: 'Faol kiber yo‘nalishlar', pressCenter: 'Arena matbuot markazi', pressSub: 'Rasmiy bayonotlar, tarkib almashinuvi va yangilanishlar.', articleViews: 'KO‘RILDI', readArticle: 'Maqolani o‘qish' }, RU: { seasonAnnounce: 'РЕГИСТРАЦИЯ НА 4 СЕЗОН КИБЕРАРЕНЫ ОТКРЫТА', liveMatchStation: 'СТАНЦИЯ ЖИВЫХ МАТЧЕЙ', vs: 'В / С', rank: 'Ранг в таблице', watchStream: 'Смотреть трансляцию', allTourneys: 'Все турниры', liveStreamDeck: 'Панель стримов', liveSim: 'ТРАНСЛЯЦИЯ', tuneStream: 'Подключиться к стриму', combatDisciplines: 'Активные дисциплины', pressCenter: 'Пресс-центр арены', pressSub: 'Официальные заявления платформы, патчи и трансферы.', articleViews: 'ПРОСМОТРЫ', readArticle: 'Читать статью' } }; const ui = localUi[currentLanguage] || localUi['EN']; return (
{/* 1. Cyber Esports Hero Banner */}
{/* Animated ambient backdrop grids and spotlights */}
{ui.seasonAnnounce}

{t.heroTitle}

{t.heroSub}

{/* Hero Premium Side Graphic/Card */}
{ui.liveMatchStation}
{liveMatches.length > 0 && (
{liveMatches[0].teamA?.logo && (liveMatches[0].teamA.logo.startsWith('data:') || liveMatches[0].teamA.logo.startsWith('http')) ? ( ) : ( {liveMatches[0].teamA?.logo || "⚔️"} )}

{liveMatches[0].teamA?.name || "Team A"}

{ui.rank}: 1
{ui.vs} {liveMatches[0].teamA?.score ?? 0} : {liveMatches[0].teamB?.score ?? 0}
{liveMatches[0].teamB?.logo && (liveMatches[0].teamB.logo.startsWith('data:') || liveMatches[0].teamB.logo.startsWith('http')) ? ( ) : ( {liveMatches[0].teamB?.logo || "🛡️"} )}

{liveMatches[0].teamB?.name || "Team B"}

{ui.rank}: 2

Current Cup: {liveMatches[0].tournamentTitle || "Tournament"}

)}
{/* 2. Bento Statistics Row */}
{stats.map((st, idx) => (
{st.label} {st.value}
{st.icon}
))}
{/* 3. Featured Tournaments Row Slider slider */}

★ {t.activeChampionships}

{t.activeChampionshipsSub}

{keyTournaments.slice(0, 3).map((tour) => ( { onSelectTournament(tour.id); setCurrentView('register'); }} whileHover={{ y: -6, scale: 1.015, boxShadow: "0 20px 25px -5px rgba(6, 182, 212, 0.1), 0 8px 10px -6px rgba(6, 182, 212, 0.1)" }} whileTap={{ scale: 0.985 }} transition={{ type: "spring", stiffness: 350, damping: 25 }} className="bg-white/5 border border-white/10 rounded-2xl overflow-hidden hover:border-cyan-500/30 transition-colors text-left flex flex-col justify-between shadow-md relative group cursor-pointer backdrop-blur-sm" >
{tour.entryFee} {t.entryFeeLabel.toUpperCase()}
{/* Cover */}
{tour.title}
{tour.gameTitle}
{/* Details text */}

{tour.title}

{/* Dynamic Prize Pool Component */}
{tour.startDate} SQUADS:{' '} {tour.slotsFilled}/{tour.slotsTotal}
REGISTRATION STATUS: OPEN
{t.quickRegister}
))}
{/* Tournament Calendar Section */}
{/* 4. Upcoming & Live Timelines Section details */}
{/* Left Side: Live Stream Center Matches */}

{ui.liveStreamDeck}

{liveMatches.filter(m => m.status === 'live').map((mat) => (
{ui.liveSim}
{mat.tournamentTitle || "Tournament"}
{mat.teamA?.logo && (mat.teamA.logo.startsWith('data:') || mat.teamA.logo.startsWith('http')) ? ( ) : ( {mat.teamA?.logo || "⚔️"} )}
{mat.teamA?.name || "Team A"}
{mat.teamA?.score ?? 0}
{mat.teamB?.logo && (mat.teamB.logo.startsWith('data:') || mat.teamB.logo.startsWith('http')) ? ( ) : ( {mat.teamB?.logo || "🛡️"} )}
{mat.teamB?.name || "Team B"}
{mat.teamB?.score ?? 0}
))}
{/* Right Side: Popular games cards showcase */}

★ {ui.combatDisciplines}

{games.slice(0, 4).map((game) => (
setCurrentView('games')} className="bg-white/5 border border-white/10 rounded-xl overflow-hidden hover:border-cyan-500/35 transition-all cursor-pointer group relative backdrop-blur-sm" >
{game.title}

{game.title}

{game.genre}
))}
{/* 5. Trending News & Blog Section details */} {news && news.length > 0 && (

📰 {ui.pressCenter}

{ui.pressSub}

{news.map((item) => (
{item.title}
{item.category}
{item.publishedAt}

{item.title}

{item.summary}

{ui.articleViews}: {item.views.toLocaleString()}
))}
)} {/* Modern News Article Modal overlay - avoids iframe popups */} {selectedArticle && (
setSelectedArticle(null)} >
e.stopPropagation()} > {/* Gradient border line */}
★ {selectedArticle.category}

{selectedArticle.title}

{selectedArticle.publishedAt} | {selectedArticle.views.toLocaleString()} views

{selectedArticle.summary}

{selectedArticle.content}

)}
); };