diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-23 00:13:16 +0100 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-23 00:13:16 +0100 |
commit | 809194757e4c42d9aeb04efdc8923a9de451f287 (patch) | |
tree | ce89945e4be006539595a5faadba857a2a2f5491 /sw-ui-kt | |
parent | Migrate game browser to blueprint components (diff) | |
download | seven-wonders-809194757e4c42d9aeb04efdc8923a9de451f287.tar.gz seven-wonders-809194757e4c42d9aeb04efdc8923a9de451f287.tar.bz2 seven-wonders-809194757e4c42d9aeb04efdc8923a9de451f287.zip |
Add player info
Diffstat (limited to 'sw-ui-kt')
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 + } +) |