diff options
Diffstat (limited to 'sw-ui-kt/src/main')
2 files changed, 38 insertions, 3 deletions
diff --git a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt index c1bbf460..a761b6f2 100644 --- a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt +++ b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt @@ -3,6 +3,7 @@ package org.luxons.sevenwonders.ui.components.gameBrowser import com.palantir.blueprintjs.Intent import com.palantir.blueprintjs.bpButton import com.palantir.blueprintjs.bpInputGroup +import com.palantir.blueprintjs.org.luxons.sevenwonders.ui.components.gameBrowser.playerInfo import com.palantir.blueprintjs.org.luxons.sevenwonders.ui.utils.createElement import kotlinx.css.Display import kotlinx.css.FlexDirection @@ -57,9 +58,7 @@ private class CreateGameForm(props: CreateGameFormProps): RComponent<CreateGameF rightElement = createGameButton() ) } - // TODO - div { +"PLAYER INFO HERE" } - //playerInfo() + playerInfo() } } diff --git a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt new file mode 100644 index 00000000..eefaec30 --- /dev/null +++ b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt @@ -0,0 +1,36 @@ +package com.palantir.blueprintjs.org.luxons.sevenwonders.ui.components.gameBrowser + +import org.luxons.sevenwonders.model.api.PlayerDTO +import org.luxons.sevenwonders.ui.redux.connectState +import react.RBuilder +import react.RComponent +import react.RProps +import react.RState +import react.dom.* + +interface PlayerInfoProps : RProps { + var currentPlayer: PlayerDTO? +} + +class PlayerInfoPresenter(props: PlayerInfoProps) : RComponent<PlayerInfoProps, RState>(props) { + + override fun RBuilder.render() { + span { + b { + +"Username:" + } + props.currentPlayer?.let { + + " ${it.displayName}" + } + } + } +} + +fun RBuilder.playerInfo() = playerInfo {} + +private val playerInfo = connectState( + clazz = PlayerInfoPresenter::class, + mapStateToProps = { state, _ -> + currentPlayer = state.player + } +) |