summaryrefslogtreecommitdiff
path: root/sw-ui
diff options
context:
space:
mode:
Diffstat (limited to 'sw-ui')
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt32
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt12
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/ApiActions.kt2
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt10
4 files changed, 29 insertions, 27 deletions
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt
index 778fe9d7..3545113b 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt
@@ -214,19 +214,19 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta
fun RBuilder.gameScene() = gameScene {}
private val gameScene: RClass<GameSceneProps> =
- connectStateAndDispatch<GameSceneStateProps, GameSceneDispatchProps, GameSceneProps>(
- clazz = GameScene::class,
- mapDispatchToProps = { dispatch, _ ->
- prepareMove = { move -> dispatch(RequestPrepareMove(move)) }
- unprepareMove = { dispatch(RequestUnprepareMove()) }
- sayReady = { dispatch(RequestSayReady()) }
- leaveGame = { dispatch(RequestLeaveGame()) }
- },
- mapStateToProps = { state, _ ->
- playerIsReady = state.currentPlayer?.isReady == true
- players = state.gameState?.players ?: emptyList()
- gameState = state.gameState
- preparedMove = state.gameState?.currentPreparedMove
- preparedCard = state.gameState?.currentPreparedCard
- }
- )
+ connectStateAndDispatch<GameSceneStateProps, GameSceneDispatchProps, GameSceneProps>(
+ clazz = GameScene::class,
+ mapDispatchToProps = { dispatch, _ ->
+ prepareMove = { move -> dispatch(RequestPrepareMove(move)) }
+ unprepareMove = { dispatch(RequestUnprepareMove()) }
+ sayReady = { dispatch(RequestSayReady()) }
+ leaveGame = { dispatch(RequestLeaveGame()) }
+ },
+ mapStateToProps = { state, _ ->
+ playerIsReady = state.currentPlayer?.isReady == true
+ players = state.gameState?.players ?: emptyList()
+ gameState = state.gameState
+ preparedMove = state.gameState?.currentPreparedMove
+ preparedCard = state.gameState?.currentPreparedCard
+ }
+ )
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt
index 17365bdd..315e25e8 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Hand.kt
@@ -112,14 +112,16 @@ class HandComponent(props: HandProps) : RComponent<HandProps, RState>(props) {
}
private fun RElementBuilder<IButtonGroupProps>.playCardButton(card: HandCard, handAction: HandAction) {
- bpButton(title = "${handAction.buttonTitle} (${cardPlayabilityInfo(card.playability)})",
+ bpButton(
+ title = "${handAction.buttonTitle} (${cardPlayabilityInfo(card.playability)})",
large = true,
intent = Intent.SUCCESS,
disabled = !card.playability.isPlayable,
onClick = {
val transactions = card.playability.cheapestTransactions.first()
props.prepareMove(PlayerMove(handAction.moveType, card.name, transactions))
- }) {
+ }
+ ) {
bpIcon(handAction.icon)
if (card.playability.isPlayable && !card.playability.isFree) {
priceInfo(card.playability.minPrice)
@@ -129,14 +131,16 @@ class HandComponent(props: HandProps) : RComponent<HandProps, RState>(props) {
private fun RElementBuilder<IButtonGroupProps>.upgradeWonderButton(card: HandCard) {
val wonderBuildability = props.turnInfo.wonderBuildability
- bpButton(title = "UPGRADE WONDER (${wonderBuildabilityInfo(wonderBuildability)})",
+ bpButton(
+ title = "UPGRADE WONDER (${wonderBuildabilityInfo(wonderBuildability)})",
large = true,
intent = Intent.PRIMARY,
disabled = !wonderBuildability.isBuildable,
onClick = {
val transactions = wonderBuildability.cheapestTransactions.first()
props.prepareMove(PlayerMove(MoveType.UPGRADE_WONDER, card.name, transactions))
- }) {
+ }
+ ) {
bpIcon("key-shift")
if (wonderBuildability.isBuildable && !wonderBuildability.isFree) {
priceInfo(wonderBuildability.minPrice)
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/ApiActions.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/ApiActions.kt
index 53cdeaf4..d259da81 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/ApiActions.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/ApiActions.kt
@@ -1,7 +1,7 @@
package org.luxons.sevenwonders.ui.redux
-import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.PlayerMove
+import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.wonders.AssignedWonder
import redux.RAction
diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt
index 047e948a..7eca24b8 100644
--- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt
+++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Reducers.kt
@@ -55,9 +55,7 @@ private fun currentLobbyReducer(currentLobby: LobbyDTO?, action: RAction): Lobby
is EnterLobbyAction -> action.lobby
is UpdateLobbyAction -> action.lobby
is PlayerReadyEvent -> currentLobby?.let { l ->
- l.copy(players = l.players.map { p ->
- if (p.username == action.username) p.copy(isReady = true) else p
- })
+ l.copy(players = l.players.map { p -> if (p.username == action.username) p.copy(isReady = true) else p })
}
else -> currentLobby
}
@@ -73,9 +71,9 @@ private fun gameStateReducer(gameState: GameState?, action: RAction): GameState?
is PreparedCardEvent -> gameState?.copy(
preparedCardsByUsername = gameState.preparedCardsByUsername + (action.card.username to action.card.cardBack)
)
- is PlayerReadyEvent -> gameState?.copy(players = gameState.players.map { p ->
- if (p.username == action.username) p.copy(isReady = true) else p
- })
+ is PlayerReadyEvent -> gameState?.copy(
+ players = gameState.players.map { p -> if (p.username == action.username) p.copy(isReady = true) else p }
+ )
is TurnInfoEvent -> gameState?.copy(
players = gameState.players.map { p -> p.copy(isReady = false) },
turnInfo = action.turnInfo,
bgstack15