diff --git a/apps/frontend/src/components/history/MoveList.tsx b/apps/frontend/src/components/history/MoveList.tsx index 3daf240..ca0016a 100644 --- a/apps/frontend/src/components/history/MoveList.tsx +++ b/apps/frontend/src/components/history/MoveList.tsx @@ -1,8 +1,9 @@ import * as React from "react"; import { FunctionComponent, useEffect, useRef, useState } from "react"; -import { describeMove, getColorByBrightness, PlayedMove } from "@mancala/core"; +import { getColorByBrightness, PlayedMove } from "@mancala/core"; import { useTranslation } from "react-i18next"; import { Context } from "../../context/context"; +import { getMoveText } from "../../util/MoveText"; // The moves of a game; the shown position is highlighted and any entry can be selected. Entry 0 is the start. const MoveList: FunctionComponent<{ @@ -31,17 +32,6 @@ const MoveList: FunctionComponent<{ } }, [selectedMove, moves.length, collapsed]); - const describe = (moveNumber: number): string => { - const move = describeMove(moves, moveNumber); - const events = [ - move.extraTurn ? `★ ${t("ExtraTurn")}` : undefined, - move.capture ? `✂ ${t("Capture")}` : undefined, - move.storeGain > 0 ? t("StoreGain", { count: move.storeGain }) : undefined, - move.gameOver ? `⚑ ${t("GameOver")}` : undefined, - ].filter(Boolean); - return [t("PitNumber", { pit: move.pit }), ...events].join(" · "); - }; - const entry = (moveNumber: number, label: React.ReactNode) => (