import friendlyTime from 'friendly-time'; import { CSSProperties } from 'react'; import { gameInfo } from '../api/api'; var LeftAlignedTableColumn: CSSProperties = { textAlign: 'left', paddingLeft: 16, }; var RightAlignedTableColumn: CSSProperties = { textAlign: 'right', paddingRight: 16, }; function GameOutcome(props: { game: gameInfo; }) { var gameStatus = (() => { return { 'resign': () => 'Opgegeven', 'wait_for_opponent': () => 'Aan het wachten op een tegenstander', 'in_progress': () => 'Bezig', 'finished': () => { return { 'w': 'Gewonnen', 'l': 'Verloren', 'd': 'Gelijkspel', }[props.game.outcome]; }, }[props.game.status](); })(); return
Tegenstander | Uitkomst | Zetten | Datum |
---|---|---|---|
{game.opponent?.username} | {Math.max(0, game.moves.length - 1)} | {(() => { var timeCreated = new Date(game.created); return friendlyTime(timeCreated); })()} |