fix(routing): InteractiveServer routing, WASM interactivity declared at layout level

Routes moves to InteractiveServer so the server router always sees all
assemblies (including AuthBlocksWeb). MainLayout declares
@rendermode InteractiveWebAssembly — the single source of WASM
interactivity for all public pages. CmsLayout in DeepDrftCms provides
a server-rendered admin shell without the audio dock. Assembly-level
_Imports.razor files set the default layout for each group; no per-page
rendermode declarations needed. Routes.razor moves to the server host
(its correct home) carrying the full AdditionalAssemblies list.
This commit is contained in:
Daniel Harvey
2026-05-18 23:31:10 -04:00
parent 8e7347f498
commit d31a08bd15
8 changed files with 99 additions and 28 deletions
+70
View File
@@ -0,0 +1,70 @@
@rendermode InteractiveServer
@inherits LayoutComponentBase
<MudThemeProvider IsDarkMode="false" Theme="@_theme" />
<MudPopoverProvider />
<MudDialogProvider />
<MudSnackbarProvider />
<MudLayout>
<MudAppBar Dense="true" Elevation="1" Color="Color.Primary">
<MudText Typo="Typo.h6" Class="ml-3" Style="font-family: 'DM Sans', sans-serif; letter-spacing: 0.05em;">
Deep Drft — Admin
</MudText>
<MudSpacer />
<MudTooltip Text="Back to site">
<MudIconButton Icon="@Icons.Material.Filled.Home"
Href="/"
Color="Color.Inherit" />
</MudTooltip>
</MudAppBar>
<MudMainContent Class="pt-14 pb-8">
<MudContainer MaxWidth="MaxWidth.False" Class="pa-4">
@Body
</MudContainer>
</MudMainContent>
</MudLayout>
<div id="blazor-error-ui" data-nosnippet>
An unhandled error has occurred.
<a href="." class="reload">Reload</a>
<span class="dismiss">🗙</span>
</div>
@code {
// Light palette from MainLayout — keeps the CMS visually consistent with the public site.
private readonly MudTheme _theme = new()
{
PaletteLight = new PaletteLight
{
Primary = "#0D1B2A",
PrimaryDarken = "#162437",
Secondary = "#1A3C34",
Tertiary = "#3D7A68",
Background = "#FAFAF8",
BackgroundGray = "#F0F2F0",
Surface = "#FAFAF8",
AppbarBackground = "#0D1B2A",
AppbarText = "#FAFAF8",
TextPrimary = "#0D1B2A",
TextSecondary = "#8A9BB0",
Divider = "rgba(13,27,42,0.10)",
TableLines = "rgba(13,27,42,0.10)",
},
Typography = new Typography
{
Default = new DefaultTypography { FontFamily = new[] { "DM Sans", "sans-serif" } },
H1 = new H1Typography { FontFamily = new[] { "Cormorant Garamond", "Georgia", "serif" } },
H2 = new H2Typography { FontFamily = new[] { "Cormorant Garamond", "Georgia", "serif" } },
H3 = new H3Typography { FontFamily = new[] { "Cormorant Garamond", "Georgia", "serif" } },
H4 = new H4Typography { FontFamily = new[] { "Cormorant Garamond", "Georgia", "serif" } },
H5 = new H5Typography { FontFamily = new[] { "Cormorant Garamond", "Georgia", "serif" } },
H6 = new H6Typography { FontFamily = new[] { "Cormorant Garamond", "Georgia", "serif" } },
Subtitle1 = new Subtitle1Typography{ FontFamily = new[] { "Geist Mono", "monospace" } },
Body1 = new Body1Typography { FontFamily = new[] { "DM Sans", "sans-serif" } },
Body2 = new Body2Typography { FontFamily = new[] { "DM Sans", "sans-serif" } },
Caption = new CaptionTypography { FontFamily = new[] { "Geist Mono", "monospace" } },
Button = new ButtonTypography { FontFamily = new[] { "Geist Mono", "monospace" } },
}
};
}
+1
View File
@@ -12,3 +12,4 @@
@using DeepDrftData
@using Models.Common
@using MudBlazor
@layout DeepDrftCms.Layout.CmsLayout
+2 -1
View File
@@ -1,4 +1,5 @@
@using DeepDrftWeb.Client.Controls
@rendermode InteractiveWebAssembly
@using DeepDrftWeb.Client.Controls
@using DeepDrftWeb.Client.Controls.AudioPlayerBar
@using DeepDrftWeb.Client.Services
@using DeepDrftWeb.Client.Common
-24
View File
@@ -1,24 +0,0 @@
@inject NavigationManager NavigationManager
<Router AppAssembly="typeof(_Imports).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)">
<NotAuthorized>
@{
NavigationManager.NavigateTo($"account/login?returnUrl={Uri.EscapeDataString(NavigationManager.Uri)}", forceLoad: true);
}
</NotAuthorized>
</AuthorizeRouteView>
</Found>
<NotFound>
@{
// Routes owned by server-side assemblies (e.g. /account/*) are not visible to the
// WASM router. Force a full-page reload so the server router handles them instead.
var path = new Uri(NavigationManager.Uri).AbsolutePath;
if (path.StartsWith("/account", StringComparison.OrdinalIgnoreCase))
{
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true);
}
}
</NotFound>
</Router>
+2 -1
View File
@@ -10,4 +10,5 @@
@using MudBlazor
@using MudBlazor.Services
@using MudBlazor.ThemeManager
@using DeepDrftWeb.Client.Common
@using DeepDrftWeb.Client.Common
@layout DeepDrftWeb.Client.Layout.MainLayout
+2 -2
View File
@@ -15,11 +15,11 @@
<link rel="stylesheet" href="styles/deepdrft-styles.css" />
<ImportMap />
<link rel="icon" type="image/ico" href="deepdrft-logo.ico" />
<HeadOutlet @rendermode="InteractiveAuto" />
<HeadOutlet @rendermode="InteractiveServer" />
</head>
<body>
<Routes @rendermode="InteractiveAuto" />
<Routes @rendermode="InteractiveServer" />
<script src="_framework/blazor.web.js"></script>
<script src=@Assets["_content/MudBlazor/MudBlazor.min.js"]></script>
<script type="module">
+21
View File
@@ -0,0 +1,21 @@
<Router AppAssembly="typeof(App).Assembly"
AdditionalAssemblies="new[] { typeof(DeepDrftWeb.Client._Imports).Assembly, typeof(DeepDrftCms._Imports).Assembly, typeof(AuthBlocksWeb._Imports).Assembly }">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(DeepDrftWeb.Client.Layout.MainLayout)">
<NotAuthorized>
@{
NavigationManager.NavigateTo($"account/login?returnUrl={Uri.EscapeDataString(NavigationManager.Uri)}", forceLoad: true);
}
</NotAuthorized>
</AuthorizeRouteView>
<FocusOnNavigate RouteData="routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="typeof(DeepDrftWeb.Client.Layout.MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
@inject NavigationManager NavigationManager
+1
View File
@@ -1,6 +1,7 @@
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using static Microsoft.AspNetCore.Components.Web.RenderMode