Skip to content

Commit 2f41ce7

Browse files
committed
Merge branch 'main' of github.com:MetaMask/metamask-mobile into feat-tmcu-443-splash-screen-animation
2 parents c358c90 + bd38182 commit 2f41ce7

2 files changed

Lines changed: 18 additions & 12 deletions

File tree

app/components/UI/Predict/components/FeaturedCarousel/FeaturedCarouselSportCard.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,26 @@ const FeaturedCarouselSportCard: React.FC<FeaturedCarouselSportCardProps> = ({
9898
const footerTimeText = timeRemaining ?? scheduledTime;
9999

100100
const outcome = market.outcomes[0];
101+
const matchesTeam = (
102+
tokenTitle: string | undefined,
103+
team: { name?: string; alias?: string },
104+
) => {
105+
if (!tokenTitle) return false;
106+
const lower = tokenTitle.toLowerCase();
107+
return (
108+
lower === team.name?.toLowerCase() ||
109+
(team.alias != null && lower === team.alias.toLowerCase())
110+
);
111+
};
112+
101113
const homeToken =
102-
outcome?.tokens?.find(
103-
(t) =>
104-
t.title.toLowerCase() === game.homeTeam.name.toLowerCase() ||
105-
t.title.toLowerCase() === game.homeTeam.alias.toLowerCase(),
106-
) ?? outcome?.tokens?.[0];
114+
outcome?.tokens?.find((t) => matchesTeam(t.title, game.homeTeam)) ??
115+
outcome?.tokens?.[0];
107116
const awayToken =
108-
outcome?.tokens?.find(
109-
(t) =>
110-
t.title.toLowerCase() === game.awayTeam.name.toLowerCase() ||
111-
t.title.toLowerCase() === game.awayTeam.alias.toLowerCase(),
112-
) ?? outcome?.tokens?.[1];
117+
outcome?.tokens?.find((t) => matchesTeam(t.title, game.awayTeam)) ??
118+
outcome?.tokens?.[1];
113119
const drawToken = showDraw
114-
? outcome?.tokens?.find((t) => t.title.toLowerCase() === 'draw')
120+
? outcome?.tokens?.find((t) => t.title?.toLowerCase() === 'draw')
115121
: undefined;
116122

117123
const handleCardPress = useCallback(() => {

app/components/UI/Predict/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export type PredictSportTeam = {
193193
logo: string;
194194
abbreviation: string; // e.g., "SEA", "DEN"
195195
color: string; // Team primary color (hex)
196-
alias: string; // Team alias (e.g., "Seahawks")
196+
alias?: string; // Team alias (e.g., "Seahawks")
197197
};
198198

199199
// Parsed score data

0 commit comments

Comments
 (0)