feat : add GA

This commit is contained in:
GuillaumeSD
2024-02-25 05:23:27 +01:00
parent 003edaead9
commit e6645f7c28
8 changed files with 899 additions and 14 deletions

View File

@@ -6,7 +6,7 @@ import {
engineMultiPvAtom,
gameAtom,
gameEvalAtom,
} from "../states";
} from "./states";
import { useAtomValue, useSetAtom } from "jotai";
import { getFens } from "@/lib/chess";
import { useGameDatabase } from "@/hooks/useGameDatabase";
@@ -14,6 +14,7 @@ import { LoadingButton } from "@mui/lab";
import Slider from "@/components/slider";
import { useEngine } from "@/hooks/useEngine";
import { EngineName } from "@/types/enums";
import { logAnalyticsEvent } from "@/lib/firebase";
export default function AnalyzePanel() {
const engine = useEngine(EngineName.Stockfish16);
@@ -47,6 +48,13 @@ export default function AnalyzePanel() {
if (gameFromUrl) {
setGameEval(gameFromUrl.id, newGameEval);
}
logAnalyticsEvent("analyze_game", {
engine: EngineName.Stockfish16,
depth: engineDepth,
multiPv: engineMultiPv,
nbPositions: 1,
});
};
return (

View File

@@ -4,7 +4,7 @@ import {
gameEvalAtom,
showBestMoveArrowAtom,
showPlayerMoveArrowAtom,
} from "../states";
} from "./states";
export default function ArrowOptions() {
const gameEval = useAtomValue(gameEvalAtom);

View File

@@ -1,7 +1,7 @@
import { Icon } from "@iconify/react";
import { Grid, List, Typography } from "@mui/material";
import { useAtomValue } from "jotai";
import { boardAtom, engineMultiPvAtom, gameAtom } from "./states";
import { boardAtom, engineMultiPvAtom, gameAtom } from "../states";
import LineEvaluation from "./lineEvaluation";
import { useCurrentMove } from "@/hooks/useCurrentMove";
import { LineEval } from "@/types/eval";

View File

@@ -1,7 +1,7 @@
import { LineEval } from "@/types/eval";
import { ListItem, Skeleton, Typography } from "@mui/material";
import { useAtomValue } from "jotai";
import { boardAtom } from "./states";
import { boardAtom } from "../states";
import { moveLineUciToSan } from "@/lib/chess";
interface Props {