Overhaul workspace UX for denser play workflow

This commit is contained in:
2026-02-26 11:53:36 +01:00
parent e7114d8798
commit c3aa0d4e88
10 changed files with 355 additions and 160 deletions

View File

@@ -1,5 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using RpgRoller.Contracts;
namespace RpgRoller.Components.Pages.HomeControls;
@@ -7,6 +8,37 @@ namespace RpgRoller.Components.Pages.HomeControls;
[ExcludeFromCodeCoverage]
public partial class CampaignLogPanel
{
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (IsCampaignDataLoading || CampaignLog.Count == 0)
{
LastRenderedLogCount = CampaignLog.Count;
return;
}
if (firstRender || CampaignLog.Count > LastRenderedLogCount)
{
try
{
await JS.InvokeVoidAsync("rpgRollerApi.scrollElementToBottom", LogPanelRef);
}
catch (JSDisconnectedException)
{
}
catch (InvalidOperationException ex) when (ex.Message.Contains("statically rendered", StringComparison.OrdinalIgnoreCase))
{
}
}
LastRenderedLogCount = CampaignLog.Count;
}
[Inject]
private IJSRuntime JS { get; set; } = null!;
private ElementReference LogPanelRef { get; set; }
private int LastRenderedLogCount { get; set; }
[Parameter]
public bool IsCampaignDataLoading { get; set; }
@@ -30,4 +62,4 @@ public partial class CampaignLogPanel
[Parameter]
public Func<CampaignLogEntry, string> VisibilityBadgeCssClass { get; set; } = _ => string.Empty;
}
}