add per hand real accuracy (eg: 95%)
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m27s

This commit is contained in:
Lee 2024-10-26 11:38:16 +01:00
parent d7929cc36a
commit 413d72182d

@ -16,16 +16,33 @@ export function HandAccuracyBadge({ score, hand }: HandAccuracyProps) {
} }
const { handAccuracy } = score.additionalData; const { handAccuracy } = score.additionalData;
const scoreImprovement = score.additionalData.scoreImprovement; const scoreImprovement = score.additionalData.scoreImprovement;
const currentHandAccuracy = handAccuracy[hand];
const previousHandAccuracy = scoreImprovement ? handAccuracy[hand] - scoreImprovement.handAccuracy[hand] : undefined; const previousHandAccuracy = scoreImprovement ? handAccuracy[hand] - scoreImprovement.handAccuracy[hand] : undefined;
const formattedHand = capitalizeFirstLetter(hand); const formattedHand = capitalizeFirstLetter(hand);
return ( return (
<div className="flex flex-col items-center justify-center"> <div className="flex flex-col items-center justify-center">
<Tooltip display={`${formattedHand} Hand Accuracy`}> <Tooltip
<p>{handAccuracy[hand].toFixed(2)}</p> display={
<>
<p className="font-semibold">{formattedHand} Hand Accuracy</p>
<p>Hand Accuracy: {currentHandAccuracy.toFixed(2)}</p>
<p>Accuracy: {((currentHandAccuracy / 115) * 100).toFixed(2)}%</p>
</>
}
>
<p>{currentHandAccuracy.toFixed(2)}</p>
</Tooltip> </Tooltip>
{scoreImprovement && previousHandAccuracy && ( {scoreImprovement && previousHandAccuracy && (
<Tooltip display={`Previous ${formattedHand} Hand Accuracy: ${previousHandAccuracy.toFixed(2)}`}> <Tooltip
display={
<>
<p className="font-semibold">{formattedHand} Hand Accuracy</p>
<p>Hand Accuracy: {previousHandAccuracy.toFixed(2)}</p>
<p>Accuracy: {((previousHandAccuracy / 115) * 100).toFixed(2)}%</p>
</>
}
>
<Change <Change
className="text-xs" className="text-xs"
change={scoreImprovement.handAccuracy[hand]} change={scoreImprovement.handAccuracy[hand]}