-
+
@if (referenceData is null)
{
@@ -99,95 +48,16 @@
}
else if (tableDetail is { } detail)
{
- var readingHint = detail.Groups.Count > 0
- ? "Find the roll band on the left, then read across to the group and severity you need."
- : "Find the roll band on the left, then read across to the severity you need.";
-
-
+
- @{
- var displayColumns = GetDisplayColumns(detail);
- var gridTemplateStyle = BuildGridTemplateStyle(detail);
- }
-
-
-
- @{
- var legendEntries = detail.Legend ?? Array.Empty
();
- }
-
- @if (legendEntries.Count > 0)
- {
-
-
-
- @foreach (var entry in legendEntries)
- {
-
-
@entry.Symbol
-
- @entry.Label
- @entry.Description
-
-
- }
-
-
- }
+
}
@@ -237,7 +107,6 @@
private bool isDetailLoading;
private bool isReferenceDataLoading = true;
private string? detailError;
- private Dictionary<(string RollBand, string? GroupKey, string ColumnKey), CriticalTableCellDetail>? cellIndex;
private bool IsTableSelectionDisabled => isReferenceDataLoading || (referenceData?.CriticalTables.Count ?? 0) == 0;
private bool isEditorOpen;
private bool isEditorLoading;
@@ -297,14 +166,12 @@
if (string.IsNullOrWhiteSpace(selectedTableSlug))
{
tableDetail = null;
- cellIndex = null;
return;
}
isDetailLoading = true;
detailError = null;
tableDetail = null;
- cellIndex = null;
try
{
@@ -324,7 +191,6 @@
finally
{
isDetailLoading = false;
- BuildCellIndex();
}
}
@@ -361,32 +227,6 @@
}
}
- private void BuildCellIndex()
- {
- if (tableDetail?.Cells is null)
- {
- cellIndex = null;
- return;
- }
-
- cellIndex = new Dictionary<(string, string?, string), CriticalTableCellDetail>();
- foreach (var cell in tableDetail.Cells)
- {
- cellIndex[(cell.RollBand, cell.GroupKey, cell.ColumnKey)] = cell;
- }
- }
-
- private bool TryGetCell(string rollBand, string? groupKey, string columnKey, [NotNullWhen(true)] out CriticalTableCellDetail? cell)
- {
- if (cellIndex is null)
- {
- cell = null;
- return false;
- }
-
- return cellIndex.TryGetValue((rollBand, groupKey, columnKey), out cell);
- }
-
private async Task OpenCellEditorAsync(int resultId)
{
if (string.IsNullOrWhiteSpace(selectedTableSlug))
@@ -744,36 +584,6 @@
}
}
- private static string GetCellCssClass(CriticalTableCellDetail cell) =>
- cell.IsCurated
- ? "critical-table-cell is-curated"
- : "critical-table-cell needs-curation";
-
- private static IReadOnlyList<(string? GroupKey, string ColumnKey, string ColumnLabel)> GetDisplayColumns(CriticalTableDetail detail)
- {
- if (detail.Groups.Count == 0)
- {
- return detail.Columns
- .Select(column => ((string?)null, column.Key, column.Label))
- .ToList();
- }
-
- return detail.Groups
- .SelectMany(group => detail.Columns.Select(column => ((string?)group.Key, column.Key, column.Label)))
- .ToList();
- }
-
- private static string BuildGridTemplateStyle(CriticalTableDetail detail)
- {
- var dataColumnCount = detail.Columns.Count * Math.Max(detail.Groups.Count, 1);
- return $"grid-template-columns: max-content repeat({dataColumnCount}, minmax(0, 1fr));";
- }
-
- private static string BuildColumnSpanStyle(int span) => $"grid-column: span {span};";
-
- private string GetSelectedTableLabel() =>
- SelectedTableReference?.Label ?? "Select a table";
-
private Task TogglePinnedTableAsync()
{
if (SelectedTableReference is not { } selectedTable)
@@ -820,55 +630,4 @@
new(
TableSlug: selectedTableSlug,
Mode: RolemasterDb.App.Frontend.AppState.TableContextMode.Reference);
-
- private string GetTableOptionCssClass(CriticalTableReference table)
- {
- var classes = new List