f12573d3fa
The dev-only demo page shipped routable in the production assembly. Its route moves from @page to a code-behind [Route] under #if DEBUG, so a Release build keeps the component type (nothing referencing it breaks) but has no /dev/* route. The page-authorization guard classifies it under #if DEBUG, and DevRouteGatingTests asserts each configuration's half (Debug: exactly the demo route; Release: none) with a positive control. Both configurations pass. Refs #745 Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT
43 lines
1.5 KiB
Plaintext
43 lines
1.5 KiB
Plaintext
@* The /dev/context-menu-demo route lives in ContextMenuDemo.razor.cs behind #if DEBUG (R04 S7), so a
|
|
Release build ships the component but no route to it. *@
|
|
@* Dev-only host page to live-verify the reusable ContextMenu component. *@
|
|
@attribute [Authorize(Policy = AdminUiPolicies.AuthenticatedRead)]
|
|
@rendermode InteractiveServer
|
|
|
|
<PageErrorBoundary>
|
|
<PageTitle>ContextMenu demo</PageTitle>
|
|
|
|
<h1>ContextMenu demo</h1>
|
|
<p>Right-click the card below, or use the <strong>⋯</strong> button.</p>
|
|
|
|
<div style="display:flex; align-items:center; gap:1rem; margin:1rem 0;">
|
|
<ContextMenu Items="_items" ShowEllipsis="false">
|
|
<div style="padding:2rem 3rem; border:1px dashed var(--bs-border-color); border-radius:.5rem; user-select:none;">
|
|
Right-click me
|
|
</div>
|
|
</ContextMenu>
|
|
|
|
<ContextMenu Items="_items" ShowEllipsis="true" />
|
|
</div>
|
|
|
|
<p>Last action: <strong>@_lastAction</strong></p>
|
|
</PageErrorBoundary>
|
|
|
|
@code {
|
|
private string _lastAction = "(none)";
|
|
|
|
private IReadOnlyList<ContextMenuItem> _items => new List<ContextMenuItem>
|
|
{
|
|
new() { Label = "Edit", Icon = "✏️", OnClick = () => Set("Edit") },
|
|
new() { Label = "Duplicate", Icon = "📄", OnClick = () => Set("Duplicate") },
|
|
ContextMenuItem.Separator(),
|
|
new() { Label = "Delete", Icon = "🗑️", Disabled = true, OnClick = () => Set("Delete") },
|
|
};
|
|
|
|
private Task Set(string action)
|
|
{
|
|
_lastAction = action;
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|