mancala/apps/frontend/src/components/GameClockView.tsx
Halit Aksoy efe97da0b7 feat(frontend): lay out the game page in the new design
Players beside the board with avatar, online status, store count and
clock, the turn between them, a game-over card over the board, and a
move list with the newest move first and tags for extra turns,
captures and store gains. On phones the bottom player is shown below
the board.
2026-10-16 09:41:47 +03:00

19 lines
611 B
TypeScript

import * as React from 'react';
import { FunctionComponent } from 'react';
import { CLOCK_LOW_TIME_MS, formatClock } from "@mancala/core";
// One player's clock: highlighted while it runs, in a warning colour when the running clock is low.
const GameClockView: FunctionComponent<{
timeMs: number,
running: boolean,
}> = ({ timeMs, running }) => {
const lowTime = running && timeMs < CLOCK_LOW_TIME_MS;
return (
<span className={"clock" + (lowTime ? " low" : running ? " run" : "")} role="timer">
{formatClock(timeMs)}
</span>
);
}
export default GameClockView;