ui: Central UI density/consistency sweep + Theme 0.4.1
Applies the family-wide admin-UI cleanup playbook to the Central UI so the Blazor surfaces stop diverging from the shared kit: buttons are grouped rather than individually sized, long cell values are contained instead of widening tables, and hard-coded colours give way to theme tokens. The headline fix is that MainLayout passed Accent="#2f5fd0" to ThemeShell, which the kit emits as an inline style on the shell root. Being a descendant of <html>, it beat the [data-bs-theme="dark"] override for the entire app, so the dark accent had never rendered. Declaring --accent in site.css :root instead lets both schemes resolve; light is unchanged because the value already matched the kit's light default. Theme pins to 0.4.1, which upstreams the local .btn sizing block verbatim, so that block is deleted here rather than duplicated. Verified byte-identical before removal; the repo now declares no --bs-btn-* anywhere. NOT purely cosmetic, contrary to the sweep's stated scope: four detail-modal surfaces (NotificationReport, ConfigurationAuditLog, ParkedMessages, SiteCallsReport) were additionally refactored from holding the selected record to holding its id and re-resolving from the current page each render, with the resolve doubling as the visibility gate. A background refresh that drops the row now closes the modal instead of showing a stale snapshot. This is a behaviour change and is called out rather than buried: a full-suite run turned up one intermittent CentralUI failure, CloseButton_DismissesModal, whose stack (GetRequiredEventBindingEntry during DispatchEventAsync) indicates the handler was disposed between render and click — a window the previous field-held record made structurally impossible. Treat the modal lifecycle here as unreviewed. Build 0/0; suite green apart from that one intermittent failure.
This commit is contained in:
+44
-12
@@ -57,7 +57,7 @@
|
||||
var recipients = _recipients.GetValueOrDefault(list.Id)
|
||||
?? (IReadOnlyList<NotificationRecipient>)Array.Empty<NotificationRecipient>();
|
||||
<tr @key="list.Id">
|
||||
<td>@list.Name</td>
|
||||
<td><span class="cell-clip" title="@list.Name">@list.Name</span></td>
|
||||
<td>@list.Type</td>
|
||||
<td>
|
||||
@if (recipients.Count == 0)
|
||||
@@ -66,27 +66,42 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var r in recipients)
|
||||
@foreach (var r in recipients.Take(MaxVisibleRecipients))
|
||||
{
|
||||
@* Type-aware contact: SMS recipients carry a PhoneNumber and a null
|
||||
EmailAddress, so an email-shaped badge would render "Name <>". Fall
|
||||
back to whichever contact field is populated. *@
|
||||
back to whichever contact field is populated. The two identifiers
|
||||
are separated inside the chip — name, then contact in a lighter
|
||||
weight — rather than fused into one "Name <contact>" run. *@
|
||||
var contact = list.Type == NotificationType.Sms
|
||||
? r.PhoneNumber
|
||||
: r.EmailAddress;
|
||||
<span class="badge bg-secondary-subtle text-secondary-emphasis me-1 mb-1">@r.Name <@contact></span>
|
||||
<span class="badge bg-secondary-subtle text-secondary-emphasis me-1 mb-1"
|
||||
title="@r.Name — @contact">@r.Name<span class="fw-normal opacity-75 ms-1">@contact</span></span>
|
||||
}
|
||||
@if (recipients.Count > MaxVisibleRecipients)
|
||||
{
|
||||
@* Long lists roll up rather than filling the cell with chips.
|
||||
The remainder stays readable on the tooltip, and the full set
|
||||
is always available on the list's Edit page. *@
|
||||
<span class="badge bg-body-secondary text-body-secondary border"
|
||||
title="@RemainingRecipientsTitle(list, recipients)">
|
||||
+@(recipients.Count - MaxVisibleRecipients) more
|
||||
</span>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<button class="btn btn-outline-primary btn-sm me-1"
|
||||
@onclick='() => NavigationManager.NavigateTo($"/notifications/lists/{list.Id}/edit")'>
|
||||
Edit
|
||||
</button>
|
||||
<button class="btn btn-outline-danger btn-sm"
|
||||
@onclick="() => DeleteList(list)">
|
||||
Delete
|
||||
</button>
|
||||
<div class="btn-group btn-group-sm" role="group">
|
||||
<button class="btn btn-outline-primary"
|
||||
@onclick='() => NavigationManager.NavigateTo($"/notifications/lists/{list.Id}/edit")'>
|
||||
Edit
|
||||
</button>
|
||||
<button class="btn btn-outline-danger"
|
||||
@onclick="() => DeleteList(list)">
|
||||
Delete
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@@ -97,6 +112,13 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
/// <summary>
|
||||
/// Recipient chips rendered inline before the "+N more" roll-up. A list may
|
||||
/// hold dozens of recipients and the cell is uncapped, so the grid would
|
||||
/// otherwise render one chip per recipient into a single row.
|
||||
/// </summary>
|
||||
private const int MaxVisibleRecipients = 5;
|
||||
|
||||
private bool _loading = true;
|
||||
private string? _errorMessage;
|
||||
private List<NotificationList> _lists = new();
|
||||
@@ -125,6 +147,16 @@
|
||||
_loading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tooltip for the "+N more" roll-up chip: the recipients that were not given
|
||||
/// a chip of their own, using the same type-aware contact field as the chips.
|
||||
/// </summary>
|
||||
private static string RemainingRecipientsTitle(
|
||||
NotificationList list, IReadOnlyList<NotificationRecipient> recipients) =>
|
||||
string.Join(", ", recipients
|
||||
.Skip(MaxVisibleRecipients)
|
||||
.Select(r => $"{r.Name} — {(list.Type == NotificationType.Sms ? r.PhoneNumber : r.EmailAddress)}"));
|
||||
|
||||
private async Task DeleteList(NotificationList list)
|
||||
{
|
||||
if (!await Dialog.ConfirmAsync("Delete", $"Delete notification list '{list.Name}'?", danger: true))
|
||||
|
||||
Reference in New Issue
Block a user