style : enhance game loading and choosing UI (#43)

This commit is contained in:
Ali Raza Khalid
2025-06-10 03:58:31 +05:00
committed by GitHub
parent 0bc031eabb
commit 839f87a2e8
10 changed files with 758 additions and 98 deletions

View File

@@ -1,10 +1,10 @@
import { ChessComGame } from "@/types/chessCom";
import { ChessComRawGameData } from "@/types/chessCom";
import { getPaddedNumber } from "./helpers";
export const getChessComUserRecentGames = async (
username: string,
signal?: AbortSignal
): Promise<ChessComGame[]> => {
): Promise<ChessComRawGameData[]> => {
const date = new Date();
const year = date.getUTCFullYear();
const month = date.getUTCMonth() + 1;
@@ -24,7 +24,7 @@ export const getChessComUserRecentGames = async (
throw new Error("Error fetching games from Chess.com");
}
const games: ChessComGame[] = data?.games ?? [];
const games: ChessComRawGameData[] = data?.games ?? [];
if (games.length < 50) {
const previousMonth = month === 1 ? 12 : month - 1;