empty placeholder

This commit is contained in:
xianyi
2026-01-23 15:38:03 +08:00
parent a7b77963fd
commit c9516b4899
22 changed files with 164 additions and 111 deletions

View File

@@ -1,12 +1,11 @@
import { EmptyPlaceholder } from "@/components/empty-placeholder";
import { ThemedText } from "@/components/themed-text";
import { IconSymbol } from "@/components/ui/icon-symbol";
import { Colors } from "@/constants/theme";
import { useAppState } from "@/context/AppStateContext";
import { useTheme } from "@/context/ThemeContext";
import { addFavorite, removeFavorite } from "@/lib/api";
import { getInitials, getLogoGradient } from "@/lib/avatar-utils";
import { Match } from "@/types/api";
import { LinearGradient } from "expo-linear-gradient";
import { useRouter } from "expo-router";
import React, { useState } from "react";
import { Image, Pressable, StyleSheet, TouchableOpacity, View } from "react-native";
@@ -182,13 +181,10 @@ export function MatchCardLeague({
<View style={styles.teamsColumn}>
<View style={styles.teamRow}>
{(() => {
const teamName = isTennis ? (match as any).eventFirstPlayer : (match.home || match.homeTeamName);
const logoUri = isTennis
? (match as any).eventFirstPlayerLogo
: ((match as any).homeLogo || match.homeTeamLogo);
const hasLogo = logoUri && logoUri.trim() !== "" && !logoUri.includes("placehold");
const gradient = getLogoGradient(teamName || "");
const initials = getInitials(teamName || "");
return hasLogo ? (
<Image
@@ -196,14 +192,7 @@ export function MatchCardLeague({
style={styles.teamLogo}
/>
) : (
<LinearGradient
colors={[gradient.color1, gradient.color2]}
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 1 }}
style={styles.teamLogoGradient}
>
<ThemedText style={styles.teamLogoText}>{initials}</ThemedText>
</LinearGradient>
<EmptyPlaceholder type="team" size={24} />
);
})()}
<View style={styles.teamNameContainer}>
@@ -217,13 +206,10 @@ export function MatchCardLeague({
<View style={[styles.teamRow, { marginTop: 10 }]}>
{(() => {
const teamName = isTennis ? (match as any).eventSecondPlayer : (match.away || match.awayTeamName);
const logoUri = isTennis
? (match as any).eventSecondPlayerLogo
: ((match as any).awayLogo || match.awayTeamLogo);
const hasLogo = logoUri && logoUri.trim() !== "" && !logoUri.includes("placehold");
const gradient = getLogoGradient(teamName || "");
const initials = getInitials(teamName || "");
return hasLogo ? (
<Image
@@ -231,14 +217,7 @@ export function MatchCardLeague({
style={styles.teamLogo}
/>
) : (
<LinearGradient
colors={[gradient.color1, gradient.color2]}
start={{ x: 0, y: 0 }}
end={{ x: 1, y: 1 }}
style={styles.teamLogoGradient}
>
<ThemedText style={styles.teamLogoText}>{initials}</ThemedText>
</LinearGradient>
<EmptyPlaceholder type="team" size={24} />
);
})()}
<View style={styles.teamNameContainer}>