feat(ui): designed Velocity dashboard — market-chip signal feed
Restructure the Home signal feed to the redesign mockup's composition: each row now shows the sport icon, a time·sport·country meta line, the uppercase team lockup, the 1/X/2 pre→post market chips (lime when odds drift out, red when they shorten), a severity pill and a slammed Oswald score number. All data was already on AnomalyListItem (pre/post rates per outcome, IsTwoWay, sport, country, severity, score) — no service changes; the feed just wasn't rendering it. Hero, stat strip and pipeline panel were already on-composition from the re-skin. Build clean, all 568 tests green.
This commit is contained in:
@@ -69,24 +69,29 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div style="display: grid; gap: var(--m-space-4);">
|
||||
<div class="m-signal-feed" data-test="home-signals">
|
||||
@foreach (var signal in _summary.LatestSignals)
|
||||
{
|
||||
<a href="@($"/anomalies/{signal.Id}")" data-test="home-signal"
|
||||
style="display: grid; grid-template-columns: 80px 1fr auto; gap: var(--m-space-4); padding: var(--m-space-3) 0; border-top: 1px solid var(--m-c-rule); text-decoration: none; color: inherit;">
|
||||
<div class="m-mono" style="font-size: 0.75rem; color: var(--m-c-ink-soft); text-transform: uppercase; letter-spacing: 0.1em;">
|
||||
@FormatSignalTime(signal.DetectedAt)
|
||||
</div>
|
||||
<div>
|
||||
<div style="font-weight: 500;">@signal.EventTitle</div>
|
||||
<div style="color: var(--m-c-ink-soft); font-size: 0.8125rem;">
|
||||
@SportLabel(signal.Sport.Value) · @SeverityLabel(signal.Severity)
|
||||
<a href="@($"/anomalies/{signal.Id}")" class="m-signal" data-test="home-signal">
|
||||
<SportIcon Code="@signal.Sport.Value" Label="@SportLabel(signal.Sport.Value)" ClassName="m-signal__icon" />
|
||||
<div class="m-signal__mid">
|
||||
<div class="m-signal__meta m-mono">
|
||||
@FormatSignalTime(signal.DetectedAt) · @SportLabel(signal.Sport.Value) · @signal.CountryCode
|
||||
</div>
|
||||
<div class="m-signal__teams">@signal.EventTitle</div>
|
||||
<div class="m-signal__mkts">
|
||||
@Chip("1", signal.PreWin1Rate, signal.PostWin1Rate)
|
||||
@if (!signal.IsTwoWay)
|
||||
{
|
||||
@Chip("X", signal.PreDrawRate, signal.PostDrawRate)
|
||||
}
|
||||
@Chip("2", signal.PreWin2Rate, signal.PostWin2Rate)
|
||||
</div>
|
||||
</div>
|
||||
<span class="m-anomaly">
|
||||
<span class="m-anomaly__pulse"></span>
|
||||
@signal.Score.ToString("0.00", CultureInfo.InvariantCulture)
|
||||
</span>
|
||||
<div class="m-signal__right">
|
||||
<SeverityBadge Severity="signal.Severity" ShowScore="false" ShowDot="false" />
|
||||
<span class="m-signal__score" data-numeric>@signal.Score.ToString("0.00", CultureInfo.InvariantCulture)</span>
|
||||
</div>
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
@@ -111,6 +116,75 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<style>
|
||||
.m-signal-feed { display: flex; flex-direction: column; }
|
||||
.m-signal {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr) auto;
|
||||
gap: var(--m-space-4);
|
||||
align-items: center;
|
||||
padding: var(--m-space-3) 0;
|
||||
border-top: 1px solid var(--m-c-rule);
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
transition: transform 120ms ease;
|
||||
}
|
||||
.m-signal:hover { transform: translateX(2px); }
|
||||
.m-signal:focus-visible { outline: 2px solid var(--m-c-info); outline-offset: 2px; }
|
||||
.m-signal__icon { --m-sport-size: 28px; margin-top: 2px; }
|
||||
.m-signal__mid { min-width: 0; display: grid; gap: 5px; }
|
||||
.m-signal__meta {
|
||||
font-size: 0.6875rem;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.1em;
|
||||
color: var(--m-c-ink-soft);
|
||||
}
|
||||
.m-signal__teams {
|
||||
font-family: var(--m-font-display);
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.01em;
|
||||
font-size: 1.0625rem;
|
||||
line-height: 1.1;
|
||||
color: var(--m-c-ink);
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.m-signal__mkts { display: flex; flex-wrap: wrap; gap: var(--m-space-2); margin-top: 2px; }
|
||||
.m-signal__mkt {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 6px;
|
||||
padding: 3px 8px;
|
||||
border: 2px solid var(--m-c-ink);
|
||||
border-radius: var(--m-radius-sm);
|
||||
background: var(--m-c-paper);
|
||||
color: var(--m-c-ink);
|
||||
font-family: var(--m-font-mono);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
.m-signal__mkt-k { font-weight: 700; opacity: 0.55; }
|
||||
.m-signal__mkt-pre { opacity: 0.55; text-decoration: line-through; }
|
||||
.m-signal__mkt-arrow { opacity: 0.55; }
|
||||
.m-signal__mkt-post { font-weight: 700; }
|
||||
.m-signal__mkt--up { background: var(--m-c-accent); color: var(--m-c-on-accent); border-color: var(--m-c-ink); }
|
||||
.m-signal__mkt--dn { background: color-mix(in srgb, var(--m-c-anomaly) 14%, var(--m-c-paper)); }
|
||||
.m-signal__mkt--dn .m-signal__mkt-post { color: var(--m-c-anomaly); }
|
||||
.m-signal__right { display: flex; flex-direction: column; align-items: flex-end; gap: var(--m-space-2); }
|
||||
.m-signal__score {
|
||||
font-family: var(--m-font-display);
|
||||
font-weight: 700;
|
||||
font-size: 1.75rem;
|
||||
line-height: 1;
|
||||
color: var(--m-c-ink);
|
||||
}
|
||||
@@media (max-width: 560px) {
|
||||
.m-signal { grid-template-columns: auto minmax(0, 1fr); }
|
||||
.m-signal__right { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@code {
|
||||
private DashboardSummary _summary = DashboardSummary.Empty;
|
||||
|
||||
@@ -157,10 +231,40 @@
|
||||
|
||||
private string SportLabel(int code) => SportLabels.Resolve(L, code);
|
||||
|
||||
private string SeverityLabel(AnomalySeverity severity) => severity switch
|
||||
// Direction of an odds move for the market chip colour: up = drifted out, dn = shortened.
|
||||
private static string ChipDir(decimal? pre, decimal? post) =>
|
||||
pre is { } p && post is { } q && p != q ? (q > p ? "up" : "dn") : string.Empty;
|
||||
|
||||
private static string FormatRate(decimal? r) =>
|
||||
r is { } v ? v.ToString("0.00", CultureInfo.InvariantCulture) : "—";
|
||||
|
||||
// A single 1 / X / 2 market chip: label · struck pre · → · post (coloured by direction).
|
||||
private RenderFragment Chip(string label, decimal? pre, decimal? post) => builder =>
|
||||
{
|
||||
AnomalySeverity.High => L["Anomaly.Severity.High"],
|
||||
AnomalySeverity.Medium => L["Anomaly.Severity.Medium"],
|
||||
_ => L["Anomaly.Severity.Low"],
|
||||
var dir = ChipDir(pre, post);
|
||||
builder.OpenElement(0, "span");
|
||||
builder.AddAttribute(1, "class", dir.Length > 0 ? $"m-signal__mkt m-signal__mkt--{dir}" : "m-signal__mkt");
|
||||
|
||||
builder.OpenElement(2, "span");
|
||||
builder.AddAttribute(3, "class", "m-signal__mkt-k");
|
||||
builder.AddContent(4, label);
|
||||
builder.CloseElement();
|
||||
|
||||
builder.OpenElement(5, "span");
|
||||
builder.AddAttribute(6, "class", "m-signal__mkt-pre");
|
||||
builder.AddContent(7, FormatRate(pre));
|
||||
builder.CloseElement();
|
||||
|
||||
builder.OpenElement(8, "span");
|
||||
builder.AddAttribute(9, "class", "m-signal__mkt-arrow");
|
||||
builder.AddContent(10, "→");
|
||||
builder.CloseElement();
|
||||
|
||||
builder.OpenElement(11, "span");
|
||||
builder.AddAttribute(12, "class", "m-signal__mkt-post");
|
||||
builder.AddContent(13, FormatRate(post));
|
||||
builder.CloseElement();
|
||||
|
||||
builder.CloseElement();
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user