Align Play with table deep links

This commit is contained in:
2026-04-12 20:05:20 +02:00
parent 0c3e10a5ca
commit 1a058143bb
10 changed files with 538 additions and 258 deletions

View File

@@ -149,7 +149,7 @@
await PersistAndSyncTableContextAsync();
}
private async Task LoadTableDetailAsync()
private async Task LoadTableDetailAsync(TableContextSnapshot? routeContext = null)
{
if (string.IsNullOrWhiteSpace(selectedTableSlug))
{
@@ -172,6 +172,7 @@
}
await RecordRecentTableVisitAsync();
ApplyRouteContext(routeContext);
NormalizeViewStateForCurrentDetail();
}
catch (Exception exception)
@@ -203,12 +204,14 @@
if (string.IsNullOrWhiteSpace(selectedTableSlug) || !string.Equals(resolvedTableSlug, selectedTableSlug, StringComparison.OrdinalIgnoreCase))
{
selectedTableSlug = resolvedTableSlug;
await LoadTableDetailAsync();
await LoadTableDetailAsync(initialContext);
await PersistAndSyncTableContextAsync();
await InvokeAsync(StateHasChanged);
return;
}
ApplyRouteContext(initialContext);
NormalizeViewStateForCurrentDetail();
await PersistAndSyncTableContextAsync();
}
}
@@ -373,7 +376,7 @@
}
private RolemasterDb.App.Frontend.AppState.TableContextSnapshot BuildCurrentTableContext() =>
new(TableSlug: selectedTableSlug, Mode: RolemasterDb.App.Frontend.AppState.TableContextMode.Reference);
new(TableSlug: selectedTableSlug, GroupKey: selectedCell?.GroupKey, ColumnKey: selectedCell?.ColumnKey, RollBand: selectedCell?.RollBand, ResultId: selectedCell?.ResultId, Mode: RolemasterDb.App.Frontend.AppState.TableContextMode.Reference);
private void SelectCell(TablesCellSelection selection)
{
@@ -408,6 +411,18 @@
return Task.CompletedTask;
}
private void ApplyRouteContext(TableContextSnapshot? routeContext)
{
if (tableDetail is null)
{
selectedCell = null;
return;
}
var resolvedCell = TableContextCellResolver.FindCell(tableDetail, routeContext);
selectedCell = resolvedCell is null ? null : new TablesCellSelection(resolvedCell.ResultId, resolvedCell.RollBand, resolvedCell.ColumnKey, resolvedCell.GroupKey);
}
private void NormalizeViewStateForCurrentDetail()
{
referenceMode = NormalizeMode(referenceMode);