优化比赛卡片显示,添加球队名称和logo,调整样式;更新实时比分功能,简化数据处理逻辑
This commit is contained in:
@@ -42,7 +42,7 @@ export default function LiveScreen() {
|
||||
const liveData = await fetchLiveScore(
|
||||
state.selectedSportId,
|
||||
state.selectedLeagueKey ? parseInt(state.selectedLeagueKey) : undefined,
|
||||
state.timezone
|
||||
state.timezone,
|
||||
);
|
||||
|
||||
// 检查返回的数据是否为空或无效
|
||||
@@ -56,9 +56,15 @@ export default function LiveScreen() {
|
||||
const converted: Match[] = liveData.map((item: LiveScoreMatch) => ({
|
||||
id: item.event_key.toString(),
|
||||
league: item.league_name,
|
||||
leagueName: item.league_name,
|
||||
leagueLogo: item.league_logo,
|
||||
time: item.event_time,
|
||||
home: item.event_home_team,
|
||||
away: item.event_away_team,
|
||||
homeTeamName: item.event_home_team,
|
||||
awayTeamName: item.event_away_team,
|
||||
homeTeamLogo: item.home_team_logo,
|
||||
awayTeamLogo: item.away_team_logo,
|
||||
meta: item.event_status,
|
||||
scoreText: item.event_final_result || "0 - 0",
|
||||
fav: false,
|
||||
@@ -66,7 +72,6 @@ export default function LiveScreen() {
|
||||
sportId: state.selectedSportId ?? undefined,
|
||||
isLive: true,
|
||||
date: item.event_date,
|
||||
// sport: item.sport_name,
|
||||
}));
|
||||
|
||||
const token = await storage.getAccessToken();
|
||||
@@ -83,7 +88,7 @@ export default function LiveScreen() {
|
||||
console.error(`Check favorite failed for match ${m.id}:`, error);
|
||||
return m;
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -104,7 +109,7 @@ export default function LiveScreen() {
|
||||
const handleFavoriteToggle = (matchId: string, isFav: boolean) => {
|
||||
setMatches((prev) => {
|
||||
const updated = prev.map((m) =>
|
||||
m.id === matchId ? { ...m, fav: isFav } : m
|
||||
m.id === matchId ? { ...m, fav: isFav } : m,
|
||||
);
|
||||
return [...updated].sort((a, b) => {
|
||||
if (a.fav === b.fav) return 0;
|
||||
|
||||
Reference in New Issue
Block a user