import * as React from "react"; import { FunctionComponent } from "react"; import { useTranslation } from "react-i18next"; import { BOT_LEVELS, BotLevel, getBotLevelTextKey, getLastBotLevel, setLastBotLevel } from "@mancala/core"; import { Context } from "../context/context"; // The four bot levels as buttons; the level chosen last is highlighted and remembered on this device. const BotLevelPicker: FunctionComponent<{ context: Context, onChoose: (level: BotLevel) => void }> = ({ context, onChoose }) => { const { t } = useTranslation(); const lastLevel = getLastBotLevel(context.storage); const choose = (level: BotLevel) => { setLastBotLevel(context.storage, level); onChoose(level); }; return (