summaryrefslogtreecommitdiff
path: root/sw-ui
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-06-02 00:29:34 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-06-02 00:29:34 +0200
commit16e0dc519037de87f7cb09f7e944d8175c9c76df (patch)
tree423757ba874a211274628f11eedf7fe61cee6503 /sw-ui
parentSimplify board summary using BP's divider (diff)
downloadseven-wonders-16e0dc519037de87f7cb09f7e944d8175c9c76df.tar.gz
seven-wonders-16e0dc519037de87f7cb09f7e944d8175c9c76df.tar.bz2
seven-wonders-16e0dc519037de87f7cb09f7e944d8175c9c76df.zip
Extract board summaries function
Diffstat (limited to 'sw-ui')
-rw-r--r--sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/GameScene.kt18
1 files changed, 12 insertions, 6 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 2bf98009..afc3b157 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
@@ -3,6 +3,7 @@ package org.luxons.sevenwonders.ui.components.game
import com.palantir.blueprintjs.*
import kotlinx.css.*
import kotlinx.css.properties.*
+import kotlinx.html.DIV
import org.luxons.sevenwonders.model.*
import org.luxons.sevenwonders.model.api.PlayerDTO
import org.luxons.sevenwonders.model.boards.Board
@@ -11,7 +12,7 @@ import org.luxons.sevenwonders.model.cards.HandCard
import org.luxons.sevenwonders.ui.components.GlobalStyles
import org.luxons.sevenwonders.ui.redux.*
import react.*
-import react.dom.*
+import styled.StyledDOMBuilder
import styled.css
import styled.getClassName
import styled.styledDiv
@@ -71,11 +72,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta
height = 100.pct
}
}
- leftPlayerBoardSummary(leftBoard)
- rightPlayerBoardSummary(rightBoard)
- if (topBoards.isNotEmpty()) {
- topPlayerBoardsSummaries(topBoards)
- }
+ boardSummaries(leftBoard, rightBoard, topBoards)
handRotationIndicator(turnInfo.table.handRotationDirection)
handCards(turnInfo, props.preparedMove, props.prepareMove)
val card = props.preparedCard
@@ -109,6 +106,15 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, RSta
}
}
+ private fun StyledDOMBuilder<DIV>.boardSummaries(leftBoard: Board, rightBoard: Board, topBoards: List<Board>) {
+ // TODO use blueprint popover with full board preview
+ leftPlayerBoardSummary(leftBoard)
+ rightPlayerBoardSummary(rightBoard)
+ if (topBoards.isNotEmpty()) {
+ topPlayerBoardsSummaries(topBoards)
+ }
+ }
+
private fun RBuilder.leftPlayerBoardSummary(board: Board) {
boardSummary(props.players[board.playerIndex], board, BoardSummarySide.LEFT) {
css {
bgstack15