@@ -205,10 +205,10 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
205205
206206 fetchMaiaGameList ( selected , currentPage )
207207 . then ( ( data ) => {
208+ console . log ( data )
208209 let parsedGames : MaiaGameListEntry [ ] = [ ]
209210
210211 if ( selected === 'favorites' ) {
211- // Handle favorites response format
212212 parsedGames = data . games . map ( ( game : any ) => ( {
213213 id : game . game_id || game . id ,
214214 type : game . game_type || game . type ,
@@ -221,11 +221,12 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
221221 } else {
222222 if ( selected === 'custom' ) {
223223 parsedGames = data . games . map ( ( game : any ) => ( {
224- id : game . id ,
225- label : game . name || 'Custom Game' ,
226- result : '*' ,
224+ id : game . game_id || game . id ,
227225 type : 'custom' ,
228- pgn : game . pgn ,
226+ label : game . custom_name || 'Custom Game' ,
227+ result : game . result || '*' ,
228+ is_favorited : game . is_favorited ,
229+ custom_name : game . custom_name ,
229230 } ) )
230231 } else {
231232 const parse = (
@@ -242,7 +243,6 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
242243 const raw = game . maia_name . replace ( '_kdd_' , ' ' )
243244 const maia = raw . charAt ( 0 ) . toUpperCase ( ) + raw . slice ( 1 )
244245
245- // Use custom name if available, otherwise generate default label
246246 const defaultLabel =
247247 game . player_color === 'white'
248248 ? `You vs. ${ maia } `
@@ -279,7 +279,6 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
279279 } ,
280280 } ) )
281281
282- // Update favoritedGameIds from the actual games data
283282 const favoritedIds = new Set < string > (
284283 parsedGames
285284 . filter ( ( game : any ) => game . is_favorited )
@@ -303,7 +302,6 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
303302 }
304303 } , [ selected , currentPage , fetchedCache ] )
305304
306- // Separate useEffect for H&B subsections
307305 useEffect ( ( ) => {
308306 if ( selected === 'hb' ) {
309307 const gameType = hbSubsection === 'hand' ? 'hand' : 'brain'
@@ -333,7 +331,6 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
333331 const raw = game . maia_name . replace ( '_kdd_' , ' ' )
334332 const maia = raw . charAt ( 0 ) . toUpperCase ( ) + raw . slice ( 1 )
335333
336- // Use custom name if available, otherwise generate default label
337334 const defaultLabel =
338335 game . player_color === 'white'
339336 ? `You vs. ${ maia } `
@@ -368,7 +365,6 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
368365 } ,
369366 } ) )
370367
371- // Update favoritedGameIds from the actual games data
372368 const favoritedIds = new Set < string > (
373369 parsedGames
374370 . filter ( ( game : any ) => game . is_favorited )
@@ -488,7 +484,6 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
488484 setFavoriteGames ( updatedFavorites )
489485 setFavoritedGameIds ( new Set ( updatedFavorites . map ( ( f ) => f . id ) ) )
490486
491- // Clear favorites cache to force re-fetch
492487 setFetchedCache ( ( prev ) => ( {
493488 ...prev ,
494489 favorites : { } ,
@@ -498,7 +493,6 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
498493 favorites : { } ,
499494 } ) )
500495
501- // Also clear current section cache to show updated favorite status
502496 if ( selected !== 'favorites' ) {
503497 const currentSection =
504498 selected === 'hb'
@@ -707,6 +701,7 @@ export const AnalysisGameList: React.FC<AnalysisGameListProps> = ({
707701 const selectedGame = currentId && currentId [ 0 ] === game . id
708702 const isFavorited = ( game as any ) . is_favorited || false
709703 const displayName = game . label
704+ // console.log(game)
710705 return (
711706 < div
712707 key = { index }
0 commit comments