Refactor how keybinds are handled

Move the conditional game status checking logic into an action and make
the keydown event listener simpler