diff --git a/src/Game.tsx b/src/Game.tsx index eb5051d..430ffe6 100644 --- a/src/Game.tsx +++ b/src/Game.tsx @@ -98,6 +98,21 @@ function Game(props: GameProps) { setGameNumber((x) => x + 1); }; + function copyToClipboard(text: string, successHint: string) { + if (!navigator.clipboard) { + setHint(text); + } else { + navigator.clipboard + .writeText(text) + .then(() => { + setHint(successHint); + }) + .catch(() => { + setHint(text); + }); + } + } + const onKey = (key: string) => { if (gameState !== GameState.Playing) { if (key === "Enter") { @@ -250,7 +265,10 @@ function Game(props: GameProps) {

{hint || `\u00a0`}

@@ -259,23 +277,32 @@ function Game(props: GameProps) {

+

)} {challenge ? (