diff --git a/ui/src/Game.tsx b/ui/src/Game.tsx index c2bd6f0..28874d4 100644 --- a/ui/src/Game.tsx +++ b/ui/src/Game.tsx @@ -107,7 +107,6 @@ export function Game(props: { function addWordFn(word: string) { props.wasm.add_word(word); - logDispatch(
{word} was added to dictionary.
); } const [playerLetters, trayDispatch] = useReducer(movePlayableLetters, []); @@ -359,7 +358,7 @@ export function Game(props: { if (message.endsWith("is not a valid word")) { // extract out word const word = message.split(" ")[0]; - logDispatch(
{message}
); + logDispatch(); } else { logDispatch(
{message}
); } @@ -410,12 +409,24 @@ export function Game(props: { function AddWordButton(props: {word: string, addWordFn: (x: string) => void}) { const [isClicked, setIsClicked] = useState(false); - return -} \ No newline at end of file + if (!isClicked) { + return
+ {props.word} is not a valid word. + +
; + } else { + return
+ {props.word} was added to dictionary. +
; + } + +} + diff --git a/ui/src/style.less b/ui/src/style.less index 865561a..e893181 100644 --- a/ui/src/style.less +++ b/ui/src/style.less @@ -270,4 +270,13 @@ dialog { } +} + +button.add-to-dictionary { + padding: 0; + margin: 0 0 0 1em; +} + +div.log { + line-height: 1.5em; } \ No newline at end of file