feat : add engines choices
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
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,
|
||||
engineNameAtom,
|
||||
gameAtom,
|
||||
} from "../states";
|
||||
import LineEvaluation from "./lineEvaluation";
|
||||
import { useCurrentPosition } from "../hooks/useCurrentPosition";
|
||||
import { LineEval } from "@/types/eval";
|
||||
import { EngineName } from "@/types/enums";
|
||||
import EngineSettingsButton from "@/sections/engineSettings/engineSettingsButton";
|
||||
import Accuracies from "./accuracies";
|
||||
import MoveInfo from "./moveInfo";
|
||||
@@ -13,7 +17,8 @@ import Opening from "./opening";
|
||||
|
||||
export default function ReviewPanelBody() {
|
||||
const linesNumber = useAtomValue(engineMultiPvAtom);
|
||||
const position = useCurrentPosition(EngineName.Stockfish16);
|
||||
const engineName = useAtomValue(engineNameAtom);
|
||||
const position = useCurrentPosition(engineName);
|
||||
const game = useAtomValue(gameAtom);
|
||||
const board = useAtomValue(boardAtom);
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Icon } from "@iconify/react";
|
||||
import {
|
||||
engineDepthAtom,
|
||||
engineMultiPvAtom,
|
||||
engineNameAtom,
|
||||
evaluationProgressAtom,
|
||||
gameAtom,
|
||||
gameEvalAtom,
|
||||
@@ -11,11 +12,11 @@ import { getEvaluateGameParams } from "@/lib/chess";
|
||||
import { useGameDatabase } from "@/hooks/useGameDatabase";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { useEngine } from "@/hooks/useEngine";
|
||||
import { EngineName } from "@/types/enums";
|
||||
import { logAnalyticsEvent } from "@/lib/firebase";
|
||||
|
||||
export default function AnalyzeButton() {
|
||||
const engine = useEngine(EngineName.Stockfish16);
|
||||
const engineName = useAtomValue(engineNameAtom);
|
||||
const engine = useEngine(engineName);
|
||||
const [evaluationProgress, setEvaluationProgress] = useAtom(
|
||||
evaluationProgressAtom
|
||||
);
|
||||
@@ -49,7 +50,7 @@ export default function AnalyzeButton() {
|
||||
}
|
||||
|
||||
logAnalyticsEvent("analyze_game", {
|
||||
engine: EngineName.Stockfish16,
|
||||
engine: engineName,
|
||||
depth: engineDepth,
|
||||
multiPv: engineMultiPv,
|
||||
nbPositions: params.fens.length,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { EngineName } from "@/types/enums";
|
||||
import { CurrentPosition, GameEval } from "@/types/eval";
|
||||
import { Chess } from "chess.js";
|
||||
import { atom } from "jotai";
|
||||
@@ -11,6 +12,7 @@ export const boardOrientationAtom = atom(true);
|
||||
export const showBestMoveArrowAtom = atom(true);
|
||||
export const showPlayerMoveIconAtom = atom(true);
|
||||
|
||||
export const engineNameAtom = atom<EngineName>(EngineName.Stockfish16);
|
||||
export const engineDepthAtom = atom(16);
|
||||
export const engineMultiPvAtom = atom(3);
|
||||
export const evaluationProgressAtom = atom(0);
|
||||
|
||||
Reference in New Issue
Block a user