import { LeagueInfo } from "@/components/match-detail/league-info"; import { MatchInfoCard } from "@/components/match-detail/match-info-card"; import { MatchTabs } from "@/components/match-detail/match-tabs"; import { ScoreHeader } from "@/components/match-detail/score-header"; import { ScoreTable } from "@/components/match-detail/score-table"; import { ThemedText } from "@/components/themed-text"; import { ThemedView } from "@/components/themed-view"; import { Colors } from "@/constants/theme"; import { useTheme } from "@/context/ThemeContext"; import { fetchMatchDetail } from "@/lib/api"; import { MatchDetailData } from "@/types/api"; import { Stack, useLocalSearchParams, useRouter } from "expo-router"; import React, { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import { ActivityIndicator, ScrollView, StyleSheet, TouchableOpacity, View, } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; export default function MatchDetailScreen() { const { id } = useLocalSearchParams<{ id: string }>(); const router = useRouter(); const { theme } = useTheme(); const { t } = useTranslation(); const insets = useSafeAreaInsets(); const isDark = theme === "dark"; const [loading, setLoading] = useState(true); const [error, setError] = useState(null); const [data, setData] = useState(null); const [activeTab, setActiveTab] = useState("info"); useEffect(() => { if (id) { loadMatchDetail(); } }, [id]); const loadMatchDetail = async () => { try { setLoading(true); setError(null); const result = await fetchMatchDetail(id as string); setData(result); } catch (err: any) { setError(err.message || t("detail.fetch_failed")); } finally { setLoading(false); } }; if (loading) { return ( ); } if (error || !data) { return ( {error || t("detail.not_found")} {t("detail.retry")} ); } const renderTabContent = () => { switch (activeTab) { case "info": return ( <> ); case "h2h": return ( {t("detail.empty_h2h")} ); case "chat": return ( {t("detail.empty_chat")} ); default: return null; } }; return ( {renderTabContent()} ); } const styles = StyleSheet.create({ container: { flex: 1, }, center: { flex: 1, justifyContent: "center", alignItems: "center", padding: 20, }, errorText: { fontSize: 16, marginBottom: 20, textAlign: "center", }, retryButton: { paddingHorizontal: 20, paddingVertical: 10, backgroundColor: "#007AFF", borderRadius: 8, }, retryText: { color: "#FFF", fontWeight: "600", }, emptyContent: { padding: 50, alignItems: "center", }, emptyText: { opacity: 0.5, }, });