diff --git a/RpgRoller/Components/Pages/HomeControls/CampaignLogPanel.razor.cs b/RpgRoller/Components/Pages/HomeControls/CampaignLogPanel.razor.cs index 768fa1b..cb1deae 100644 --- a/RpgRoller/Components/Pages/HomeControls/CampaignLogPanel.razor.cs +++ b/RpgRoller/Components/Pages/HomeControls/CampaignLogPanel.razor.cs @@ -198,8 +198,8 @@ public partial class CampaignLogPanel private string CustomRollStatusText => SelectedCharacterId.HasValue && !string.IsNullOrWhiteSpace(SelectedCharacterName) - ? $"For {SelectedCharacterName} • {RollVisibilityLabel}" - : "Select a character to enable"; + ? $"For {SelectedCharacterName} • Uses {RollVisibilityLabel.ToLowerInvariant()} visibility" + : $"Select a character to enable • {RollVisibilityLabel} visibility selected"; private string CustomRollHelpText => SelectedCampaignRulesetId.ToLowerInvariant() switch { diff --git a/RpgRoller/Components/Pages/HomeControls/CharacterPanel.razor b/RpgRoller/Components/Pages/HomeControls/CharacterPanel.razor index d1e64d0..f688c36 100644 --- a/RpgRoller/Components/Pages/HomeControls/CharacterPanel.razor +++ b/RpgRoller/Components/Pages/HomeControls/CharacterPanel.razor @@ -59,7 +59,10 @@
- diff --git a/RpgRoller/Components/Pages/HomeControls/CharacterPanel.razor.cs b/RpgRoller/Components/Pages/HomeControls/CharacterPanel.razor.cs index 12b07c6..e6f782c 100644 --- a/RpgRoller/Components/Pages/HomeControls/CharacterPanel.razor.cs +++ b/RpgRoller/Components/Pages/HomeControls/CharacterPanel.razor.cs @@ -70,10 +70,9 @@ public partial class CharacterPanel await SkillUpdated.InvokeAsync(skillId); } - private async Task OnRollVisibilityChangedAsync(ChangeEventArgs args) + private async Task OnRollVisibilityChangedAsync(string? selectedVisibility) { - var selectedVisibility = args.Value?.ToString() ?? "public"; - await RollVisibilityChanged.InvokeAsync(selectedVisibility); + await RollVisibilityChanged.InvokeAsync(selectedVisibility ?? "public"); } private async Task RollSkillAsync(CharacterSheetSkill skill) @@ -372,6 +371,9 @@ public partial class CharacterPanel [Parameter] public EventCallback RollVisibilityChanged { get; set; } + private string NormalizedRollVisibility => + string.Equals(RollVisibility, "private", StringComparison.OrdinalIgnoreCase) ? "private" : "public"; + [Parameter] public Func OwnerLabel { get; set; } = _ => string.Empty; [Parameter] public Func SkillDefinitionLabel { get; set; } = _ => string.Empty; diff --git a/RpgRoller/Components/Pages/Workspace.razor.cs b/RpgRoller/Components/Pages/Workspace.razor.cs index 798d9a5..b8770b7 100644 --- a/RpgRoller/Components/Pages/Workspace.razor.cs +++ b/RpgRoller/Components/Pages/Workspace.razor.cs @@ -171,7 +171,7 @@ public partial class Workspace : IAsyncDisposable private WorkspaceSessionCoordinator Session => m_Session ??= new(State, Feedback, JS, ApiClient, WorkspaceQuery, () => IsAdminRoute, RedirectToPlayAsync, Scope.ReloadCampaignsAsync, Scope.ReloadCharacterCampaignOptionsAsync, Scope.RefreshCampaignScopeAsync, - Live.SyncStateEventsAsync, Live.StopStateEventsAsync, EnsureAdminUsersLoadedAsync, + RequestRefreshAsync, Live.SyncStateEventsAsync, Live.StopStateEventsAsync, EnsureAdminUsersLoadedAsync, Play.ResetCampaignLogDetailState, message => LoggedOut.InvokeAsync(message)); private IReadOnlyList HeaderMenuItems diff --git a/RpgRoller/Components/Pages/WorkspaceSessionCoordinator.cs b/RpgRoller/Components/Pages/WorkspaceSessionCoordinator.cs index 5a75bea..80273d1 100644 --- a/RpgRoller/Components/Pages/WorkspaceSessionCoordinator.cs +++ b/RpgRoller/Components/Pages/WorkspaceSessionCoordinator.cs @@ -14,6 +14,7 @@ public sealed class WorkspaceSessionCoordinator( Func reloadCampaignsAsync, Func reloadCharacterCampaignOptionsAsync, Func refreshCampaignScopeAsync, + Func requestRefreshAsync, Func syncStateEventsAsync, Func stopStateEventsAsync, Func ensureAdminUsersLoadedAsync, @@ -97,6 +98,7 @@ public sealed class WorkspaceSessionCoordinator( { state.RollVisibility = NormalizeRollVisibility(visibility); await js.InvokeVoidAsync("rpgRollerApi.setSessionValue", RollVisibilitySessionKey, state.RollVisibility); + await requestRefreshAsync(); } public void ClearAuthenticatedState() diff --git a/tests/e2e/smoke.js b/tests/e2e/smoke.js index c89ba28..83331bd 100644 --- a/tests/e2e/smoke.js +++ b/tests/e2e/smoke.js @@ -503,6 +503,8 @@ const tests = [ }), "Expected custom roll composer to be interactive." ); + assert.match(await elementText(driver, ".custom-roll-composer-head .muted"), /uses public visibility/i); + await fillInput(driver, "#custom-roll-expression", "bad"); await clickText(driver, ".custom-roll-composer button", "Roll"); @@ -525,7 +527,9 @@ const tests = [ () => driver.executeScript(() => { const className = document.querySelector("#custom-roll-expression")?.className || ""; const firstLogEntry = document.querySelector(".log-panel .log-entry"); - return !/error/.test(className) && Boolean(firstLogEntry?.textContent.includes("Custom roll")); + return !/error/.test(className) && + Boolean(firstLogEntry?.textContent.includes("Custom roll")) && + Boolean(firstLogEntry?.textContent.includes("Public")); }), "Expected successful custom roll entry." );