Compact quick parse legend badges

This commit is contained in:
2026-03-15 13:12:13 +01:00
parent ea328e65bd
commit 1c03ca4586
2 changed files with 46 additions and 18 deletions

View File

@@ -88,7 +88,8 @@
{ {
<div class="critical-editor-quick-legend-item"> <div class="critical-editor-quick-legend-item">
<code>@entry.Token</code> <code>@entry.Token</code>
<span class="muted">@entry.Meaning</span> <span class="critical-editor-quick-legend-equals">=</span>
<AffixBadgeList Effects="@entry.Effects" />
</div> </div>
} }
</div> </div>
@@ -385,17 +386,17 @@
{ {
WriteIndented = true WriteIndented = true
}; };
private static readonly IReadOnlyList<(string Token, string Meaning)> QuickParseLegendEntries = private static readonly IReadOnlyList<(string Token, IReadOnlyList<CriticalEffectLookupResponse> Effects)> QuickParseLegendEntries =
[ [
("+15", "Direct hits"), ("+15", [CreateQuickLegendEffect(CriticalEffectCodes.DirectHits, valueInteger: 15)]),
("3s", "Stunned 3 rounds"), ("3s", [CreateQuickLegendEffect(CriticalEffectCodes.StunnedRounds, durationRounds: 3)]),
("1mp", "Must parry 1 round"), ("1mp", [CreateQuickLegendEffect(CriticalEffectCodes.MustParryRounds, durationRounds: 1)]),
("3np", "No parry 3 rounds"), ("3np", [CreateQuickLegendEffect(CriticalEffectCodes.NoParryRounds, durationRounds: 3)]),
("1hpr", "Bleed 1 hit per round"), ("1hpr", [CreateQuickLegendEffect(CriticalEffectCodes.BleedPerRound, perRound: 1)]),
("-20", "Foe penalty"), ("-20", [CreateQuickLegendEffect(CriticalEffectCodes.FoePenalty, modifier: -20)]),
("+20b", "Attacker bonus next round"), ("+20b", [CreateQuickLegendEffect(CriticalEffectCodes.AttackerBonusNextRound, modifier: 20)]),
("+2d10-3pp", "Power-point modifier"), ("+2d10-3pp", [CreateQuickLegendEffect(CriticalEffectCodes.PowerPointModifier, valueExpression: "2d10-3")]),
("w/o shield: +15, 3s", "Conditional line") ("w/o shield: +15, 3s", [CreateQuickLegendEffect(CriticalEffectCodes.DirectHits, valueInteger: 15), CreateQuickLegendEffect(CriticalEffectCodes.StunnedRounds, durationRounds: 3)])
]; ];
private IJSObjectReference? jsModule; private IJSObjectReference? jsModule;
private bool isBackdropPointerDown; private bool isBackdropPointerDown;
@@ -639,6 +640,26 @@
? "1 parser note is available under Advanced Review & Diagnostics." ? "1 parser note is available under Advanced Review & Diagnostics."
: $"{noteCount} parser notes are available under Advanced Review & Diagnostics."; : $"{noteCount} parser notes are available under Advanced Review & Diagnostics.";
private static CriticalEffectLookupResponse CreateQuickLegendEffect(
string effectCode,
int? valueInteger = null,
string? valueExpression = null,
int? durationRounds = null,
int? perRound = null,
int? modifier = null) =>
new(
effectCode,
"foe",
valueInteger,
valueExpression,
durationRounds,
perRound,
modifier,
null,
false,
"legend",
null);
private static string FormatJson(string json) private static string FormatJson(string json)
{ {
if (string.IsNullOrWhiteSpace(json)) if (string.IsNullOrWhiteSpace(json))

View File

@@ -844,18 +844,20 @@ textarea {
} }
.critical-editor-quick-legend { .critical-editor-quick-legend {
display: grid; display: flex;
gap: 0.55rem; flex-wrap: wrap;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.45rem 0.7rem;
} }
.critical-editor-quick-legend-item { .critical-editor-quick-legend-item {
display: grid; display: inline-flex;
gap: 0.2rem; align-items: center;
padding: 0.65rem 0.75rem; gap: 0.45rem;
border-radius: 12px; padding: 0.4rem 0.6rem;
border-radius: 999px;
background: rgba(255, 255, 255, 0.72); background: rgba(255, 255, 255, 0.72);
border: 1px solid rgba(127, 96, 55, 0.1); border: 1px solid rgba(127, 96, 55, 0.1);
white-space: nowrap;
} }
.critical-editor-quick-legend-item code { .critical-editor-quick-legend-item code {
@@ -863,6 +865,11 @@ textarea {
color: #5b4327; color: #5b4327;
} }
.critical-editor-quick-legend-equals {
color: #8d5e1a;
font-weight: 700;
}
.critical-editor-compare-grid { .critical-editor-compare-grid {
display: grid; display: grid;
gap: 0.85rem; gap: 0.85rem;