Remove technical noise from lookup UX

This commit is contained in:
2026-03-15 01:20:48 +01:00
parent e5e34296a4
commit ef15bce7c4
6 changed files with 33 additions and 136 deletions

View File

@@ -1,93 +1,21 @@
@using System.Text.Json
<div class="result-card">
<h3>@Result.CriticalTableName</h3>
<div class="result-stats">
<span class="stat-pill">Table: <code>@Result.CriticalType</code></span>
<span class="stat-pill">Column: @Result.ColumnLabel</span>
<span class="stat-pill">Role: @Result.ColumnRole</span>
<span class="stat-pill">Band: @Result.RollBand</span>
<span class="stat-pill">Severity: @Result.ColumnLabel</span>
<span class="stat-pill">Roll: @Result.Roll</span>
<span class="stat-pill">Status: @Result.ParseStatus</span>
</div>
<div class="detail-grid">
<div class="detail-item">
<span class="detail-label">Family</span>
<span>@Result.CriticalFamily</span>
</div>
<div class="detail-item">
<span class="detail-label">Source</span>
<span>@Result.SourceDocument</span>
</div>
<div class="detail-item">
<span class="detail-label">Column Key</span>
<span><code>@Result.Column</code></span>
</div>
<div class="detail-item">
<span class="detail-label">Roll Range</span>
<span>@FormatRollRange(Result.RollBandMinRoll, Result.RollBandMaxRoll)</span>
</div>
@if (!string.IsNullOrWhiteSpace(Result.Group))
{
<div class="detail-item">
<span class="detail-label">Group</span>
<span>@(string.IsNullOrWhiteSpace(Result.GroupLabel) ? Result.Group : $"{Result.GroupLabel} ({Result.Group})")</span>
</div>
<span class="stat-pill">Variant: @(string.IsNullOrWhiteSpace(Result.GroupLabel) ? Result.Group : Result.GroupLabel)</span>
}
</div>
@if (!string.IsNullOrWhiteSpace(Result.TableNotes))
{
<p class="muted">@Result.TableNotes</p>
}
<div class="callout">
<h4>Cell details</h4>
<CompactCriticalCell
Description="@Result.Description"
Effects="@Result.Effects"
Branches="@Result.Branches" />
</div>
<details class="details-block">
<summary>Raw Imported Cell</summary>
<pre class="code-block">@Result.RawCellText</pre>
</details>
<details class="details-block">
<summary>Parsed JSON</summary>
<pre class="code-block">@FormatJson(Result.ParsedJson)</pre>
</details>
<CompactCriticalCell
Description="@Result.Description"
Effects="@Result.Effects"
Branches="@Result.Branches" />
</div>
@code {
[Parameter, EditorRequired]
public CriticalLookupResponse Result { get; set; } = null!;
private static string FormatRollRange(int minRoll, int? maxRoll) =>
maxRoll is null
? $"{minRoll}+"
: minRoll == maxRoll
? minRoll.ToString()
: $"{minRoll}-{maxRoll}";
private static string FormatJson(string value)
{
if (string.IsNullOrWhiteSpace(value))
{
return "{}";
}
try
{
using var document = JsonDocument.Parse(value);
return JsonSerializer.Serialize(document.RootElement, new JsonSerializerOptions { WriteIndented = true });
}
catch (JsonException)
{
return value;
}
}
}