diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-24 15:24:30 +0100 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-24 15:25:14 +0100 |
commit | 6a191bb64f1a3119c0bce91d9a17c1fc8f379684 (patch) | |
tree | 88bc88e7b2cc53e3fcd276a0e76e922735a98a1a /sw-ui-kt/src | |
parent | Add blueprint NonIdealState (diff) | |
download | seven-wonders-6a191bb64f1a3119c0bce91d9a17c1fc8f379684.tar.gz seven-wonders-6a191bb64f1a3119c0bce91d9a17c1fc8f379684.tar.bz2 seven-wonders-6a191bb64f1a3119c0bce91d9a17c1fc8f379684.zip |
Rename connect to connectStateAndDispatch to avoid conflicts
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 |