Skip to content

Commit 610d722

Browse files
committed
fix(view): don't disable entire socha menubar item before starting game
enableWhen applied to the whole "sochaIcon"-menu due to its scope
1 parent 556440e commit 610d722

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

backend

src/main/kotlin/sc/gui/view/AppView.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ class AppView : View("Software-Challenge Germany") {
2828
logger.debug("Quitting!")
2929
Platform.exit()
3030
}
31-
item("Neues Spiel", "Shortcut+N").action {
31+
item("Neues Spiel", "Shortcut+N") {
3232
enableWhen(controller.model.currentView.isNotEqualTo(ViewType.GAME_CREATION))
33-
logger.debug("New Game!")
34-
if (controller.model.currentView.get() == ViewType.GAME) {
35-
alert(
33+
action {
34+
logger.debug("New Game!")
35+
if (controller.model.currentView.get() == ViewType.GAME) {
36+
alert(
3637
type = Alert.AlertType.CONFIRMATION,
3738
header = "Neues Spiel anfangen",
3839
content = "Willst du wirklich dein aktuelles Spiel verwerfen und ein neues anfangen?",
@@ -42,9 +43,10 @@ class AppView : View("Software-Challenge Germany") {
4243
gameController.clearGame()
4344
}
4445
}
45-
)
46-
} else if (controller.model.currentView.get() != ViewType.GAME_CREATION) {
47-
controller.changeViewTo(ViewType.GAME_CREATION)
46+
)
47+
} else if (controller.model.currentView.get() != ViewType.GAME_CREATION) {
48+
controller.changeViewTo(ViewType.GAME_CREATION)
49+
}
4850
}
4951
}
5052
item("Toggle Darkmode").action {

0 commit comments

Comments
 (0)