feat : add elo estimation feature (#6)

* feat:  add elo estimation feature
This commit is contained in:
Theprathamshah
2025-05-10 01:00:07 +05:30
committed by GitHub
parent 34fdde282c
commit 2cc8b48b08
5 changed files with 78 additions and 6 deletions

View File

@@ -1,8 +1,11 @@
import { Grid2 as Grid, Typography } from "@mui/material";
import { useAtomValue } from "jotai";
import { gameEvalAtom } from "../../states";
type props = {
params: "accurecy" | "rating";
};
export default function Accuracies() {
export default function Accuracies(props: props) {
const gameEval = useAtomValue(gameEvalAtom);
if (!gameEval) return null;
@@ -24,11 +27,14 @@ export default function Accuracies() {
fontWeight="bold"
border="1px solid #424242"
>
{`${gameEval?.accuracy.white.toFixed(1)} %`}
{props.params === "accurecy"
? `${gameEval?.accuracy.white.toFixed(1)} %`
: `${Math.round(gameEval?.estimatedElo.white as number)}`}
</Typography>
<Typography align="center">Accuracies</Typography>
<Typography align="center">
{props.params === "accurecy" ? "Accuracies" : "Estimated Elo"}
</Typography>
<Typography
align="center"
sx={{ backgroundColor: "black", color: "white" }}
@@ -38,7 +44,9 @@ export default function Accuracies() {
fontWeight="bold"
border="1px solid #424242"
>
{`${gameEval?.accuracy.black.toFixed(1)} %`}
{props.params === "accurecy"
? `${gameEval?.accuracy.black.toFixed(1)} %`
: `${Math.round(gameEval?.estimatedElo.black as number)}`}
</Typography>
</Grid>
);

View File

@@ -57,7 +57,8 @@ export default function AnalysisTab(props: GridProps) {
: { overflow: "hidden", overflowY: "auto", ...props.sx }
}
>
<Accuracies />
<Accuracies params={"accurecy"} />
<Accuracies params={"rating"} />
<MoveInfo />