Skip to content

Commit 0bad60a

Browse files
Fix GameClock to show Maia strength level (e.g., 'Maia 1100')
Co-authored-by: ashtonanderson <32369295+ashtonanderson@users.noreply.github.com>
1 parent b84ffdd commit 0bad60a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/Board/GameClock.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const GameClock: React.FC<Props> = (
1313
props: React.PropsWithChildren<Props>,
1414
) => {
1515
const { user } = useContext(AuthContext)
16-
const { player, toPlay, whiteClock, blackClock, lastMoveTime } = useContext(
16+
const { player, toPlay, whiteClock, blackClock, lastMoveTime, maiaVersion } = useContext(
1717
PlayControllerContext,
1818
)
1919

@@ -29,6 +29,11 @@ export const GameClock: React.FC<Props> = (
2929
0,
3030
)
3131

32+
// Convert maiaVersion (e.g., "maia_kdd_1100") to display name (e.g., "Maia 1100")
33+
const getMaiaDisplayName = (version: string) => {
34+
return version.replace('maia_kdd_', 'Maia ')
35+
}
36+
3237
useEffect(() => {
3338
setReferenceTime(Date.now())
3439

@@ -52,7 +57,7 @@ export const GameClock: React.FC<Props> = (
5257
>
5358
<div className="px-4 py-2">
5459
{props.player == 'black' ? '●' : '○'}{' '}
55-
{player == props.player ? user?.displayName : 'Maia'}
60+
{player == props.player ? user?.displayName : getMaiaDisplayName(maiaVersion)}
5661
</div>
5762
<div className="inline-flex self-start px-4 py-2 md:text-3xl">
5863
{minutes}:{('00' + seconds).slice(-2)}

0 commit comments

Comments
 (0)