diff options
author | Joffrey Bion <joffrey.bion@gmail.com> | 2021-04-04 02:53:54 +0200 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@gmail.com> | 2021-04-04 02:53:54 +0200 |
commit | a782959d337a19c7513627eab33a36034b71cbc0 (patch) | |
tree | 06e9ac335d094eedb98992f790863855c9f0cab0 /sw-ui/src/main/kotlin/org | |
parent | Upgrade JS wrapper libraries & repositories (diff) | |
download | seven-wonders-a782959d337a19c7513627eab33a36034b71cbc0.tar.gz seven-wonders-a782959d337a19c7513627eab33a36034b71cbc0.tar.bz2 seven-wonders-a782959d337a19c7513627eab33a36034b71cbc0.zip |
Extract blueprintjs to an independent library
Diffstat (limited to 'sw-ui/src/main/kotlin/org')
15 files changed, 61 insertions, 49 deletions
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<ErrorDialogProp bpDialog( isOpen = errorMessage != null, title = "Oops!", - icon = "error", + icon = IconNames.ERROR, iconIntent = Intent.DANGER, onClose = { goHomeAndRefresh() } ) { @@ -48,7 +49,7 @@ class ErrorDialogPresenter(props: ErrorDialogProps) : RComponent<ErrorDialogProp css { classes.add(Classes.DIALOG_FOOTER) } - bpButton(icon = "log-out", onClick = { goHomeAndRefresh() }) { + bpButton(icon = IconNames.LOG_OUT, onClick = { goHomeAndRefresh() }) { +"HOME" } } diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/BoardSummary.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/BoardSummary.kt index 9573c12a..57614922 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/BoardSummary.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/game/BoardSummary.kt @@ -1,8 +1,8 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.PopoverPosition -import com.palantir.blueprintjs.bpDivider -import com.palantir.blueprintjs.bpPopover +import blueprintjs.core.PopoverPosition +import blueprintjs.core.bpDivider +import blueprintjs.core.bpPopover import kotlinx.css.* import kotlinx.html.DIV import org.luxons.sevenwonders.model.api.PlayerDTO 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 976bb2a6..06021cea 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 @@ -1,7 +1,9 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.* +import blueprintjs.core.* +import blueprintjs.icons.IconNames import kotlinx.css.* +import kotlinx.css.Position import kotlinx.css.properties.transform import kotlinx.css.properties.translate import org.luxons.sevenwonders.client.GameState @@ -64,7 +66,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, Game } val game = props.game if (game == null) { - bpNonIdealState(icon = "error", title = "Error: no game data") + bpNonIdealState(icon = IconNames.ERROR, title = "Error: no game data") } else { boardScene(game) } @@ -156,7 +158,7 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, Game attrs { this.className = GlobalStyles.getClassName { it::noPadding } } - bpCallout(intent = Intent.PRIMARY, icon = "info-sign") { +message } + bpCallout(intent = Intent.PRIMARY, icon = IconNames.INFO_SIGN) { +message } } } } @@ -272,13 +274,13 @@ private class GameScene(props: GameSceneProps) : RComponent<GameSceneProps, Game large = true, disabled = isReady, intent = intent, - icon = if (isReady) "tick-circle" else "play", + icon = if (isReady) IconNames.TICK_CIRCLE else IconNames.PLAY, onClick = { props.sayReady() }, ) { +"READY" } // not really a button, but nice for style - bpButton(large = true, icon = "people", disabled = isReady, intent = intent) { + bpButton(large = true, icon = IconNames.PEOPLE, disabled = isReady, intent = intent) { +"${props.players.count { it.isReady }}/${props.players.size}" } } 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 1e60dcd4..eae2bd3c 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 @@ -1,7 +1,9 @@ package org.luxons.sevenwonders.ui.components.game -import com.palantir.blueprintjs.* +import blueprintjs.core.* +import blueprintjs.icons.IconNames import kotlinx.css.* +import kotlinx.css.Position import kotlinx.css.properties.* import kotlinx.html.DIV import org.luxons.sevenwonders.client.GameState @@ -12,6 +14,7 @@ import org.luxons.sevenwonders.model.cards.CardPlayability import org.luxons.sevenwonders.model.cards.HandCard import org.luxons.sevenwonders.model.resources.ResourceTransactionOptions import org.luxons.sevenwonders.model.wonders.WonderBuildability +import org.w3c.dom.HTMLButtonElement import react.* import styled.StyledDOMBuilder import styled.css @@ -165,7 +168,7 @@ class HandComponent(props: HandProps) : RComponent<HandProps, RState>(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<IButtonProps>.priceInfo(amount: Int) { +private fun RElementBuilder<IButtonProps<HTMLButtonElement>>.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 } private fun createGameButton() = buildElement { - bpButton(minimal = true, intent = Intent.PRIMARY, icon = "add", onClick = { e -> 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<GameListProps, RState private fun RBuilder.noGamesInfo() { bpNonIdealState( - icon = "geosearch", + icon = IconNames.GEOSEARCH, title = "No games to join", ) { styledDiv { diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt index cb9d1ba3..f5cc2992 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/gameBrowser/PlayerInfo.kt @@ -1,6 +1,6 @@ package org.luxons.sevenwonders.ui.components.gameBrowser -import com.palantir.blueprintjs.bpIcon +import blueprintjs.core.bpIcon import kotlinx.css.* import kotlinx.html.title import org.luxons.sevenwonders.model.api.BasicPlayerInfo 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 800c71f0..c5764eb0 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 @@ -1,8 +1,9 @@ package org.luxons.sevenwonders.ui.components.home -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.RequestChooseName @@ -51,7 +52,7 @@ private class ChooseNameForm(props: ChooseNameFormProps) : RComponent<ChooseName private fun submitButton(): ReactElement = buildElement { bpButton( minimal = true, - icon = "arrow-right", + icon = IconNames.ARROW_RIGHT, intent = Intent.PRIMARY, onClick = { e -> chooseUsername(e) }, ) @@ -61,7 +62,7 @@ private class ChooseNameForm(props: ChooseNameFormProps) : RComponent<ChooseName bpButton( title = "Generate random name", large = true, - icon = "random", + icon = IconNames.RANDOM, intent = Intent.PRIMARY, onClick = { fillRandomUsername() }, ) diff --git a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt index 12ac9dcb..5b93cdc1 100644 --- a/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt +++ b/sw-ui/src/main/kotlin/org/luxons/sevenwonders/ui/components/lobby/Lobby.kt @@ -1,7 +1,9 @@ package org.luxons.sevenwonders.ui.components.lobby -import com.palantir.blueprintjs.* +import blueprintjs.core.* +import blueprintjs.icons.IconNames import kotlinx.css.* +import kotlinx.css.Position import kotlinx.css.properties.transform import kotlinx.css.properties.translate import org.luxons.sevenwonders.model.api.LobbyDTO @@ -42,7 +44,7 @@ class LobbyPresenter(props: LobbyProps) : RComponent<LobbyProps, RState>(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<LobbyProps, RState>(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<LobbyProps, RState>(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<LobbyProps, RState>(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<LobbyProps, RState>(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<LobbyProps, RState>(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<LobbyProps, RState>(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 |