From a782959d337a19c7513627eab33a36034b71cbc0 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Sun, 4 Apr 2021 02:53:54 +0200 Subject: Extract blueprintjs to an independent library --- .../ui/components/errors/ErrorDialog.kt | 13 +++++++------ .../ui/components/game/BoardSummary.kt | 6 +++--- .../sevenwonders/ui/components/game/GameScene.kt | 12 +++++++----- .../luxons/sevenwonders/ui/components/game/Hand.kt | 9 ++++++--- .../ui/components/game/HandRotationIndicator.kt | 2 +- .../ui/components/game/PreparedMove.kt | 7 ++++--- .../sevenwonders/ui/components/game/ScoreTable.kt | 2 +- .../ui/components/game/TransactionsSelector.kt | 2 +- .../ui/components/gameBrowser/CreateGameForm.kt | 9 +++++---- .../ui/components/gameBrowser/GameBrowser.kt | 4 ++-- .../ui/components/gameBrowser/GameList.kt | 5 +++-- .../ui/components/gameBrowser/PlayerInfo.kt | 2 +- .../ui/components/home/ChooseNameForm.kt | 11 ++++++----- .../sevenwonders/ui/components/lobby/Lobby.kt | 22 ++++++++++++---------- .../ui/components/lobby/RadialPlayerList.kt | 4 ++-- 15 files changed, 61 insertions(+), 49 deletions(-) (limited to 'sw-ui/src/main/kotlin/org') diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/errors/ErrorDialog.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/errors/ErrorDialog.kt index cb35ef54..e74b2e75 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/errors/ErrorDialog.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/errors/ErrorDialog.kt @@ -1,9 +1,10 @@ package org.luxons.sevenwonders.ui.components.errors -import com.palantir.blueprintjs.Classes -import com.palantir.blueprintjs.Intent -import com.palantir.blueprintjs.bpButton -import com.palantir.blueprintjs.bpDialog +import blueprintjs.core.Classes +import blueprintjs.core.Intent +import blueprintjs.core.bpButton +import blueprintjs.core.bpDialog +import blueprintjs.icons.IconNames import kotlinx.browser.window import org.luxons.sevenwonders.ui.redux.* import org.luxons.sevenwonders.ui.router.Navigate @@ -32,7 +33,7 @@ class ErrorDialogPresenter(props: ErrorDialogProps) : RComponent(props) { title = "DISCARD (+3 coins)", // TODO remove hardcoded value large = true, intent = Intent.DANGER, - icon = "cross", + icon = IconNames.CROSS, onClick = { props.prepareMove(PlayerMove(MoveType.DISCARD, card.name)) }, ) } @@ -192,7 +195,7 @@ private fun pricePrefix(amount: Int) = when { else -> "" } -private fun RElementBuilder.priceInfo(amount: Int) { +private fun RElementBuilder>.priceInfo(amount: Int) { val size = 1.rem goldIndicator( amount = amount, diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/HandRotationIndicator.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/HandRotationIndicator.kt index 9c46d2de..cba458ef 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/HandRotationIndicator.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/HandRotationIndicator.kt @@ -1,6 +1,6 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.bpIcon +import blueprintjs.core.bpIcon import kotlinx.css.* import kotlinx.html.title import org.luxons.sevenwonders.model.cards.HandRotationDirection diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt index 1acaacdf..a56bbc00 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/PreparedMove.kt @@ -1,7 +1,8 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.Intent -import com.palantir.blueprintjs.bpButton +import blueprintjs.core.Intent +import blueprintjs.core.bpButton +import blueprintjs.icons.IconNames import kotlinx.css.* import kotlinx.css.properties.* import kotlinx.html.DIV @@ -41,7 +42,7 @@ fun RBuilder.preparedMove( right = 0.px } bpButton( - icon = "cross", + icon = IconNames.CROSS, title = "Cancel prepared move", small = true, intent = Intent.DANGER, diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ScoreTable.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ScoreTable.kt index 1aa52256..a92857ae 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ScoreTable.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/ScoreTable.kt @@ -1,6 +1,6 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.* +import blueprintjs.core.* import kotlinx.css.* import kotlinx.html.TD import kotlinx.html.TH diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/TransactionsSelector.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/TransactionsSelector.kt index 24b94748..bf850d4c 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/TransactionsSelector.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/TransactionsSelector.kt @@ -1,6 +1,6 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.* +import blueprintjs.core.* import kotlinx.css.* import kotlinx.html.DIV import kotlinx.html.TBODY 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 10adb648..1ad217e6 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 @@ -1,8 +1,9 @@ package org.luxons.sevenwonders.ui.components.gameBrowser -import com.palantir.blueprintjs.Intent -import com.palantir.blueprintjs.bpButton -import com.palantir.blueprintjs.bpInputGroup +import blueprintjs.core.Intent +import blueprintjs.core.bpButton +import blueprintjs.core.bpInputGroup +import blueprintjs.icons.IconNames import kotlinx.css.* import kotlinx.html.js.onSubmitFunction import org.luxons.sevenwonders.ui.redux.RequestCreateGame @@ -57,7 +58,7 @@ private class CreateGameForm(props: CreateGameFormProps) : RComponent createGame(e) }) + bpButton(minimal = true, intent = Intent.PRIMARY, icon = IconNames.ADD, onClick = { e -> createGame(e) }) } private fun createGame(e: Event) { diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameBrowser.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameBrowser.kt index 1a38853e..ff596e53 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameBrowser.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/GameBrowser.kt @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.ui.components.gameBrowser -import com.palantir.blueprintjs.Classes -import com.palantir.blueprintjs.bpCard +import blueprintjs.core.Classes +import blueprintjs.core.bpCard import kotlinx.css.* import kotlinx.html.classes import org.luxons.sevenwonders.ui.components.GlobalStyles 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 dd93fcc9..0155835a 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 @@ -1,6 +1,7 @@ package org.luxons.sevenwonders.ui.components.gameBrowser -import com.palantir.blueprintjs.* +import blueprintjs.core.* +import blueprintjs.icons.IconNames import kotlinx.css.* import kotlinx.html.classes import kotlinx.html.title @@ -36,7 +37,7 @@ class GameListPresenter(props: GameListProps) : RComponent chooseUsername(e) }, ) @@ -61,7 +62,7 @@ private class ChooseNameForm(props: ChooseNameFormProps) : RComponent(props) val currentGame = props.currentGame val currentPlayer = props.currentPlayer if (currentGame == null || currentPlayer == null) { - bpNonIdealState(icon = "error", title = "Error: no current game") + bpNonIdealState(icon = IconNames.ERROR, title = "Error: no current game") return } styledDiv { @@ -108,7 +110,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent(props) bpButton( large = true, intent = Intent.PRIMARY, - icon = "play", + icon = IconNames.PLAY, title = startability.tooltip, disabled = !startability.canDo, onClick = { props.startGame() }, @@ -146,8 +148,8 @@ class LobbyPresenter(props: LobbyProps) : RComponent(props) private fun RBuilder.addBotButton(currentGame: LobbyDTO) { bpButton( large = true, - icon = "plus", - rightIcon = "desktop", + icon = IconNames.PLUS, + rightIcon = IconNames.DESKTOP, intent = Intent.PRIMARY, title = if (currentGame.maxPlayersReached) "Max players reached" else "Add a bot to this game", disabled = currentGame.maxPlayersReached, @@ -164,8 +166,8 @@ class LobbyPresenter(props: LobbyProps) : RComponent(props) private fun RBuilder.reorderPlayersButton(currentGame: LobbyDTO) { bpButton( - icon = "random", - rightIcon = "people", + icon = IconNames.RANDOM, + rightIcon = IconNames.PEOPLE, title = "Re-order players randomly", onClick = { reorderPlayers(currentGame) }, ) { @@ -179,7 +181,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent(props) private fun RBuilder.randomizeWondersButton(currentGame: LobbyDTO) { bpButton( - icon = "random", + icon = IconNames.RANDOM, title = "Re-assign wonders to players randomly", onClick = { randomizeWonders(currentGame) }, ) { @@ -193,7 +195,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent(props) } bpButtonGroup { bpButton( - icon = "random", + icon = IconNames.RANDOM, title = "Re-roll wonder sides randomly", onClick = { randomizeWonderSides(currentGame) }, ) @@ -240,7 +242,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent(props) bpButton( large = true, intent = Intent.DANGER, - icon = "delete", + icon = IconNames.DELETE, title = "Disband the group and go back to the game browser", onClick = { props.disbandLobby() }, ) { 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 fc238956..dc40bf5d 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 @@ -1,7 +1,7 @@ package org.luxons.sevenwonders.ui.components.lobby -import com.palantir.blueprintjs.bpIcon -import com.palantir.blueprintjs.bpTag +import blueprintjs.core.bpIcon +import blueprintjs.core.bpTag import kotlinx.css.* import kotlinx.html.DIV import org.luxons.sevenwonders.model.api.PlayerDTO -- cgit