Merge branch 'main' of https://git.ambigrat.com/shenyan/physical-expo
This commit is contained in:
@@ -388,8 +388,8 @@ export default function HomeScreen() {
|
|||||||
away: item.event_away_team,
|
away: item.event_away_team,
|
||||||
homeTeamName: item.event_home_team,
|
homeTeamName: item.event_home_team,
|
||||||
awayTeamName: item.event_away_team,
|
awayTeamName: item.event_away_team,
|
||||||
homeTeamLogo: item.home_team_logo,
|
homeTeamLogo: item.home_team_logo || "",
|
||||||
awayTeamLogo: item.away_team_logo,
|
awayTeamLogo: item.away_team_logo || "",
|
||||||
scoreText: item.event_halftime_result || "0 - 0",
|
scoreText: item.event_halftime_result || "0 - 0",
|
||||||
fav: false,
|
fav: false,
|
||||||
sportId: sportId,
|
sportId: sportId,
|
||||||
|
|||||||
@@ -8,14 +8,17 @@ import { StatsCard } from "@/components/live-detail/stats-card";
|
|||||||
import { TennisPowerGraph } from "@/components/live-detail/tennis-power-graph";
|
import { TennisPowerGraph } from "@/components/live-detail/tennis-power-graph";
|
||||||
import { TennisScoreboard } from "@/components/live-detail/tennis-scoreboard";
|
import { TennisScoreboard } from "@/components/live-detail/tennis-scoreboard";
|
||||||
import { TennisStatsCard } from "@/components/live-detail/tennis-stats-card";
|
import { TennisStatsCard } from "@/components/live-detail/tennis-stats-card";
|
||||||
|
import { BasketballOverallStats } from "@/components/match-detail/basketball/basketball-overall-stats";
|
||||||
|
import { BasketballScoreTable } from "@/components/match-detail/basketball/basketball-score-table";
|
||||||
|
import { BasketballStats } from "@/components/match-detail/basketball/basketball-stats";
|
||||||
import { ThemedText } from "@/components/themed-text";
|
import { ThemedText } from "@/components/themed-text";
|
||||||
import { ThemedView } from "@/components/themed-view";
|
import { ThemedView } from "@/components/themed-view";
|
||||||
import { Colors } from "@/constants/theme";
|
import { Colors } from "@/constants/theme";
|
||||||
import { useTheme } from "@/context/ThemeContext";
|
import { useTheme } from "@/context/ThemeContext";
|
||||||
import { fetchLiveScore } from "@/lib/api";
|
import { fetchLiveScore } from "@/lib/api";
|
||||||
import { LiveScoreMatch } from "@/types/api";
|
import { LiveScoreMatch, MatchDetailData } from "@/types/api";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
@@ -39,11 +42,72 @@ export default function LiveDetailScreen() {
|
|||||||
|
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [match, setMatch] = useState<LiveScoreMatch | null>(null);
|
const [match, setMatch] = useState<LiveScoreMatch | null>(null);
|
||||||
const [activeTab, setActiveTab] = useState("detail"); // Default to detail to show all data
|
const [activeTab, setActiveTab] = useState("detail");
|
||||||
|
|
||||||
|
const convertToMatchDetailData = useMemo((): MatchDetailData | null => {
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
events: [],
|
||||||
|
match: {
|
||||||
|
ID: 0,
|
||||||
|
CreatedAt: "",
|
||||||
|
UpdatedAt: "",
|
||||||
|
DeletedAt: null,
|
||||||
|
eventKey: match.event_key.toString(),
|
||||||
|
eventDate: match.event_date,
|
||||||
|
eventTime: match.event_time,
|
||||||
|
eventHomeTeam: match.event_home_team,
|
||||||
|
homeTeamKey: match.home_team_key.toString(),
|
||||||
|
homeTeamLogo: match.home_team_logo || "",
|
||||||
|
eventAwayTeam: match.event_away_team,
|
||||||
|
awayTeamKey: match.away_team_key.toString(),
|
||||||
|
awayTeamLogo: match.away_team_logo || "",
|
||||||
|
eventHalftimeResult: match.event_halftime_result || "",
|
||||||
|
eventFinalResult: match.event_final_result,
|
||||||
|
eventFtResult: "",
|
||||||
|
eventPenaltyResult: "",
|
||||||
|
eventStatus: match.event_status,
|
||||||
|
countryName: match.country_name,
|
||||||
|
leagueName: match.league_name,
|
||||||
|
leagueKey: match.league_key.toString(),
|
||||||
|
leagueRound: match.league_round,
|
||||||
|
leagueSeason: match.league_season,
|
||||||
|
eventLive: match.event_live,
|
||||||
|
eventStadium: "",
|
||||||
|
eventReferee: "",
|
||||||
|
eventCountryKey: match.event_country_key?.toString() || "",
|
||||||
|
leagueLogo: match.league_logo || "",
|
||||||
|
countryLogo: match.country_logo || "",
|
||||||
|
eventHomeFormation: "",
|
||||||
|
eventAwayFormation: "",
|
||||||
|
fkStageKey: "",
|
||||||
|
stageName: "",
|
||||||
|
leagueGroup: "",
|
||||||
|
sportId: parseInt(sport_id || "1"),
|
||||||
|
eventQuarter: match.event_quarter || "",
|
||||||
|
eventSet: "",
|
||||||
|
eventType: "",
|
||||||
|
eventToss: "",
|
||||||
|
eventManOfMatch: "",
|
||||||
|
scores: match.scores,
|
||||||
|
stats: match.statistics,
|
||||||
|
players: match.player_statistics ? {
|
||||||
|
home_team: (match.player_statistics.home_team || []).map(p => ({
|
||||||
|
...p,
|
||||||
|
player_oncourt: p.player_oncourt || undefined,
|
||||||
|
})),
|
||||||
|
away_team: (match.player_statistics.away_team || []).map(p => ({
|
||||||
|
...p,
|
||||||
|
player_oncourt: p.player_oncourt || undefined,
|
||||||
|
})),
|
||||||
|
} : undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}, [match, sport_id]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadLiveDetail();
|
loadLiveDetail();
|
||||||
// 设置每 15 秒更新一次直播比分
|
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
refreshLiveDetail();
|
refreshLiveDetail();
|
||||||
}, 15000);
|
}, 15000);
|
||||||
@@ -63,15 +127,14 @@ export default function LiveDetailScreen() {
|
|||||||
|
|
||||||
const refreshLiveDetail = async () => {
|
const refreshLiveDetail = async () => {
|
||||||
try {
|
try {
|
||||||
// Fetch live scores for the league
|
|
||||||
const sportId = parseInt(sport_id || "1");
|
const sportId = parseInt(sport_id || "1");
|
||||||
const leagueId = parseInt(league_id || "0");
|
const leagueId = parseInt(league_id || "0");
|
||||||
|
|
||||||
const liveData = await fetchLiveScore(sportId, leagueId);
|
const liveData = await fetchLiveScore(sportId, leagueId);
|
||||||
|
|
||||||
if (liveData && Array.isArray(liveData)) {
|
if (liveData && Array.isArray(liveData)) {
|
||||||
// Find the specific match
|
|
||||||
const found = liveData.find((m) => m.event_key.toString() === id);
|
const found = liveData.find((m) => m.event_key.toString() === id);
|
||||||
|
console.log("found", JSON.stringify(found, null, 2));
|
||||||
if (found) {
|
if (found) {
|
||||||
setMatch(found);
|
setMatch(found);
|
||||||
}
|
}
|
||||||
@@ -101,6 +164,8 @@ export default function LiveDetailScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const renderTabContent = () => {
|
const renderTabContent = () => {
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
const numericSportId = parseInt(sport_id || "1");
|
const numericSportId = parseInt(sport_id || "1");
|
||||||
// Tennis Check
|
// Tennis Check
|
||||||
const isTennis =
|
const isTennis =
|
||||||
@@ -108,6 +173,33 @@ export default function LiveDetailScreen() {
|
|||||||
(match.league_name &&
|
(match.league_name &&
|
||||||
/ATP|WTA|ITF|Challenger/i.test(match.league_name || ""));
|
/ATP|WTA|ITF|Challenger/i.test(match.league_name || ""));
|
||||||
|
|
||||||
|
if (numericSportId === 2 && convertToMatchDetailData) {
|
||||||
|
switch (activeTab) {
|
||||||
|
case "stats":
|
||||||
|
return <BasketballStats data={convertToMatchDetailData} isDark={isDark} />;
|
||||||
|
case "overall":
|
||||||
|
return <BasketballOverallStats data={convertToMatchDetailData} isDark={isDark} />;
|
||||||
|
case "odds":
|
||||||
|
return (
|
||||||
|
<OddsCard match={match} isDark={isDark} sportId={numericSportId} />
|
||||||
|
);
|
||||||
|
case "detail":
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<BasketballScoreTable data={convertToMatchDetailData} isDark={isDark} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
<View style={styles.center}>
|
||||||
|
<ThemedText style={{ opacity: 0.5 }}>
|
||||||
|
{t("detail.empty_stats")}
|
||||||
|
</ThemedText>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (activeTab) {
|
switch (activeTab) {
|
||||||
case "stats":
|
case "stats":
|
||||||
return !isTennis ? (
|
return !isTennis ? (
|
||||||
@@ -165,6 +257,7 @@ export default function LiveDetailScreen() {
|
|||||||
activeTab={activeTab}
|
activeTab={activeTab}
|
||||||
onTabChange={setActiveTab}
|
onTabChange={setActiveTab}
|
||||||
isDark={isDark}
|
isDark={isDark}
|
||||||
|
sportId={parseInt(sport_id || "1")}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{renderTabContent()}
|
{renderTabContent()}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { OddsCard } from "@/components/live-detail/odds-card";
|
import { OddsCard } from "@/components/live-detail/odds-card";
|
||||||
|
import { BasketballOverallStats } from "@/components/match-detail/basketball/basketball-overall-stats";
|
||||||
import { BasketballScoreTable } from "@/components/match-detail/basketball/basketball-score-table";
|
import { BasketballScoreTable } from "@/components/match-detail/basketball/basketball-score-table";
|
||||||
|
import { BasketballStats } from "@/components/match-detail/basketball/basketball-stats";
|
||||||
import { CardsCard } from "@/components/match-detail/football/cards-card";
|
import { CardsCard } from "@/components/match-detail/football/cards-card";
|
||||||
import { FootballScoreTable } from "@/components/match-detail/football/football-score-table";
|
import { FootballScoreTable } from "@/components/match-detail/football/football-score-table";
|
||||||
import { GoalsCard } from "@/components/match-detail/football/goals-card";
|
import { GoalsCard } from "@/components/match-detail/football/goals-card";
|
||||||
@@ -59,7 +61,7 @@ export default function MatchDetailScreen() {
|
|||||||
validTabs = ["info", "stats", "odds", "h2h", "chat"];
|
validTabs = ["info", "stats", "odds", "h2h", "chat"];
|
||||||
} else if (sportId === 2) {
|
} else if (sportId === 2) {
|
||||||
// 篮球
|
// 篮球
|
||||||
validTabs = ["info", "h2h", "chat"];
|
validTabs = ["info", "stats", "overall", "h2h", "chat"];
|
||||||
} else if (sportId === 3) {
|
} else if (sportId === 3) {
|
||||||
// 网球
|
// 网球
|
||||||
validTabs = ["info", "chat"];
|
validTabs = ["info", "chat"];
|
||||||
@@ -81,8 +83,8 @@ export default function MatchDetailScreen() {
|
|||||||
setError(null);
|
setError(null);
|
||||||
const result = await fetchMatchDetail(id as string);
|
const result = await fetchMatchDetail(id as string);
|
||||||
setData(result);
|
setData(result);
|
||||||
console.log("首发阵容", result.match.players?.away_team);
|
// console.log("首发阵容", result.match.players?.away_team);
|
||||||
console.log("红黄牌", result.events);
|
// console.log("红黄牌", result.events);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -163,6 +165,9 @@ export default function MatchDetailScreen() {
|
|||||||
<LineupsCard data={data} isDark={isDark} />
|
<LineupsCard data={data} isDark={isDark} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
} else if (sportId === 2) {
|
||||||
|
// 篮球:显示统计数据
|
||||||
|
return <BasketballStats data={data} isDark={isDark} />;
|
||||||
} else {
|
} else {
|
||||||
// 其他运动暂时显示空状态
|
// 其他运动暂时显示空状态
|
||||||
return (
|
return (
|
||||||
@@ -173,6 +178,8 @@ export default function MatchDetailScreen() {
|
|||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
case "overall":
|
||||||
|
return <BasketballOverallStats data={data} isDark={isDark} />;
|
||||||
case "odds":
|
case "odds":
|
||||||
// 将 MatchDetailData.match 转换为 LiveScoreMatch 格式
|
// 将 MatchDetailData.match 转换为 LiveScoreMatch 格式
|
||||||
const matchForOdds = {
|
const matchForOdds = {
|
||||||
|
|||||||
@@ -8,31 +8,53 @@ interface LiveMatchTabsProps {
|
|||||||
activeTab: string;
|
activeTab: string;
|
||||||
onTabChange: (tab: string) => void;
|
onTabChange: (tab: string) => void;
|
||||||
isDark: boolean;
|
isDark: boolean;
|
||||||
|
sportId?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function LiveMatchTabs({
|
export function LiveMatchTabs({
|
||||||
activeTab,
|
activeTab,
|
||||||
onTabChange,
|
onTabChange,
|
||||||
isDark,
|
isDark,
|
||||||
|
sportId = 1,
|
||||||
}: LiveMatchTabsProps) {
|
}: LiveMatchTabsProps) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const containerBg = isDark ? "#121212" : "#F5F5F5";
|
const containerBg = isDark ? "#121212" : "#F5F5F5";
|
||||||
|
|
||||||
const tabs = [
|
const getTabs = () => {
|
||||||
{
|
if (sportId === 2) {
|
||||||
id: "detail",
|
return [
|
||||||
label: t("detail.tabs.info"),
|
{
|
||||||
icon: "document-text-outline",
|
id: "detail",
|
||||||
},
|
label: t("detail.tabs.info"),
|
||||||
{ id: "stats", label: t("detail.tabs.stats"), icon: "stats-chart-outline" },
|
icon: "document-text-outline",
|
||||||
{ id: "odds", label: t("detail.tabs.odds"), icon: "cash-outline" },
|
},
|
||||||
{ id: "lineup", label: t("detail.tabs.lineup"), icon: "shirt-outline" },
|
{ id: "stats", label: t("detail.tabs.stats"), icon: "stats-chart-outline" },
|
||||||
{
|
{
|
||||||
id: "analysis",
|
id: "overall",
|
||||||
label: t("detail.tabs.analysis"),
|
label: t("detail.tabs.overall"),
|
||||||
icon: "pie-chart-outline",
|
icon: "bar-chart-outline",
|
||||||
},
|
},
|
||||||
];
|
{ id: "odds", label: t("detail.tabs.odds"), icon: "cash-outline" },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: "detail",
|
||||||
|
label: t("detail.tabs.info"),
|
||||||
|
icon: "document-text-outline",
|
||||||
|
},
|
||||||
|
{ id: "stats", label: t("detail.tabs.stats"), icon: "stats-chart-outline" },
|
||||||
|
{ id: "odds", label: t("detail.tabs.odds"), icon: "cash-outline" },
|
||||||
|
{ id: "lineup", label: t("detail.tabs.lineup"), icon: "shirt-outline" },
|
||||||
|
{
|
||||||
|
id: "analysis",
|
||||||
|
label: t("detail.tabs.analysis"),
|
||||||
|
icon: "pie-chart-outline",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
const tabs = getTabs();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container, { backgroundColor: containerBg }]}>
|
<View style={[styles.container, { backgroundColor: containerBg }]}>
|
||||||
|
|||||||
285
components/match-detail/basketball/basketball-overall-stats.tsx
Normal file
285
components/match-detail/basketball/basketball-overall-stats.tsx
Normal file
@@ -0,0 +1,285 @@
|
|||||||
|
import { ThemedText } from "@/components/themed-text";
|
||||||
|
import { MatchDetailData } from "@/types/api";
|
||||||
|
import { LinearGradient } from "expo-linear-gradient";
|
||||||
|
import React, { useEffect } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { StyleSheet, View } from "react-native";
|
||||||
|
|
||||||
|
interface BasketballOverallStatsProps {
|
||||||
|
data: MatchDetailData;
|
||||||
|
isDark: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
type StatItem = {
|
||||||
|
type: string;
|
||||||
|
home: string | number;
|
||||||
|
away: string | number;
|
||||||
|
};
|
||||||
|
|
||||||
|
function toNumber(v: unknown): number {
|
||||||
|
if (typeof v === "number") return Number.isFinite(v) ? v : 0;
|
||||||
|
if (typeof v === "string") {
|
||||||
|
const cleaned = v.trim().replace("%", "");
|
||||||
|
const n = Number(cleaned);
|
||||||
|
return Number.isFinite(n) ? n : 0;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function BasketballOverallStats({ data, isDark }: BasketballOverallStatsProps) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("=== Basketball Overall Stats Loaded ===");
|
||||||
|
console.log(JSON.stringify(data.match.stats, null, 2));
|
||||||
|
}, [data.match.stats]);
|
||||||
|
|
||||||
|
const stats = (data.match.stats || []) as StatItem[];
|
||||||
|
|
||||||
|
const getStatLabel = (type: string): string => {
|
||||||
|
const key = `detail.overall_stats.${type.toLowerCase().replace(/\s+/g, "_")}`;
|
||||||
|
const translated = t(key);
|
||||||
|
return translated !== key ? translated : type;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!Array.isArray(stats) || stats.length === 0) {
|
||||||
|
return (
|
||||||
|
<View style={styles.empty}>
|
||||||
|
<ThemedText style={[styles.emptyText, { color: isDark ? "#A1A1AA" : "#6B7280" }]}>
|
||||||
|
{t("detail.empty_stats")}
|
||||||
|
</ThemedText>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.wrap,
|
||||||
|
{ backgroundColor: isDark ? "#151517" : "#F3F4F6" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{/* Card */}
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
styles.card,
|
||||||
|
{ backgroundColor: isDark ? "#1C1C1E" : "#FFFFFF" },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
{stats.map((item, index) => {
|
||||||
|
const home = toNumber(item.home);
|
||||||
|
const away = toNumber(item.away);
|
||||||
|
const maxV = Math.max(home, away, 1);
|
||||||
|
|
||||||
|
const homeLeading = home >= away;
|
||||||
|
const awayLeading = away > home;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
key={`${item.type}-${index}`}
|
||||||
|
style={[
|
||||||
|
styles.row,
|
||||||
|
index !== stats.length - 1 && {
|
||||||
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||||
|
borderBottomColor: isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.06)",
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<View style={styles.rowHeader}>
|
||||||
|
<ValuePill
|
||||||
|
text={`${home}`}
|
||||||
|
variant="home"
|
||||||
|
isDark={isDark}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<ThemedText
|
||||||
|
style={[
|
||||||
|
styles.title,
|
||||||
|
{ color: isDark ? "#EAEAF0" : "#111827" },
|
||||||
|
]}
|
||||||
|
numberOfLines={1}
|
||||||
|
>
|
||||||
|
{getStatLabel(item.type)}
|
||||||
|
</ThemedText>
|
||||||
|
|
||||||
|
<ValuePill
|
||||||
|
text={`${away}`}
|
||||||
|
variant={awayLeading ? "awayLeading" : "away"}
|
||||||
|
isDark={isDark}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
<CompareBar
|
||||||
|
home={home}
|
||||||
|
away={away}
|
||||||
|
maxV={maxV}
|
||||||
|
isDark={isDark}
|
||||||
|
homeLeading={homeLeading}
|
||||||
|
awayLeading={awayLeading}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ValuePill({
|
||||||
|
text,
|
||||||
|
variant,
|
||||||
|
isDark,
|
||||||
|
}: {
|
||||||
|
text: string;
|
||||||
|
variant: "home" | "away" | "awayLeading";
|
||||||
|
isDark: boolean;
|
||||||
|
}) {
|
||||||
|
const common = {
|
||||||
|
start: { x: 0, y: 0 },
|
||||||
|
end: { x: 1, y: 0 },
|
||||||
|
style: styles.pill,
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// 蓝色:主队/默认;金色:客队领先
|
||||||
|
const blue = isDark
|
||||||
|
? ["#0B2A73", "#0E4BFF"]
|
||||||
|
: ["#1D4ED8", "#2563EB"];
|
||||||
|
const gold = isDark
|
||||||
|
? ["#3A2A00", "#C08B00"]
|
||||||
|
: ["#B45309", "#D97706"];
|
||||||
|
|
||||||
|
const colors =
|
||||||
|
variant === "awayLeading"
|
||||||
|
? gold
|
||||||
|
: blue;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LinearGradient colors={[...colors] as [string, string]} {...common}>
|
||||||
|
<ThemedText style={styles.pillText}>{text}</ThemedText>
|
||||||
|
</LinearGradient>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CompareBar({
|
||||||
|
home,
|
||||||
|
away,
|
||||||
|
maxV,
|
||||||
|
isDark,
|
||||||
|
homeLeading,
|
||||||
|
awayLeading,
|
||||||
|
}: {
|
||||||
|
home: number;
|
||||||
|
away: number;
|
||||||
|
maxV: number;
|
||||||
|
isDark: boolean;
|
||||||
|
homeLeading: boolean;
|
||||||
|
awayLeading: boolean;
|
||||||
|
}) {
|
||||||
|
const SIDE_MAX = 150;
|
||||||
|
const GAP = 10;
|
||||||
|
|
||||||
|
const homeW = Math.max(2, Math.round((home / maxV) * SIDE_MAX));
|
||||||
|
const awayW = Math.max(2, Math.round((away / maxV) * SIDE_MAX));
|
||||||
|
|
||||||
|
const track = isDark ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.10)";
|
||||||
|
const muted = isDark ? "rgba(255,255,255,0.18)" : "rgba(0,0,0,0.18)";
|
||||||
|
const blue = "#1F5BFF";
|
||||||
|
const gold = "#C08B00";
|
||||||
|
|
||||||
|
const homeColor = homeLeading ? blue : muted;
|
||||||
|
const awayColor = awayLeading ? gold : muted;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={[styles.barWrap, { width: SIDE_MAX * 2 + GAP }]}>
|
||||||
|
<View style={[styles.barTrack, { backgroundColor: track }]} />
|
||||||
|
<View style={[styles.barSide, { width: SIDE_MAX, justifyContent: "flex-end" }]}>
|
||||||
|
<View style={[styles.barFill, { width: homeW, backgroundColor: homeColor }]} />
|
||||||
|
</View>
|
||||||
|
<View style={{ width: GAP }} />
|
||||||
|
<View style={[styles.barSide, { width: SIDE_MAX, justifyContent: "flex-start" }]}>
|
||||||
|
<View style={[styles.barFill, { width: awayW, backgroundColor: awayColor }]} />
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ----------------- Styles ----------------- */
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
wrap: {
|
||||||
|
paddingHorizontal: 14,
|
||||||
|
paddingTop: 12,
|
||||||
|
paddingBottom: 16,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
borderRadius: 18,
|
||||||
|
paddingVertical: 6,
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
|
|
||||||
|
row: {
|
||||||
|
paddingHorizontal: 14,
|
||||||
|
paddingVertical: 14,
|
||||||
|
},
|
||||||
|
rowHeader: {
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
},
|
||||||
|
|
||||||
|
pill: {
|
||||||
|
minWidth: 54,
|
||||||
|
height: 30,
|
||||||
|
borderRadius: 16,
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
},
|
||||||
|
pillText: {
|
||||||
|
color: "#FFFFFF",
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: "800",
|
||||||
|
letterSpacing: 0.3,
|
||||||
|
},
|
||||||
|
|
||||||
|
title: {
|
||||||
|
flex: 1,
|
||||||
|
textAlign: "center",
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: "700",
|
||||||
|
paddingHorizontal: 10,
|
||||||
|
},
|
||||||
|
|
||||||
|
barWrap: {
|
||||||
|
alignSelf: "center",
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
marginTop: 10,
|
||||||
|
height: 8,
|
||||||
|
position: "relative",
|
||||||
|
},
|
||||||
|
barTrack: {
|
||||||
|
position: "absolute",
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
height: 6,
|
||||||
|
borderRadius: 999,
|
||||||
|
},
|
||||||
|
barSide: {
|
||||||
|
height: 8,
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
},
|
||||||
|
barFill: {
|
||||||
|
height: 6,
|
||||||
|
borderRadius: 999,
|
||||||
|
},
|
||||||
|
|
||||||
|
empty: {
|
||||||
|
padding: 40,
|
||||||
|
alignItems: "center",
|
||||||
|
},
|
||||||
|
emptyText: {
|
||||||
|
fontSize: 14,
|
||||||
|
opacity: 0.85,
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -16,22 +16,81 @@ export function BasketballScoreTable({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { match } = data;
|
const { match } = data;
|
||||||
const bgColor = isDark ? "#1C1C1E" : "#FFF";
|
const bgColor = isDark ? "#1C1C1E" : "#FFF";
|
||||||
|
const borderColor = isDark ? "#2C2C2E" : "rgba(0,0,0,0.06)";
|
||||||
const headerTextColor = isDark ? "#666" : "#999";
|
const headerTextColor = isDark ? "#666" : "#999";
|
||||||
|
const textColor = isDark ? "#FFF" : "#000";
|
||||||
|
|
||||||
// 解析比分 - 篮球通常是 4 节
|
// 解析篮球比分 - 从 scores 对象获取四节比分
|
||||||
const parseScore = (scoreString: string) => {
|
const parseBasketballScores = () => {
|
||||||
if (!scoreString || scoreString === "-") return [0, 0, 0, 0, 0];
|
const scores = match.scores as any;
|
||||||
// 假设格式可能是 "25-20,30-28,22-25,28-26" 或类似
|
if (!scores || typeof scores !== "object") {
|
||||||
// 这里简化处理,实际需要根据 API 返回格式解析
|
// 如果没有 scores 对象,尝试从 eventFinalResult 解析
|
||||||
return [0, 0, 0, 0, 0]; // total, q1, q2, q3, q4
|
const finalResult = match.eventFinalResult || "-";
|
||||||
|
const matchResult = finalResult.match(/(\d+)\s*[-–]\s*(\d+)/);
|
||||||
|
if (matchResult) {
|
||||||
|
return {
|
||||||
|
home: {
|
||||||
|
total: parseInt(matchResult[1], 10),
|
||||||
|
q1: 0,
|
||||||
|
q2: 0,
|
||||||
|
q3: 0,
|
||||||
|
q4: 0,
|
||||||
|
},
|
||||||
|
away: {
|
||||||
|
total: parseInt(matchResult[2], 10),
|
||||||
|
q1: 0,
|
||||||
|
q2: 0,
|
||||||
|
q3: 0,
|
||||||
|
q4: 0,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
home: { total: 0, q1: 0, q2: 0, q3: 0, q4: 0 },
|
||||||
|
away: { total: 0, q1: 0, q2: 0, q3: 0, q4: 0 },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const q1 = scores["1stQuarter"]?.[0] || { score_home: "0", score_away: "0" };
|
||||||
|
const q2 = scores["2ndQuarter"]?.[0] || { score_home: "0", score_away: "0" };
|
||||||
|
const q3 = scores["3rdQuarter"]?.[0] || { score_home: "0", score_away: "0" };
|
||||||
|
const q4 = scores["4thQuarter"]?.[0] || { score_home: "0", score_away: "0" };
|
||||||
|
|
||||||
|
const homeQ1 = parseInt(q1.score_home || "0", 10);
|
||||||
|
const homeQ2 = parseInt(q2.score_home || "0", 10);
|
||||||
|
const homeQ3 = parseInt(q3.score_home || "0", 10);
|
||||||
|
const homeQ4 = parseInt(q4.score_home || "0", 10);
|
||||||
|
const homeTotal = homeQ1 + homeQ2 + homeQ3 + homeQ4;
|
||||||
|
|
||||||
|
const awayQ1 = parseInt(q1.score_away || "0", 10);
|
||||||
|
const awayQ2 = parseInt(q2.score_away || "0", 10);
|
||||||
|
const awayQ3 = parseInt(q3.score_away || "0", 10);
|
||||||
|
const awayQ4 = parseInt(q4.score_away || "0", 10);
|
||||||
|
const awayTotal = awayQ1 + awayQ2 + awayQ3 + awayQ4;
|
||||||
|
|
||||||
|
return {
|
||||||
|
home: {
|
||||||
|
total: homeTotal,
|
||||||
|
q1: homeQ1,
|
||||||
|
q2: homeQ2,
|
||||||
|
q3: homeQ3,
|
||||||
|
q4: homeQ4,
|
||||||
|
},
|
||||||
|
away: {
|
||||||
|
total: awayTotal,
|
||||||
|
q1: awayQ1,
|
||||||
|
q2: awayQ2,
|
||||||
|
q3: awayQ3,
|
||||||
|
q4: awayQ4,
|
||||||
|
},
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const homeScores = parseScore(match.eventFinalResult || "-");
|
const scoreData = parseBasketballScores();
|
||||||
const awayScores = parseScore(match.eventFinalResult || "-");
|
|
||||||
|
|
||||||
const headers = [
|
const headers = [
|
||||||
t("detail.score_table.team"),
|
t("detail.score_table.team") || "Team",
|
||||||
t("detail.score_table.total"),
|
t("detail.score_table.total") || "Total",
|
||||||
"1",
|
"1",
|
||||||
"2",
|
"2",
|
||||||
"3",
|
"3",
|
||||||
@@ -42,26 +101,26 @@ export function BasketballScoreTable({
|
|||||||
{
|
{
|
||||||
logo: match.homeTeamLogo,
|
logo: match.homeTeamLogo,
|
||||||
name: match.eventHomeTeam,
|
name: match.eventHomeTeam,
|
||||||
total: homeScores[0],
|
total: scoreData.home.total,
|
||||||
q1: homeScores[1],
|
q1: scoreData.home.q1,
|
||||||
q2: homeScores[2],
|
q2: scoreData.home.q2,
|
||||||
q3: homeScores[3],
|
q3: scoreData.home.q3,
|
||||||
q4: homeScores[4],
|
q4: scoreData.home.q4,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
logo: match.awayTeamLogo,
|
logo: match.awayTeamLogo,
|
||||||
name: match.eventAwayTeam,
|
name: match.eventAwayTeam,
|
||||||
total: awayScores[0],
|
total: scoreData.away.total,
|
||||||
q1: awayScores[1],
|
q1: scoreData.away.q1,
|
||||||
q2: awayScores[2],
|
q2: scoreData.away.q2,
|
||||||
q3: awayScores[3],
|
q3: scoreData.away.q3,
|
||||||
q4: awayScores[4],
|
q4: scoreData.away.q4,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={[styles.container, { backgroundColor: bgColor }]}>
|
<View style={[styles.container, { backgroundColor: bgColor, borderColor }]}>
|
||||||
<View style={styles.header}>
|
<View style={[styles.header, { borderBottomColor: borderColor }]}>
|
||||||
{headers.map((h, i) => (
|
{headers.map((h, i) => (
|
||||||
<ThemedText
|
<ThemedText
|
||||||
key={h}
|
key={h}
|
||||||
@@ -80,20 +139,22 @@ export function BasketballScoreTable({
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
{rows.map((row, idx) => (
|
{rows.map((row, idx) => (
|
||||||
<View key={idx} style={[styles.row, idx === 0 && styles.rowBorder]}>
|
<View key={idx} style={[styles.row, idx === 0 && { borderBottomColor: borderColor, borderBottomWidth: 1 }]}>
|
||||||
<View style={styles.teamCell}>
|
<View style={styles.teamCell}>
|
||||||
<Image source={{ uri: row.logo }} style={styles.teamLogo} />
|
{row.logo && row.logo.trim() !== "" && !row.logo.includes("placehold") ? (
|
||||||
<ThemedText style={styles.teamName} numberOfLines={1}>
|
<Image source={{ uri: row.logo }} style={styles.teamLogo} />
|
||||||
|
) : null}
|
||||||
|
<ThemedText style={[styles.teamName, { color: textColor }]} numberOfLines={1}>
|
||||||
{row.name}
|
{row.name}
|
||||||
</ThemedText>
|
</ThemedText>
|
||||||
</View>
|
</View>
|
||||||
<ThemedText style={[styles.cellText, styles.totalText]}>
|
<ThemedText style={[styles.cellText, styles.totalText, { color: textColor }]}>
|
||||||
{row.total}
|
{row.total}
|
||||||
</ThemedText>
|
</ThemedText>
|
||||||
<ThemedText style={styles.cellText}>{row.q1}</ThemedText>
|
<ThemedText style={[styles.cellText, { color: textColor }]}>{row.q1}</ThemedText>
|
||||||
<ThemedText style={styles.cellText}>{row.q2}</ThemedText>
|
<ThemedText style={[styles.cellText, { color: textColor }]}>{row.q2}</ThemedText>
|
||||||
<ThemedText style={styles.cellText}>{row.q3}</ThemedText>
|
<ThemedText style={[styles.cellText, { color: textColor }]}>{row.q3}</ThemedText>
|
||||||
<ThemedText style={styles.cellText}>{row.q4}</ThemedText>
|
<ThemedText style={[styles.cellText, { color: textColor }]}>{row.q4}</ThemedText>
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
</View>
|
</View>
|
||||||
@@ -103,20 +164,16 @@ export function BasketballScoreTable({
|
|||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
marginHorizontal: 16,
|
marginHorizontal: 16,
|
||||||
marginBottom: 16,
|
marginTop: 12,
|
||||||
borderRadius: 16,
|
borderRadius: 16,
|
||||||
padding: 20,
|
padding: 20,
|
||||||
elevation: 2,
|
borderWidth: 1,
|
||||||
shadowColor: "#000",
|
overflow: "hidden",
|
||||||
shadowOffset: { width: 0, height: 2 },
|
|
||||||
shadowOpacity: 0.05,
|
|
||||||
shadowRadius: 8,
|
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
paddingBottom: 16,
|
paddingBottom: 16,
|
||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
borderBottomColor: "rgba(150,150,150,0.1)",
|
|
||||||
},
|
},
|
||||||
headerText: {
|
headerText: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@@ -128,10 +185,6 @@ const styles = StyleSheet.create({
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
paddingVertical: 14,
|
paddingVertical: 14,
|
||||||
},
|
},
|
||||||
rowBorder: {
|
|
||||||
borderBottomWidth: 1,
|
|
||||||
borderBottomColor: "rgba(150,150,150,0.1)",
|
|
||||||
},
|
|
||||||
teamCell: {
|
teamCell: {
|
||||||
flex: 3,
|
flex: 3,
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
@@ -146,7 +199,7 @@ const styles = StyleSheet.create({
|
|||||||
teamName: {
|
teamName: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: "700",
|
fontWeight: "600",
|
||||||
},
|
},
|
||||||
cellText: {
|
cellText: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|||||||
407
components/match-detail/basketball/basketball-stats.tsx
Normal file
407
components/match-detail/basketball/basketball-stats.tsx
Normal file
@@ -0,0 +1,407 @@
|
|||||||
|
import { ThemedText } from "@/components/themed-text";
|
||||||
|
import { IconSymbol } from "@/components/ui/icon-symbol";
|
||||||
|
import { getInitials, getLogoGradient } from "@/lib/avatar-utils";
|
||||||
|
import { MatchDetailData } from "@/types/api";
|
||||||
|
import { Image } from "expo-image";
|
||||||
|
import { LinearGradient } from "expo-linear-gradient";
|
||||||
|
import React, { useMemo, useState } from "react";
|
||||||
|
import {
|
||||||
|
ScrollView,
|
||||||
|
StyleSheet,
|
||||||
|
Switch,
|
||||||
|
TouchableOpacity,
|
||||||
|
View
|
||||||
|
} from "react-native";
|
||||||
|
|
||||||
|
interface BasketballStatsProps {
|
||||||
|
data: MatchDetailData;
|
||||||
|
isDark: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义固定高度以保证左右对齐
|
||||||
|
const HEADER_HEIGHT = 40;
|
||||||
|
const ROW_HEIGHT = 60;
|
||||||
|
const LEFT_COLUMN_WIDTH = 150;
|
||||||
|
|
||||||
|
const COLUMNS_BASIC = [
|
||||||
|
{ key: "pts", label: "PTS", width: 50 },
|
||||||
|
{ key: "reb", label: "REB", width: 50 },
|
||||||
|
{ key: "ast", label: "AST", width: 50 },
|
||||||
|
];
|
||||||
|
|
||||||
|
const COLUMNS_DETAILED = [
|
||||||
|
{ key: "min", label: "MIN", width: 50 },
|
||||||
|
{ key: "pts", label: "PTS", width: 50 },
|
||||||
|
{ key: "reb", label: "REB", width: 50 },
|
||||||
|
{ key: "ast", label: "AST", width: 50 },
|
||||||
|
{ key: "blk", label: "BLK", width: 50 },
|
||||||
|
{ key: "stl", label: "STL", width: 50 },
|
||||||
|
{ key: "to", label: "TO", width: 50 },
|
||||||
|
{ key: "pf", label: "PF", width: 50 },
|
||||||
|
];
|
||||||
|
|
||||||
|
export function BasketballStats({ data, isDark }: BasketballStatsProps) {
|
||||||
|
const { match } = data;
|
||||||
|
const [activeTab, setActiveTab] = useState<"home" | "away">("home");
|
||||||
|
const [isDetailed, setIsDetailed] = useState(false);
|
||||||
|
|
||||||
|
// 获取当前展示的球员列表
|
||||||
|
const currentPlayers = useMemo(() => {
|
||||||
|
if (!match.players) return [];
|
||||||
|
return activeTab === "home"
|
||||||
|
? match.players.home_team
|
||||||
|
: match.players.away_team;
|
||||||
|
}, [match.players, activeTab]);
|
||||||
|
|
||||||
|
const columns = isDetailed ? COLUMNS_DETAILED : COLUMNS_BASIC;
|
||||||
|
|
||||||
|
const getPlayerStat = (player: any, statKey: string): string => {
|
||||||
|
const statMap: Record<string, string> = {
|
||||||
|
pts: player.player_points || "0",
|
||||||
|
reb: player.player_total_rebounds || "0",
|
||||||
|
ast: player.player_assists || "0",
|
||||||
|
min: player.player_minutes || "0",
|
||||||
|
blk: player.player_blocks || "0",
|
||||||
|
stl: player.player_steals || "0",
|
||||||
|
to: player.player_turnovers || "0",
|
||||||
|
pf: player.player_personal_fouls || "0",
|
||||||
|
};
|
||||||
|
const value = statMap[statKey] || "0";
|
||||||
|
return value === "-" || value === "" ? "0" : value;
|
||||||
|
};
|
||||||
|
|
||||||
|
const bgColor = isDark ? "#1C1C1E" : "#FFF";
|
||||||
|
const borderColor = isDark ? "#2C2C2E" : "rgba(0,0,0,0.06)";
|
||||||
|
const textColor = isDark ? "#FFF" : "#000";
|
||||||
|
const secondaryText = isDark ? "#8E8E93" : "#6B7280";
|
||||||
|
|
||||||
|
// --- 渲染组件 ---
|
||||||
|
|
||||||
|
// 1. 左上角:Player 表头
|
||||||
|
const renderLeftHeader = () => (
|
||||||
|
<View style={[styles.headerCell, { height: HEADER_HEIGHT, borderBottomColor: borderColor }]}>
|
||||||
|
<ThemedText style={[styles.headerText, { color: secondaryText }]}>
|
||||||
|
Player
|
||||||
|
</ThemedText>
|
||||||
|
<IconSymbol
|
||||||
|
name="information-circle-outline"
|
||||||
|
size={14}
|
||||||
|
color={secondaryText}
|
||||||
|
style={{ marginLeft: 4 }}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
|
||||||
|
// 2. 左侧列:球员信息行
|
||||||
|
const renderLeftPlayerRow = (player: any) => {
|
||||||
|
const playerName = player.player || "";
|
||||||
|
const playerPosition = player.player_position || "";
|
||||||
|
const gradient = getLogoGradient(playerName);
|
||||||
|
const initials = getInitials(playerName);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={[styles.playerRow, { height: ROW_HEIGHT, borderBottomColor: borderColor }]}>
|
||||||
|
<View style={styles.avatarContainer}>
|
||||||
|
<LinearGradient
|
||||||
|
colors={[gradient.color1, gradient.color2]}
|
||||||
|
start={{ x: 0, y: 0 }}
|
||||||
|
end={{ x: 1, y: 1 }}
|
||||||
|
style={styles.avatarGradient}
|
||||||
|
>
|
||||||
|
<ThemedText style={styles.avatarText}>{initials}</ThemedText>
|
||||||
|
</LinearGradient>
|
||||||
|
</View>
|
||||||
|
<View style={styles.playerInfo}>
|
||||||
|
<ThemedText
|
||||||
|
style={[styles.playerName, { color: textColor }]}
|
||||||
|
numberOfLines={1}
|
||||||
|
>
|
||||||
|
{playerName}
|
||||||
|
</ThemedText>
|
||||||
|
{playerPosition && (
|
||||||
|
<ThemedText style={[styles.playerNumPos, { color: secondaryText }]}>
|
||||||
|
{playerPosition}
|
||||||
|
</ThemedText>
|
||||||
|
)}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 3. 右上角:数据表头
|
||||||
|
const renderRightHeader = () => (
|
||||||
|
<View style={[styles.dataHeaderRow, { height: HEADER_HEIGHT, borderBottomColor: borderColor }]}>
|
||||||
|
{columns.map((col) => (
|
||||||
|
<View key={col.key} style={{ width: col.width, alignItems: "center" }}>
|
||||||
|
<ThemedText style={[styles.headerText, { color: secondaryText }]}>
|
||||||
|
{col.label}
|
||||||
|
</ThemedText>
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
|
||||||
|
// 4. 右侧列:数据行
|
||||||
|
const renderRightDataRow = (player: any) => (
|
||||||
|
<View style={[styles.dataRow, { height: ROW_HEIGHT, borderBottomColor: borderColor }]}>
|
||||||
|
{columns.map((col) => (
|
||||||
|
<View key={col.key} style={{ width: col.width, alignItems: "center" }}>
|
||||||
|
<ThemedText style={[styles.statText, { color: textColor }]}>
|
||||||
|
{getPlayerStat(player, col.key)}
|
||||||
|
</ThemedText>
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
|
||||||
|
// 队名/Logo逻辑
|
||||||
|
const homeTeamName = match.eventHomeTeam || "";
|
||||||
|
const awayTeamName = match.eventAwayTeam || "";
|
||||||
|
const homeTeamLogo = match.homeTeamLogo || "";
|
||||||
|
const awayTeamLogo = match.awayTeamLogo || "";
|
||||||
|
const hasHomeLogo = homeTeamLogo && homeTeamLogo.trim() !== "" && !homeTeamLogo.includes("placehold");
|
||||||
|
const hasAwayLogo = awayTeamLogo && awayTeamLogo.trim() !== "" && !awayTeamLogo.includes("placehold");
|
||||||
|
const homeGradient = getLogoGradient(homeTeamName);
|
||||||
|
const awayGradient = getLogoGradient(awayTeamName);
|
||||||
|
const homeInitials = getInitials(homeTeamName);
|
||||||
|
const awayInitials = getInitials(awayTeamName);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<View style={[styles.container, { backgroundColor: bgColor }]}>
|
||||||
|
{/* 顶部控制栏 */}
|
||||||
|
<View style={styles.controlsHeader}>
|
||||||
|
<View>
|
||||||
|
<ThemedText style={[styles.controlTitle, { color: textColor }]}>
|
||||||
|
统计外观
|
||||||
|
</ThemedText>
|
||||||
|
<ThemedText style={[styles.controlSubtitle, { color: secondaryText }]}>
|
||||||
|
详细视图
|
||||||
|
</ThemedText>
|
||||||
|
</View>
|
||||||
|
<Switch
|
||||||
|
value={isDetailed}
|
||||||
|
onValueChange={setIsDetailed}
|
||||||
|
trackColor={{ false: isDark ? "#3e3e3e" : "#E5E5E5", true: "#FF9500" }}
|
||||||
|
thumbColor={"#fff"}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 队伍切换 Tab */}
|
||||||
|
<View style={[styles.teamTabsContainer, { backgroundColor: isDark ? "#2C2C2E" : "#F5F5F5" }]}>
|
||||||
|
<TouchableOpacity
|
||||||
|
style={[
|
||||||
|
styles.teamTab,
|
||||||
|
activeTab === "home" && { backgroundColor: isDark ? "#1C1C1E" : "#FFF" },
|
||||||
|
{ borderTopLeftRadius: 8, borderBottomLeftRadius: 8 },
|
||||||
|
]}
|
||||||
|
onPress={() => setActiveTab("home")}
|
||||||
|
>
|
||||||
|
{hasHomeLogo ? (
|
||||||
|
<Image source={{ uri: homeTeamLogo }} style={styles.teamTabLogo} contentFit="contain" />
|
||||||
|
) : (
|
||||||
|
<LinearGradient
|
||||||
|
colors={[homeGradient.color1, homeGradient.color2]}
|
||||||
|
style={styles.teamTabLogoGradient}
|
||||||
|
>
|
||||||
|
<ThemedText style={styles.teamTabLogoText}>{homeInitials}</ThemedText>
|
||||||
|
</LinearGradient>
|
||||||
|
)}
|
||||||
|
</TouchableOpacity>
|
||||||
|
<TouchableOpacity
|
||||||
|
style={[
|
||||||
|
styles.teamTab,
|
||||||
|
activeTab === "away" && { backgroundColor: isDark ? "#1C1C1E" : "#FFF" },
|
||||||
|
{ borderTopRightRadius: 8, borderBottomRightRadius: 8 },
|
||||||
|
]}
|
||||||
|
onPress={() => setActiveTab("away")}
|
||||||
|
>
|
||||||
|
{hasAwayLogo ? (
|
||||||
|
<Image source={{ uri: awayTeamLogo }} style={styles.teamTabLogo} contentFit="contain" />
|
||||||
|
) : (
|
||||||
|
<LinearGradient
|
||||||
|
colors={[awayGradient.color1, awayGradient.color2]}
|
||||||
|
style={styles.teamTabLogoGradient}
|
||||||
|
>
|
||||||
|
<ThemedText style={styles.teamTabLogoText}>{awayInitials}</ThemedText>
|
||||||
|
</LinearGradient>
|
||||||
|
)}
|
||||||
|
</TouchableOpacity>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 核心表格区域:Vertical ScrollView 包裹整个表格 */}
|
||||||
|
<ScrollView
|
||||||
|
style={[styles.tableContainer, { borderColor }]}
|
||||||
|
showsVerticalScrollIndicator={false}
|
||||||
|
>
|
||||||
|
<View style={{ flexDirection: "row" }}>
|
||||||
|
|
||||||
|
{/* 左侧区域:固定不横向滚动 */}
|
||||||
|
<View style={{ width: LEFT_COLUMN_WIDTH, borderRightWidth: StyleSheet.hairlineWidth, borderColor }}>
|
||||||
|
{/* Header */}
|
||||||
|
{renderLeftHeader()}
|
||||||
|
{/* Players List */}
|
||||||
|
<View>
|
||||||
|
{currentPlayers?.map((player, index) => (
|
||||||
|
<View key={`left-${player.player_id || index}`}>
|
||||||
|
{renderLeftPlayerRow(player)}
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* 右侧区域:整体横向滚动 */}
|
||||||
|
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
||||||
|
<View>
|
||||||
|
{/* Header */}
|
||||||
|
{renderRightHeader()}
|
||||||
|
{/* Data List */}
|
||||||
|
<View>
|
||||||
|
{currentPlayers?.map((player, index) => (
|
||||||
|
<View key={`right-${player.player_id || index}`}>
|
||||||
|
{renderRightDataRow(player)}
|
||||||
|
</View>
|
||||||
|
))}
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{/* Empty State */}
|
||||||
|
{(!currentPlayers || currentPlayers.length === 0) && (
|
||||||
|
<View style={styles.emptyState}>
|
||||||
|
<ThemedText style={{ color: secondaryText }}>暂无球员数据</ThemedText>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
|
</ScrollView>
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
paddingTop: 12,
|
||||||
|
},
|
||||||
|
controlsHeader: {
|
||||||
|
flexDirection: "row",
|
||||||
|
justifyContent: "space-between",
|
||||||
|
alignItems: "center",
|
||||||
|
paddingHorizontal: 16,
|
||||||
|
marginBottom: 12,
|
||||||
|
},
|
||||||
|
controlTitle: {
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: "600",
|
||||||
|
},
|
||||||
|
controlSubtitle: {
|
||||||
|
fontSize: 12,
|
||||||
|
marginTop: 2,
|
||||||
|
},
|
||||||
|
teamTabsContainer: {
|
||||||
|
flexDirection: "row",
|
||||||
|
marginHorizontal: 16,
|
||||||
|
marginBottom: 12,
|
||||||
|
borderRadius: 12,
|
||||||
|
height: 44,
|
||||||
|
borderWidth: 1,
|
||||||
|
overflow: "hidden",
|
||||||
|
},
|
||||||
|
teamTab: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
},
|
||||||
|
teamTabLogo: {
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
},
|
||||||
|
teamTabLogoGradient: {
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
borderRadius: 12,
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
},
|
||||||
|
teamTabLogoText: {
|
||||||
|
fontSize: 10,
|
||||||
|
fontWeight: "700",
|
||||||
|
color: "rgba(255, 255, 255, 0.92)",
|
||||||
|
},
|
||||||
|
tableContainer: {
|
||||||
|
marginHorizontal: 16,
|
||||||
|
marginBottom: 20,
|
||||||
|
borderRadius: 16,
|
||||||
|
borderWidth: 1,
|
||||||
|
overflow: "hidden", // 确保圆角生效
|
||||||
|
},
|
||||||
|
// 左侧样式
|
||||||
|
headerCell: {
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||||
|
paddingHorizontal: 12,
|
||||||
|
width: "100%",
|
||||||
|
},
|
||||||
|
playerRow: {
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||||
|
paddingHorizontal: 8,
|
||||||
|
width: "100%",
|
||||||
|
},
|
||||||
|
// 右侧样式
|
||||||
|
dataHeaderRow: {
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||||
|
paddingHorizontal: 16, // 给右侧表头一些左右padding,美观
|
||||||
|
},
|
||||||
|
dataRow: {
|
||||||
|
flexDirection: "row",
|
||||||
|
alignItems: "center",
|
||||||
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||||
|
paddingHorizontal: 16,
|
||||||
|
},
|
||||||
|
// 通用文本
|
||||||
|
headerText: {
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: "700",
|
||||||
|
},
|
||||||
|
statText: {
|
||||||
|
fontSize: 14,
|
||||||
|
fontWeight: "500",
|
||||||
|
},
|
||||||
|
// 球员头像与信息
|
||||||
|
avatarContainer: {
|
||||||
|
marginRight: 8,
|
||||||
|
},
|
||||||
|
avatarGradient: {
|
||||||
|
width: 32,
|
||||||
|
height: 32,
|
||||||
|
borderRadius: 16,
|
||||||
|
alignItems: "center",
|
||||||
|
justifyContent: "center",
|
||||||
|
},
|
||||||
|
avatarText: {
|
||||||
|
fontSize: 12,
|
||||||
|
fontWeight: "700",
|
||||||
|
color: "rgba(255, 255, 255, 0.92)",
|
||||||
|
},
|
||||||
|
playerInfo: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: "center",
|
||||||
|
},
|
||||||
|
playerName: {
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: "600",
|
||||||
|
marginBottom: 2,
|
||||||
|
},
|
||||||
|
playerNumPos: {
|
||||||
|
fontSize: 11,
|
||||||
|
},
|
||||||
|
emptyState: {
|
||||||
|
padding: 40,
|
||||||
|
alignItems: "center",
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -63,8 +63,34 @@ export function MatchTabs({
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
} else if (sportId === 2) {
|
} else if (sportId === 2) {
|
||||||
// 篮球
|
// 篮球: 详情、统计数据、整体统计、交锋往绩、聊天
|
||||||
return commonTabs;
|
return [
|
||||||
|
{
|
||||||
|
id: "info",
|
||||||
|
label: t("detail.tabs.info"),
|
||||||
|
icon: "document-text-outline",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "stats",
|
||||||
|
label: t("detail.tabs.stats"),
|
||||||
|
icon: "stats-chart-outline",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "overall",
|
||||||
|
label: t("detail.tabs.overall"),
|
||||||
|
icon: "bar-chart-outline",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "h2h",
|
||||||
|
label: t("detail.tabs.h2h"),
|
||||||
|
icon: "swap-horizontal-outline",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "chat",
|
||||||
|
label: t("detail.tabs.chat"),
|
||||||
|
icon: "chatbubbles-outline",
|
||||||
|
},
|
||||||
|
];
|
||||||
} else if (sportId === 3) {
|
} else if (sportId === 3) {
|
||||||
// 网球: 详情、聊天
|
// 网球: 详情、聊天
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
"total_points": "Total Points Won"
|
"total_points": "Total Points Won"
|
||||||
},
|
},
|
||||||
"tabs": {
|
"tabs": {
|
||||||
|
"overall": "Overall",
|
||||||
"info": "Details",
|
"info": "Details",
|
||||||
"stats": "Statistics",
|
"stats": "Statistics",
|
||||||
"odds": "Odds",
|
"odds": "Odds",
|
||||||
@@ -178,6 +179,12 @@
|
|||||||
"lineups_coach": "Coach",
|
"lineups_coach": "Coach",
|
||||||
"lineups_subs": "Substitutes",
|
"lineups_subs": "Substitutes",
|
||||||
"lineups_missing": "Missing players"
|
"lineups_missing": "Missing players"
|
||||||
|
},
|
||||||
|
"overall_stats": {
|
||||||
|
"total_assists": "Assists",
|
||||||
|
"total_blocks": "Blocks",
|
||||||
|
"total_steals": "Steals",
|
||||||
|
"total_turnovers": "Turnovers"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"selection": {
|
"selection": {
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
"fetch_failed": "विवरण प्राप्त करने में विफल",
|
"fetch_failed": "विवरण प्राप्त करने में विफल",
|
||||||
"not_found": "मैच डेटा नहीं मिला",
|
"not_found": "मैच डेटा नहीं मिला",
|
||||||
"tabs": {
|
"tabs": {
|
||||||
|
"overall": "कुल",
|
||||||
"info": "विवरण",
|
"info": "विवरण",
|
||||||
"stats": "आँकड़े",
|
"stats": "आँकड़े",
|
||||||
"odds": "ऑड्स",
|
"odds": "ऑड्स",
|
||||||
@@ -163,6 +164,12 @@
|
|||||||
"lineups_coach": "कोच",
|
"lineups_coach": "कोच",
|
||||||
"lineups_subs": "सब्स्टीट्यूट",
|
"lineups_subs": "सब्स्टीट्यूट",
|
||||||
"lineups_missing": "अनुपस्थित खिलाड़ी"
|
"lineups_missing": "अनुपस्थित खिलाड़ी"
|
||||||
|
},
|
||||||
|
"overall_stats": {
|
||||||
|
"total_assists": "असिस्ट",
|
||||||
|
"total_blocks": "ब्लॉक",
|
||||||
|
"total_steals": "स्टील",
|
||||||
|
"total_turnovers": "टर्नओवर"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"selection": {
|
"selection": {
|
||||||
|
|||||||
@@ -89,6 +89,7 @@
|
|||||||
"not_found": "Data pertandingan tidak ditemukan",
|
"not_found": "Data pertandingan tidak ditemukan",
|
||||||
"scoreboard": "Papan Skor",
|
"scoreboard": "Papan Skor",
|
||||||
"tabs": {
|
"tabs": {
|
||||||
|
"overall": "Keseluruhan",
|
||||||
"info": "Detail",
|
"info": "Detail",
|
||||||
"stats": "Statistik",
|
"stats": "Statistik",
|
||||||
"odds": "Odds",
|
"odds": "Odds",
|
||||||
@@ -163,6 +164,12 @@
|
|||||||
"lineups_coach": "Pelatih",
|
"lineups_coach": "Pelatih",
|
||||||
"lineups_subs": "Cadangan",
|
"lineups_subs": "Cadangan",
|
||||||
"lineups_missing": "Pemain Absen"
|
"lineups_missing": "Pemain Absen"
|
||||||
|
},
|
||||||
|
"overall_stats": {
|
||||||
|
"total_assists": "Asisten",
|
||||||
|
"total_blocks": "Blok",
|
||||||
|
"total_steals": "Steal",
|
||||||
|
"total_turnovers": "Turnover"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"selection": {
|
"selection": {
|
||||||
|
|||||||
@@ -89,6 +89,7 @@
|
|||||||
"not_found": "Data perlawanan tidak ditemui",
|
"not_found": "Data perlawanan tidak ditemui",
|
||||||
"scoreboard": "Papan Skor",
|
"scoreboard": "Papan Skor",
|
||||||
"tabs": {
|
"tabs": {
|
||||||
|
"overall": "Keseluruhan",
|
||||||
"info": "Maklumat",
|
"info": "Maklumat",
|
||||||
"stats": "Statistik",
|
"stats": "Statistik",
|
||||||
"odds": "Odds",
|
"odds": "Odds",
|
||||||
@@ -163,6 +164,12 @@
|
|||||||
"lineups_coach": "Jurulatih",
|
"lineups_coach": "Jurulatih",
|
||||||
"lineups_subs": "Pemain Simpanan",
|
"lineups_subs": "Pemain Simpanan",
|
||||||
"lineups_missing": "Pemain Tidak Tersenarai"
|
"lineups_missing": "Pemain Tidak Tersenarai"
|
||||||
|
},
|
||||||
|
"overall_stats": {
|
||||||
|
"total_assists": "Bantuan",
|
||||||
|
"total_blocks": "Sekatan",
|
||||||
|
"total_steals": "Curi",
|
||||||
|
"total_turnovers": "Pusingan"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"selection": {
|
"selection": {
|
||||||
|
|||||||
@@ -89,6 +89,7 @@
|
|||||||
"not_found": "ไม่พบข้อมูลการแข่งขัน",
|
"not_found": "ไม่พบข้อมูลการแข่งขัน",
|
||||||
"scoreboard": "สกอร์บอร์ด",
|
"scoreboard": "สกอร์บอร์ด",
|
||||||
"tabs": {
|
"tabs": {
|
||||||
|
"overall": "ทั้งหมด",
|
||||||
"info": "รายละเอียด",
|
"info": "รายละเอียด",
|
||||||
"stats": "สถิติ",
|
"stats": "สถิติ",
|
||||||
"odds": "อัตราต่อรอง",
|
"odds": "อัตราต่อรอง",
|
||||||
@@ -163,6 +164,12 @@
|
|||||||
"lineups_coach": "โค้ช",
|
"lineups_coach": "โค้ช",
|
||||||
"lineups_subs": "ตัวสำรอง",
|
"lineups_subs": "ตัวสำรอง",
|
||||||
"lineups_missing": "ผู้เล่นที่ขาดหาย"
|
"lineups_missing": "ผู้เล่นที่ขาดหาย"
|
||||||
|
},
|
||||||
|
"overall_stats": {
|
||||||
|
"total_assists": "แอสซิสต์",
|
||||||
|
"total_blocks": "บล็อก",
|
||||||
|
"total_steals": "สตีล",
|
||||||
|
"total_turnovers": "เทิร์นโอเวอร์"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"selection": {
|
"selection": {
|
||||||
|
|||||||
@@ -89,6 +89,7 @@
|
|||||||
"not_found": "Không tìm thấy dữ liệu trận đấu",
|
"not_found": "Không tìm thấy dữ liệu trận đấu",
|
||||||
"scoreboard": "Bảng điểm",
|
"scoreboard": "Bảng điểm",
|
||||||
"tabs": {
|
"tabs": {
|
||||||
|
"overall": "Tổng",
|
||||||
"info": "Thông tin",
|
"info": "Thông tin",
|
||||||
"stats": "Thống kê",
|
"stats": "Thống kê",
|
||||||
"odds": "Tỷ lệ cược",
|
"odds": "Tỷ lệ cược",
|
||||||
@@ -163,6 +164,12 @@
|
|||||||
"lineups_coach": "Huấn luyện viên",
|
"lineups_coach": "Huấn luyện viên",
|
||||||
"lineups_subs": "Dự bị",
|
"lineups_subs": "Dự bị",
|
||||||
"lineups_missing": "Cầu thủ vắng mặt"
|
"lineups_missing": "Cầu thủ vắng mặt"
|
||||||
|
},
|
||||||
|
"overall_stats": {
|
||||||
|
"total_assists": "Kiến tạo",
|
||||||
|
"total_blocks": "Chặn bóng",
|
||||||
|
"total_steals": "Cướp bóng",
|
||||||
|
"total_turnovers": "Mất bóng"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"selection": {
|
"selection": {
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
"total_points": "总得分"
|
"total_points": "总得分"
|
||||||
},
|
},
|
||||||
"tabs": {
|
"tabs": {
|
||||||
|
"overall": "全部",
|
||||||
"info": "详情",
|
"info": "详情",
|
||||||
"stats": "统计数据",
|
"stats": "统计数据",
|
||||||
"odds": "赔率",
|
"odds": "赔率",
|
||||||
@@ -178,6 +179,12 @@
|
|||||||
"lineups_coach": "主教练",
|
"lineups_coach": "主教练",
|
||||||
"lineups_subs": "替补球员",
|
"lineups_subs": "替补球员",
|
||||||
"lineups_missing": "缺席球员"
|
"lineups_missing": "缺席球员"
|
||||||
|
},
|
||||||
|
"overall_stats": {
|
||||||
|
"total_assists": "助攻",
|
||||||
|
"total_blocks": "盖帽",
|
||||||
|
"total_steals": "抢断",
|
||||||
|
"total_turnovers": "失误"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"selection": {
|
"selection": {
|
||||||
|
|||||||
110
types/api.ts
110
types/api.ts
@@ -52,10 +52,10 @@ export interface LiveScoreMatch {
|
|||||||
event_time: string;
|
event_time: string;
|
||||||
event_home_team: string;
|
event_home_team: string;
|
||||||
home_team_key: number;
|
home_team_key: number;
|
||||||
home_team_logo: string;
|
home_team_logo: string | null;
|
||||||
event_away_team: string;
|
event_away_team: string;
|
||||||
away_team_key: number;
|
away_team_key: number;
|
||||||
away_team_logo: string;
|
away_team_logo: string | null;
|
||||||
event_final_result: string;
|
event_final_result: string;
|
||||||
event_halftime_result: string;
|
event_halftime_result: string;
|
||||||
event_game_result?: string;
|
event_game_result?: string;
|
||||||
@@ -69,14 +69,21 @@ export interface LiveScoreMatch {
|
|||||||
country_name: string;
|
country_name: string;
|
||||||
country_logo: string;
|
country_logo: string;
|
||||||
event_country_key: number;
|
event_country_key: number;
|
||||||
|
event_quarter?: string;
|
||||||
// Tennis specific
|
// Tennis specific
|
||||||
event_first_player?: string;
|
event_first_player?: string;
|
||||||
event_first_player_logo?: string;
|
event_first_player_logo?: string;
|
||||||
event_second_player?: string;
|
event_second_player?: string;
|
||||||
event_second_player_logo?: string;
|
event_second_player_logo?: string;
|
||||||
event_serve?: string;
|
event_serve?: string;
|
||||||
pointbypoint?: any[];
|
scores?:
|
||||||
scores?: any[]; // LiveScoreMatch uses array for scores, Match uses string
|
| any[]
|
||||||
|
| {
|
||||||
|
"1stQuarter"?: Array<{ score_home: string; score_away: string }>;
|
||||||
|
"2ndQuarter"?: Array<{ score_home: string; score_away: string }>;
|
||||||
|
"3rdQuarter"?: Array<{ score_home: string; score_away: string }>;
|
||||||
|
"4thQuarter"?: Array<{ score_home: string; score_away: string }>;
|
||||||
|
};
|
||||||
goalscorers?: {
|
goalscorers?: {
|
||||||
time: string;
|
time: string;
|
||||||
home_scorer: string;
|
home_scorer: string;
|
||||||
@@ -113,7 +120,6 @@ export interface LiveScoreMatch {
|
|||||||
info_time: string;
|
info_time: string;
|
||||||
score: string;
|
score: string;
|
||||||
}[];
|
}[];
|
||||||
lineups?: unknown;
|
|
||||||
statistics?:
|
statistics?:
|
||||||
| {
|
| {
|
||||||
type: string;
|
type: string;
|
||||||
@@ -142,7 +148,65 @@ export interface LiveScoreMatch {
|
|||||||
score: string;
|
score: string;
|
||||||
set_point: null | string;
|
set_point: null | string;
|
||||||
}[];
|
}[];
|
||||||
}[];
|
};
|
||||||
|
lineups?: {
|
||||||
|
home_team?: {
|
||||||
|
starting_lineups?: Array<{ player: string; player_id: number }>;
|
||||||
|
substitutes?: Array<{ player: string; player_id: number }>;
|
||||||
|
};
|
||||||
|
away_team?: {
|
||||||
|
starting_lineups?: Array<{ player: string; player_id: number }>;
|
||||||
|
substitutes?: Array<{ player: string; player_id: number }>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
player_statistics?: {
|
||||||
|
home_team?: Array<{
|
||||||
|
player: string;
|
||||||
|
player_id: number;
|
||||||
|
player_position?: string;
|
||||||
|
player_minutes?: string;
|
||||||
|
player_points?: string;
|
||||||
|
player_total_rebounds?: string;
|
||||||
|
player_offence_rebounds?: string;
|
||||||
|
player_defense_rebounds?: string;
|
||||||
|
player_assists?: string;
|
||||||
|
player_steals?: string;
|
||||||
|
player_blocks?: string;
|
||||||
|
player_turnovers?: string;
|
||||||
|
player_personal_fouls?: string;
|
||||||
|
player_plus_minus?: string;
|
||||||
|
player_field_goals_made?: string;
|
||||||
|
player_field_goals_attempts?: string;
|
||||||
|
player_threepoint_goals_made?: string;
|
||||||
|
player_threepoint_goals_attempts?: string;
|
||||||
|
player_freethrows_goals_made?: string;
|
||||||
|
player_freethrows_goals_attempts?: string;
|
||||||
|
player_oncourt?: string | null;
|
||||||
|
}>;
|
||||||
|
away_team?: Array<{
|
||||||
|
player: string;
|
||||||
|
player_id: number;
|
||||||
|
player_position?: string;
|
||||||
|
player_minutes?: string;
|
||||||
|
player_points?: string;
|
||||||
|
player_total_rebounds?: string;
|
||||||
|
player_offence_rebounds?: string;
|
||||||
|
player_defense_rebounds?: string;
|
||||||
|
player_assists?: string;
|
||||||
|
player_steals?: string;
|
||||||
|
player_blocks?: string;
|
||||||
|
player_turnovers?: string;
|
||||||
|
player_personal_fouls?: string;
|
||||||
|
player_plus_minus?: string;
|
||||||
|
player_field_goals_made?: string;
|
||||||
|
player_field_goals_attempts?: string;
|
||||||
|
player_threepoint_goals_made?: string;
|
||||||
|
player_threepoint_goals_attempts?: string;
|
||||||
|
player_freethrows_goals_made?: string;
|
||||||
|
player_freethrows_goals_attempts?: string;
|
||||||
|
player_oncourt?: string | null;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ApiResponse<T> {
|
export interface ApiResponse<T> {
|
||||||
@@ -238,6 +302,26 @@ export interface Player {
|
|||||||
number?: number | string;
|
number?: number | string;
|
||||||
player_type?: string; // 位置/角色,例如 Goalkeepers
|
player_type?: string; // 位置/角色,例如 Goalkeepers
|
||||||
position?: string; // 兜底位置字段
|
position?: string; // 兜底位置字段
|
||||||
|
// 篮球相关字段
|
||||||
|
player_id?: number;
|
||||||
|
player_points?: string;
|
||||||
|
player_assists?: string;
|
||||||
|
player_minutes?: string;
|
||||||
|
player_blocks?: string;
|
||||||
|
player_steals?: string;
|
||||||
|
player_turnovers?: string;
|
||||||
|
player_plus_minus?: string;
|
||||||
|
player_personal_fouls?: string;
|
||||||
|
player_total_rebounds?: string;
|
||||||
|
player_defense_rebounds?: string;
|
||||||
|
player_offence_rebounds?: string;
|
||||||
|
player_field_goals_made?: string;
|
||||||
|
player_field_goals_attempts?: string;
|
||||||
|
player_freethrows_goals_made?: string;
|
||||||
|
player_freethrows_goals_attempts?: string;
|
||||||
|
player_threepoint_goals_made?: string;
|
||||||
|
player_threepoint_goals_attempts?: string;
|
||||||
|
player_oncourt?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface UpcomingMatch {
|
export interface UpcomingMatch {
|
||||||
@@ -337,7 +421,19 @@ export interface MatchDetailData {
|
|||||||
firstPlayerKey?: string;
|
firstPlayerKey?: string;
|
||||||
secondPlayerKey?: string;
|
secondPlayerKey?: string;
|
||||||
eventGameResult?: string;
|
eventGameResult?: string;
|
||||||
scores?: any[];
|
scores?:
|
||||||
|
| any[]
|
||||||
|
| {
|
||||||
|
"1stQuarter"?: Array<{ score_home: string; score_away: string }>;
|
||||||
|
"2ndQuarter"?: Array<{ score_home: string; score_away: string }>;
|
||||||
|
"3rdQuarter"?: Array<{ score_home: string; score_away: string }>;
|
||||||
|
"4thQuarter"?: Array<{ score_home: string; score_away: string }>;
|
||||||
|
};
|
||||||
|
stats?: Array<{
|
||||||
|
type: string;
|
||||||
|
home: string;
|
||||||
|
away: string;
|
||||||
|
}>;
|
||||||
events?: MatchEvents;
|
events?: MatchEvents;
|
||||||
players?: {
|
players?: {
|
||||||
home_team?: Player[];
|
home_team?: Player[];
|
||||||
|
|||||||
Reference in New Issue
Block a user