diff --git a/KoogleApp/Components/Controls/ChangePlayerSelect.razor b/KoogleApp/Components/Controls/ChangePlayerSelect.razor index 4b91b05..234ffe9 100644 --- a/KoogleApp/Components/Controls/ChangePlayerSelect.razor +++ b/KoogleApp/Components/Controls/ChangePlayerSelect.razor @@ -30,7 +30,7 @@ { get { - if (ParticipantsState.Value.PlayerIds.Length > 0) + if (ParticipantsState.Value != null && ParticipantsState.Value.PlayerIds.Length > 0) { return PlayersState.Value.Players.FirstOrDefault(_ => _.Id == ParticipantsState.Value.PlayerIds.First()); } @@ -50,7 +50,7 @@ // set; // } = null!; - [Parameter,EditorRequired] + [Parameter] public Func ValueSelector { get; diff --git a/KoogleApp/Components/Controls/NumberPanel.razor b/KoogleApp/Components/Controls/NumberPanel.razor index ab4833f..0d504c7 100644 --- a/KoogleApp/Components/Controls/NumberPanel.razor +++ b/KoogleApp/Components/Controls/NumberPanel.razor @@ -125,15 +125,18 @@ - - - @if (CanSelectPlayer) + + @if (ParticipantsState.Value != null) { + + @if (CanSelectPlayer) + { - } - else - { -

@($"P: {@ParticipantsState.Value.PlayerIds.FirstOrDefault()}")

+ } + else + { +

@($"P: {@ParticipantsState.Value.PlayerIds.FirstOrDefault()}")

+ } }
diff --git a/KoogleApp/Services/GameStatusDataService.cs b/KoogleApp/Services/GameStatusDataService.cs index 1233b32..82f985a 100644 --- a/KoogleApp/Services/GameStatusDataService.cs +++ b/KoogleApp/Services/GameStatusDataService.cs @@ -205,7 +205,7 @@ namespace KoogleApp.Services { return false; } - return _undoStack.Count > 0; + return _undoStack.Count > 1; } } diff --git a/KoogleApp/Store/Game/Participants/Reducers.cs b/KoogleApp/Store/Game/Participants/Reducers.cs index 5bb0c73..777dc88 100644 --- a/KoogleApp/Store/Game/Participants/Reducers.cs +++ b/KoogleApp/Store/Game/Participants/Reducers.cs @@ -35,5 +35,11 @@ namespace KoogleApp.Store.Game.Participants PlayerIds = lst.ToArray() }; } + + [ReducerMethod] + public static ParticipantsState OnUpdateStateAfterUndoRedo(ParticipantsState state, UpdateStateAfterUndoRedo action) + { + return action.ParticipantsState; + } } } \ No newline at end of file diff --git a/KoogleApp/Store/Game/ThrowPanel/Actions.cs b/KoogleApp/Store/Game/ThrowPanel/Actions.cs index 0b8e6ab..9b926ad 100644 --- a/KoogleApp/Store/Game/ThrowPanel/Actions.cs +++ b/KoogleApp/Store/Game/ThrowPanel/Actions.cs @@ -35,7 +35,7 @@ namespace KoogleApp.Store.Game.ThrowPanel public record ThrowUpdateAction(bool LeftSink, bool RightSink); - public record AfterUndoRedoAction(ThrowPanelState State); + public record UpdateStateAfterUndoRedo(ThrowPanelState ThrowPanelState, ParticipantsState ParticipantsState); public record EnsureBeforeThrowStatusAction(ParticipantsState ParticipantsState); diff --git a/KoogleApp/Store/Game/ThrowPanel/Reducers.cs b/KoogleApp/Store/Game/ThrowPanel/Reducers.cs index a62465d..a592e54 100644 --- a/KoogleApp/Store/Game/ThrowPanel/Reducers.cs +++ b/KoogleApp/Store/Game/ThrowPanel/Reducers.cs @@ -288,9 +288,9 @@ namespace KoogleApp.Store.Game.ThrowPanel } [ReducerMethod] - public static ThrowPanelState OnAfterUndoRedo(ThrowPanelState state, AfterUndoRedoAction action) + public static ThrowPanelState OnUpdateStateAfterUndoRedo(ThrowPanelState state, UpdateStateAfterUndoRedo action) { - return action.State; + return action.ThrowPanelState; } } } diff --git a/KoogleApp/Store/Game/UndoRedo/Effects.cs b/KoogleApp/Store/Game/UndoRedo/Effects.cs index cd10047..37a7617 100644 --- a/KoogleApp/Store/Game/UndoRedo/Effects.cs +++ b/KoogleApp/Store/Game/UndoRedo/Effects.cs @@ -33,7 +33,7 @@ namespace KoogleApp.Store.Game.UndoRedo if (success) { var currentData = _dataService.GetCurrentData(); - dispatcher.Dispatch(new AfterUndoRedoAction(currentData.Status.ThrowPanelState)); + dispatcher.Dispatch(new UpdateStateAfterUndoRedo(currentData.Status.ThrowPanelState, currentData.Status.ParticipantsState)); } dispatcher.Dispatch(new UpdateUndoRedoStateAction()); @@ -48,7 +48,7 @@ namespace KoogleApp.Store.Game.UndoRedo if (success) { var currentData = _dataService.GetCurrentData(); - dispatcher.Dispatch(new AfterUndoRedoAction(currentData.Status.ThrowPanelState)); + dispatcher.Dispatch(new UpdateStateAfterUndoRedo(currentData.Status.ThrowPanelState, currentData.Status.ParticipantsState)); } dispatcher.Dispatch(new UpdateUndoRedoStateAction()); diff --git a/KoogleApp/appdata.json b/KoogleApp/appdata.json index dab57a1..083c353 100644 --- a/KoogleApp/appdata.json +++ b/KoogleApp/appdata.json @@ -22,15 +22,15 @@ }, "ParticipantsState": { "PlayerIds": [ - 9, 5, - 3 + 3, + 9 ], "Eliminated": [] } }, "Version": 4, - "LastModified": "2025-11-21T13:31:18.7132247+01:00", + "LastModified": "2025-11-21T14:49:53.2943989+01:00", "LastModifiedBy": "test1@test.de" }, "UndoHistory": [ @@ -42,11 +42,11 @@ "Pin1State": 0, "Pin2State": 0, "Pin3State": 0, - "Pin4State": 0, - "Pin5State": 0, - "Pin6State": 0, - "Pin7State": 0, - "Pin8State": 0, + "Pin4State": 1, + "Pin5State": 1, + "Pin6State": 1, + "Pin7State": 1, + "Pin8State": 1, "Pin9State": 1, "ThrowsPerRound": 3, "ThrowCounterPerRound": 1, @@ -57,15 +57,15 @@ }, "ParticipantsState": { "PlayerIds": [ - 9, 5, - 3 + 3, + 9 ], "Eliminated": [] } }, "Version": 3, - "LastModified": "2025-11-21T13:31:18.7088636+01:00", + "LastModified": "2025-11-21T14:49:53.289455+01:00", "LastModifiedBy": "test1@test.de" }, { @@ -99,7 +99,7 @@ } }, "Version": 2, - "LastModified": "2025-11-21T13:31:10.7173634+01:00", + "LastModified": "2025-11-21T14:49:31.5450392+01:00", "LastModifiedBy": "test1@test.de" }, { @@ -126,7 +126,7 @@ "ParticipantsState": null }, "Version": 1, - "LastModified": "2025-11-21T13:31:10.7160527+01:00", + "LastModified": "2025-11-21T14:49:31.5423511+01:00", "LastModifiedBy": "test1@test.de" } ],