diff options
Diffstat (limited to 'sw-ui-kt/src')
3 files changed, 5 insertions, 6 deletions
diff --git a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt index e32409e4..375ac96f 100644 --- a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt +++ b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt @@ -18,7 +18,7 @@ import kotlinx.html.title import org.luxons.sevenwonders.model.api.LobbyDTO import org.luxons.sevenwonders.model.api.State import org.luxons.sevenwonders.ui.redux.RequestJoinGameAction -import org.luxons.sevenwonders.ui.redux.connect +import org.luxons.sevenwonders.ui.redux.connectStateAndDispatch import react.RBuilder import react.RComponent import react.RProps @@ -115,7 +115,7 @@ private fun RBuilder.joinButton(lobby: LobbyDTO, joinGame: (Long) -> Unit) { ) } -val gameList = connect<GameListStateProps, GameListDispatchProps, GameListProps>( +val gameList = connectStateAndDispatch<GameListStateProps, GameListDispatchProps, GameListProps>( clazz = GameListPresenter::class, mapStateToProps = { state, _ -> games = state.games diff --git a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt index 959085f3..62f1c524 100644 --- a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt +++ b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt @@ -5,7 +5,7 @@ import com.palantir.blueprintjs.bpButton import org.luxons.sevenwonders.model.api.LobbyDTO import org.luxons.sevenwonders.model.api.PlayerDTO import org.luxons.sevenwonders.ui.redux.RequestStartGameAction -import org.luxons.sevenwonders.ui.redux.connect +import org.luxons.sevenwonders.ui.redux.connectStateAndDispatch import react.RBuilder import react.RComponent import react.RProps @@ -52,7 +52,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(props) fun RBuilder.lobby() = lobby {} -private val lobby = connect<LobbyStateProps, LobbyDispatchProps, LobbyProps>( +private val lobby = connectStateAndDispatch<LobbyStateProps, LobbyDispatchProps, LobbyProps>( clazz = LobbyPresenter::class, mapStateToProps = { state, _ -> currentGame = state.currentLobby diff --git a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Utils.kt b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Utils.kt index dc85d358..67ac5304 100644 --- a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Utils.kt +++ b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Utils.kt @@ -26,8 +26,7 @@ inline fun <reified SP : RProps> connectState( return connect.invoke(clazz.js.unsafeCast<RClass<SP>>()) } - -inline fun <reified SP : RProps, reified DP : RProps, reified P : RProps> connect( +inline fun <reified SP : RProps, reified DP : RProps, reified P : RProps> connectStateAndDispatch( clazz: KClass<out RComponent<P, out RState>>, noinline mapStateToProps: SP.(SwState, RProps) -> Unit, noinline mapDispatchToProps: DP.((RAction) -> WrapperAction, RProps) -> Unit |