diff options
Diffstat (limited to 'sw-ui')
16 files changed, 88 insertions, 119 deletions
diff --git a/sw-ui/build.gradle.kts b/sw-ui/build.gradle.kts index c28a431e..e05a2f3b 100644 --- a/sw-ui/build.gradle.kts +++ b/sw-ui/build.gradle.kts @@ -2,6 +2,7 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack plugins { kotlin("js") + id("org.jlleitschuh.gradle.ktlint") } repositories { diff --git a/sw-ui/src/main/kotlin/blueprintjs.kt b/sw-ui/src/main/kotlin/blueprintjs.kt index 13de8744..55a2ccc4 100644 --- a/sw-ui/src/main/kotlin/blueprintjs.kt +++ b/sw-ui/src/main/kotlin/blueprintjs.kt @@ -5,7 +5,10 @@ import org.w3c.dom.HTMLElement import org.w3c.dom.HTMLInputElement import org.w3c.dom.events.Event import org.w3c.dom.events.MouseEvent -import react.* +import react.PureComponent +import react.RProps +import react.RState +import react.ReactElement /** * The four basic intents. @@ -16,8 +19,8 @@ import react.* // SUCCESS: "success"; // WARNING: "warning"; // DANGER: "danger"; -//}; -//export declare type Intent = typeof Intent[keyof typeof Intent]; +// }; +// export declare type Intent = typeof Intent[keyof typeof Intent]; external enum class Intent { NONE, PRIMARY, @@ -27,12 +30,12 @@ external enum class Intent { } /** Alignment along the horizontal axis. */ -//export declare const Alignment: { +// export declare const Alignment: { // CENTER: "center"; // LEFT: "left"; // RIGHT: "right"; -//}; -//export declare type Alignment = typeof Alignment[keyof typeof Alignment]; +// }; +// export declare type Alignment = typeof Alignment[keyof typeof Alignment]; external enum class Alignment { CENTER, LEFT, @@ -130,7 +133,7 @@ external interface IIconProps : IIntentProps, IProps { */ var iconSize: Int? /** CSS style properties. */ - //var style: CSSProperties? // TODO + // var style: CSSProperties? // TODO /** * HTML tag to use for the rendered element. * @default "span" @@ -197,15 +200,14 @@ external interface IButtonProps : IActionProps { * Note that this prop has no effect on `AnchorButton`; it only affects `Button`. * @default "button" */ - var type: String? //"submit" | "reset" | "button"; + var type: String? // "submit" | "reset" | "button"; } external interface IButtonState : RState { var isActive: Boolean } -abstract external class AbstractButton : PureComponent<IButtonProps, IButtonState> { -} +abstract external class AbstractButton : PureComponent<IButtonProps, IButtonState> external class Button : AbstractButton { override fun render(): ReactElement @@ -264,7 +266,7 @@ external interface IInputGroupProps : IControlledProps, IIntentProps, IProps { */ var fill: Boolean? /** Ref handler that receives HTML `<input>` element backing this component. */ - var inputRef: ((ref: HTMLInputElement?) -> Any)?; + var inputRef: ((ref: HTMLInputElement?) -> Any)? /** * Name of a Blueprint UI icon (or an icon element) to render on the left side of the input group, * before the user's cursor. @@ -342,7 +344,7 @@ external interface ITagProps : IProps, IIntentProps { * Callback invoked when the tag is clicked. * Recommended when `interactive` is `true`. */ - var onClick: ((e: MouseEvent) -> Unit)?; + var onClick: ((e: MouseEvent) -> Unit)? /** * Click handler for remove button. * The remove button will only be rendered if this prop is defined. @@ -491,7 +493,7 @@ external interface IBackdropProps { /** CSS class names to apply to backdrop element. */ var backdropClassName: String? /** HTML props for the backdrop element. */ - var backdropProps: RProps? //React.HTMLProps<HTMLDivElement>? + var backdropProps: RProps? // React.HTMLProps<HTMLDivElement>? /** * Whether clicking outside the overlay element (either on backdrop when present or on document) * should invoke `onClose`. @@ -522,4 +524,4 @@ external interface IOverlayState : RState { } external class Overlay : PureComponent<IOverlayProps, IOverlayState> { override fun render(): ReactElement -}
\ No newline at end of file +} diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt index dd67757a..fb5a0494 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/Board.kt @@ -108,7 +108,7 @@ private fun RBuilder.wonderComponent(wonder: ApiWonder) { width = 100.vw textAlign = TextAlign.center } - styledImg(src="/images/wonders/${wonder.image}") { + styledImg(src = "/images/wonders/${wonder.image}") { css { declarations["border-radius"] = "0.5%/1.5%" boxShadow(color = Color.black, offsetX = 0.2.rem, offsetY = 0.2.rem, blurRadius = 0.5.rem) 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 d54a0240..df0c3a98 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 @@ -4,20 +4,8 @@ import com.palantir.blueprintjs.Intent import com.palantir.blueprintjs.bpButton import com.palantir.blueprintjs.bpButtonGroup import com.palantir.blueprintjs.bpOverlay -import kotlinx.css.Position -import kotlinx.css.background -import kotlinx.css.backgroundSize -import kotlinx.css.bottom -import kotlinx.css.left -import kotlinx.css.pct -import kotlinx.css.position -import kotlinx.css.properties.transform -import kotlinx.css.properties.translate -import kotlinx.css.px -import kotlinx.css.rem -import kotlinx.css.right -import kotlinx.css.top -import kotlinx.html.DIV +import kotlinx.css.* +import kotlinx.css.properties.* import org.luxons.sevenwonders.model.Action import org.luxons.sevenwonders.model.PlayerMove import org.luxons.sevenwonders.model.PlayerTurnInfo @@ -36,11 +24,10 @@ import react.RProps import react.RState import react.ReactElement import react.dom.* -import styled.StyledDOMBuilder import styled.css import styled.styledDiv -interface GameSceneStateProps: RProps { +interface GameSceneStateProps : RProps { var playerIsReady: Boolean var players: List<PlayerDTO> var gameState: GameState? @@ -48,7 +35,7 @@ interface GameSceneStateProps: RProps { var preparedCard: HandCard? } -interface GameSceneDispatchProps: RProps { +interface GameSceneDispatchProps : RProps { var sayReady: () -> Unit var prepareMove: (move: PlayerMove) -> Unit var unprepareMove: () -> Unit @@ -67,7 +54,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta } val turnInfo = props.gameState?.turnInfo if (turnInfo == null) { - p { +"Error: no turn info data"} + p { +"Error: no turn info data" } } else { turnInfoScene(turnInfo) } @@ -111,7 +98,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta val board = turnInfo.table.boards[turnInfo.playerIndex] div { // TODO use blueprint's Callout component without header and primary intent - p { + turnInfo.message } + p { +turnInfo.message } boardComponent(board = board) val hand = turnInfo.hand if (hand != null) { @@ -159,20 +146,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()) } - }, - mapStateToProps = { state, _ -> - playerIsReady = state.currentPlayer?.isReady == true - players = state.gameState?.players ?: emptyList() - gameState = state.gameState - preparedMove = state.gameState?.currentPreparedMove - preparedCard = state.gameState?.currentPreparedCard - } -) - +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()) } + }, + 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 17ceffd2..b86f1894 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 @@ -38,8 +38,6 @@ import kotlinx.html.DIV import org.luxons.sevenwonders.model.MoveType import org.luxons.sevenwonders.model.PlayerMove import org.luxons.sevenwonders.model.cards.HandCard -import org.luxons.sevenwonders.model.cards.PreparedCard -import org.luxons.sevenwonders.ui.components.game.cardImage import react.RBuilder import styled.StyledDOMBuilder import styled.css diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ProductionBar.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ProductionBar.kt index 773e9835..ea80a827 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ProductionBar.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ProductionBar.kt @@ -27,6 +27,7 @@ import kotlinx.css.vw import kotlinx.css.width import kotlinx.css.zIndex import kotlinx.html.DIV +import kotlinx.html.IMG import kotlinx.html.title import org.luxons.sevenwonders.model.boards.Production import org.luxons.sevenwonders.model.resources.CountedResource @@ -113,7 +114,7 @@ private fun RBuilder.tokenWithCount(tokenName: String, count: Int, block: Styled } } -private fun RBuilder.tokenImage(tokenName: String, block: StyledDOMBuilder<DIV>.() -> Unit = {}) { +private fun RBuilder.tokenImage(tokenName: String, block: StyledDOMBuilder<IMG>.() -> Unit = {}) { styledImg(src = getTokenImagePath(tokenName)) { css { tokenImageStyle() @@ -122,12 +123,13 @@ private fun RBuilder.tokenImage(tokenName: String, block: StyledDOMBuilder<DIV>. this.title = tokenName this.alt = tokenName } + block() } } -private fun getTokenImagePath(tokenName: String)= "/images/tokens/${tokenName}.png" +private fun getTokenImagePath(tokenName: String) = "/images/tokens/$tokenName.png" -private fun getTokenName(resourceType: ResourceType)= "resources/${resourceType.toString().toLowerCase()}" +private fun getTokenName(resourceType: ResourceType) = "resources/${resourceType.toString().toLowerCase()}" private fun CSSBuilder.productionBarStyle() { alignItems = Align.center diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt index 876a167e..82e1ae1a 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/CreateGameForm.kt @@ -3,12 +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 kotlinx.css.Display -import kotlinx.css.FlexDirection -import kotlinx.css.JustifyContent -import kotlinx.css.display -import kotlinx.css.flexDirection -import kotlinx.css.justifyContent +import kotlinx.css.* import kotlinx.html.js.onSubmitFunction import org.luxons.sevenwonders.ui.redux.RequestCreateGame import org.luxons.sevenwonders.ui.redux.connectDispatch @@ -24,13 +19,13 @@ import react.dom.* import styled.css import styled.styledDiv -private interface CreateGameFormProps: RProps { +private interface CreateGameFormProps : RProps { var createGame: (String) -> Unit } -private data class CreateGameFormState(var gameName: String = ""): RState +private data class CreateGameFormState(var gameName: String = "") : RState -private class CreateGameForm(props: CreateGameFormProps): RComponent<CreateGameFormProps, CreateGameFormState>(props) { +private class CreateGameForm(props: CreateGameFormProps) : RComponent<CreateGameFormProps, CreateGameFormState>(props) { override fun CreateGameFormState.init(props: CreateGameFormProps) { gameName = "" diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt index 47c17da1..1e591f87 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameList.kt @@ -5,14 +5,7 @@ import com.palantir.blueprintjs.Intent import com.palantir.blueprintjs.bpButton import com.palantir.blueprintjs.bpIcon import com.palantir.blueprintjs.bpTag -import kotlinx.css.Align -import kotlinx.css.Display -import kotlinx.css.FlexDirection -import kotlinx.css.VerticalAlign -import kotlinx.css.alignItems -import kotlinx.css.display -import kotlinx.css.flexDirection -import kotlinx.css.verticalAlign +import kotlinx.css.* import kotlinx.html.classes import kotlinx.html.title import org.luxons.sevenwonders.model.api.ConnectedPlayer @@ -35,7 +28,7 @@ interface GameListStateProps : RProps { var games: List<LobbyDTO> } -interface GameListDispatchProps: RProps { +interface GameListDispatchProps : RProps { var joinGame: (Long) -> Unit } @@ -53,7 +46,7 @@ class GameListPresenter(props: GameListProps) : RComponent<GameListProps, RState } tbody { props.games.forEach { - gameListItemRow(it, props.joinGame) + gameListItemRow(it) } } } @@ -66,7 +59,7 @@ class GameListPresenter(props: GameListProps) : RComponent<GameListProps, RState th { +"Join" } } - private fun RBuilder.gameListItemRow(lobby: LobbyDTO, joinGame: (Long) -> Unit) = styledTr { + private fun RBuilder.gameListItemRow(lobby: LobbyDTO) = styledTr { css { verticalAlign = VerticalAlign.middle } @@ -80,7 +73,7 @@ class GameListPresenter(props: GameListProps) : RComponent<GameListProps, RState } private fun RBuilder.gameStatus(state: State) { - val intent = when(state) { + val intent = when (state) { State.LOBBY -> Intent.SUCCESS State.PLAYING -> Intent.WARNING State.FINISHED -> Intent.DANGER diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt index 1aa4be43..e6052f22 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt @@ -17,13 +17,13 @@ import react.RState import react.ReactElement import react.dom.* -private interface ChooseNameFormProps: RProps { +private interface ChooseNameFormProps : RProps { var chooseUsername: (String) -> Unit } -private data class ChooseNameFormState(var username: String = ""): RState +private data class ChooseNameFormState(var username: String = "") : RState -private class ChooseNameForm(props: ChooseNameFormProps): RComponent<ChooseNameFormProps, ChooseNameFormState>(props) { +private class ChooseNameForm(props: ChooseNameFormProps) : RComponent<ChooseNameFormProps, ChooseNameFormState>(props) { override fun ChooseNameFormState.init(props: ChooseNameFormProps) { username = "" diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/RadialPlayerList.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/RadialPlayerList.kt index ff541696..0c1a5570 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/RadialPlayerList.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/RadialPlayerList.kt @@ -3,14 +3,7 @@ package org.luxons.sevenwonders.ui.components.lobby import com.palantir.blueprintjs.IconName import com.palantir.blueprintjs.Intent import com.palantir.blueprintjs.bpIcon -import kotlinx.css.Align -import kotlinx.css.Display -import kotlinx.css.FlexDirection -import kotlinx.css.alignItems -import kotlinx.css.display -import kotlinx.css.flexDirection -import kotlinx.css.margin -import kotlinx.css.opacity +import kotlinx.css.* import org.luxons.sevenwonders.model.api.PlayerDTO import react.RBuilder import react.ReactElement @@ -77,7 +70,7 @@ private fun RBuilder.playerItem(player: PlayerDTO, isMe: Boolean): ReactElement userIcon(isMe = isMe, isOwner = player.isGameOwner, title = title) styledH5 { css { - margin = "0" + margin = "0" } +player.displayName } @@ -93,7 +86,7 @@ private fun RBuilder.playerPlaceholder(): ReactElement = styledDiv { userIcon(isMe = false, isOwner = false, title = "Waiting for player...") styledH5 { css { - margin = "0" + margin = "0" } +"?" } diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Actions.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Actions.kt index 3e3de561..bacf6795 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Actions.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Actions.kt @@ -7,20 +7,20 @@ import org.luxons.sevenwonders.model.api.LobbyDTO import org.luxons.sevenwonders.model.cards.PreparedCard import redux.RAction -data class SetCurrentPlayerAction(val player: ConnectedPlayer): RAction +data class SetCurrentPlayerAction(val player: ConnectedPlayer) : RAction -data class UpdateGameListAction(val games: List<LobbyDTO>): RAction +data class UpdateGameListAction(val games: List<LobbyDTO>) : RAction -data class UpdateLobbyAction(val lobby: LobbyDTO): RAction +data class UpdateLobbyAction(val lobby: LobbyDTO) : RAction -data class EnterLobbyAction(val lobby: LobbyDTO): RAction +data class EnterLobbyAction(val lobby: LobbyDTO) : RAction -data class EnterGameAction(val lobby: LobbyDTO, val turnInfo: PlayerTurnInfo): RAction +data class EnterGameAction(val lobby: LobbyDTO, val turnInfo: PlayerTurnInfo) : RAction -data class TurnInfoEvent(val turnInfo: PlayerTurnInfo): RAction +data class TurnInfoEvent(val turnInfo: PlayerTurnInfo) : RAction -data class PreparedMoveEvent(val move: PlayerMove): RAction +data class PreparedMoveEvent(val move: PlayerMove) : RAction -data class PreparedCardEvent(val card: PreparedCard): RAction +data class PreparedCardEvent(val card: PreparedCard) : RAction -data class PlayerReadyEvent(val username: String): RAction +data class PlayerReadyEvent(val username: String) : RAction 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 836f5b4e..9e2593d4 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 @@ -4,20 +4,20 @@ import org.luxons.sevenwonders.model.CustomizableSettings import org.luxons.sevenwonders.model.PlayerMove import redux.RAction -data class RequestChooseName(val playerName: String): RAction +data class RequestChooseName(val playerName: String) : RAction -data class RequestCreateGame(val gameName: String): RAction +data class RequestCreateGame(val gameName: String) : RAction -data class RequestJoinGame(val gameId: Long): RAction +data class RequestJoinGame(val gameId: Long) : RAction -data class RequestReorderPlayers(val orderedPlayers: List<String>): RAction +data class RequestReorderPlayers(val orderedPlayers: List<String>) : RAction -data class RequestUpdateSettings(val settings: CustomizableSettings): RAction +data class RequestUpdateSettings(val settings: CustomizableSettings) : RAction -class RequestStartGame: RAction +class RequestStartGame : RAction -class RequestSayReady: RAction +class RequestSayReady : RAction -data class RequestPrepareMove(val move: PlayerMove): RAction +data class RequestPrepareMove(val move: PlayerMove) : RAction -class RequestUnprepareMove: RAction +class RequestUnprepareMove : RAction diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/GameSagas.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/GameSagas.kt index a9c2ca2c..38bb7cb7 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/GameSagas.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/GameSagas.kt @@ -33,4 +33,3 @@ suspend fun SwSagaContext.gameSaga(session: SevenWondersSession) { } console.log("End of game saga") } - diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt index c4a92581..ed616636 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/redux/sagas/Sagas.kt @@ -29,12 +29,12 @@ suspend fun SwSagaContext.rootSaga() = coroutineScope { dispatch(SetCurrentPlayerAction(player)) routerSaga(Route.GAME_BROWSER) { - when (it) { - Route.HOME -> homeSaga(session) - Route.LOBBY -> lobbySaga(session) - Route.GAME_BROWSER -> gameBrowserSaga(session) - Route.GAME -> gameSaga(session) - } + when (it) { + Route.HOME -> homeSaga(session) + Route.LOBBY -> lobbySaga(session) + Route.GAME_BROWSER -> gameBrowserSaga(session) + Route.GAME -> gameSaga(session) + } } } diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/router/Router.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/router/Router.kt index 19e8bd94..82218ee1 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/router/Router.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/router/Router.kt @@ -14,7 +14,7 @@ enum class Route(val path: String) { GAME("/game"), } -data class Navigate(val route: Route): RAction +data class Navigate(val route: Route) : RAction suspend fun SwSagaContext.routerSaga( startRoute: Route, diff --git a/sw-ui/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt b/sw-ui/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt index 8182401f..fd23039c 100644 --- a/sw-ui/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt +++ b/sw-ui/src/test/kotlin/org/luxons/sevenwonders/ui/redux/sagas/SagasFrameworkTest.kt @@ -16,9 +16,9 @@ import kotlin.test.assertEquals private data class State(val data: String) -private data class UpdateData(val newData: String): RAction -private class DuplicateData: RAction -private class SideEffectAction(val data: String): RAction +private data class UpdateData(val newData: String) : RAction +private class DuplicateData : RAction +private class SideEffectAction(val data: String) : RAction private fun reduce(state: State, action: RAction): State = when (action) { is UpdateData -> State(action.newData) |