diff options
author | joffrey-bion <joffrey.bion@gmail.com> | 2021-02-10 01:47:39 +0100 |
---|---|---|
committer | joffrey-bion <joffrey.bion@gmail.com> | 2021-02-10 01:47:39 +0100 |
commit | 24084379f0790b70346c3cf424a4f66fa661badf (patch) | |
tree | 9db5eba41e259389bbf642599fd5e74329207b36 /sw-ui/src | |
parent | Show all cards as playable when special free card ability (diff) | |
download | seven-wonders-24084379f0790b70346c3cf424a4f66fa661badf.tar.gz seven-wonders-24084379f0790b70346c3cf424a4f66fa661badf.tar.bz2 seven-wonders-24084379f0790b70346c3cf424a4f66fa661badf.zip |
Remove key binding for name generation
This conflicts with usernames containing R
Resolves:
https://github.com/joffrey-bion/seven-wonders/issues/112
Diffstat (limited to 'sw-ui/src')
-rw-r--r-- | sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt index 4f79f19d..2ebabcc9 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt @@ -3,15 +3,12 @@ package org.luxons.sevenwonders.ui.components.home import com.palantir.blueprintjs.Intent import com.palantir.blueprintjs.bpButton import com.palantir.blueprintjs.bpInputGroup -import kotlinx.browser.document import kotlinx.css.* import kotlinx.html.js.onSubmitFunction import org.luxons.sevenwonders.ui.redux.RequestChooseName import org.luxons.sevenwonders.ui.redux.connectDispatch import org.w3c.dom.HTMLInputElement import org.w3c.dom.events.Event -import org.w3c.dom.events.EventListener -import org.w3c.dom.events.KeyboardEvent import react.* import styled.css import styled.styledDiv @@ -23,29 +20,12 @@ private interface ChooseNameFormProps : RProps { private data class ChooseNameFormState(var username: String = "") : RState -private const val KEY_RANDOM_NAME = "r" - private class ChooseNameForm(props: ChooseNameFormProps) : RComponent<ChooseNameFormProps, ChooseNameFormState>(props) { - val rKeyListener = EventListener { event: Event -> - val e = event as? KeyboardEvent ?: return@EventListener - if (e.key == KEY_RANDOM_NAME) { - fillRandomUsername() - } - } - override fun ChooseNameFormState.init(props: ChooseNameFormProps) { username = "" } - override fun componentWillMount() { - document.addEventListener(type = "keydown", callback = rKeyListener) - } - - override fun componentWillUnmount() { - document.removeEventListener(type = "keydown", callback = rKeyListener) - } - override fun RBuilder.render() { styledForm { css { @@ -79,7 +59,7 @@ private class ChooseNameForm(props: ChooseNameFormProps) : RComponent<ChooseName private fun RBuilder.randomNameButton() { bpButton( - title = "Generate random name (${KEY_RANDOM_NAME.toUpperCase()})", + title = "Generate random name", large = true, icon = "random", intent = Intent.PRIMARY, |