File tree Expand file tree Collapse file tree
app/components/UI/Predict
components/FeaturedCarousel Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ( ( ) => {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments