Added hook option for plugins to inject into the main layout before the router

This commit is contained in:
2026-02-20 12:28:22 +01:00
parent 9b9272cd6e
commit 5ad7a6db7b
5 changed files with 90 additions and 20 deletions

View File

@@ -9,6 +9,10 @@
@using ShadcnBlazor.Emptys
@using Moonlight.Frontend.UI.Shared.Components.Auth
@using Moonlight.Frontend.UI.Shared.Partials
@using ShadcnBlazor.Extras.AlertDialogs
@using ShadcnBlazor.Extras.Dialogs
@using ShadcnBlazor.Extras.Toasts
@using ShadcnBlazor.Portals
@inject NavigationManager Navigation
@inject IOptions<NavigationAssemblyOptions> NavigationOptions
@@ -17,15 +21,23 @@
<ChildContent>
<AuthorizeView>
<ChildContent>
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="Assemblies" NotFoundPage="typeof(NotFound)">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)">
<NotAuthorized Context="authRouteViewContext">
<AccessDenied/>
</NotAuthorized>
</AuthorizeRouteView>
</Found>
</Router>
<LayoutMiddleware>
<Router AppAssembly="@typeof(App).Assembly" AdditionalAssemblies="Assemblies" NotFoundPage="typeof(NotFound)">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)">
<NotAuthorized Context="authRouteViewContext">
<AccessDenied/>
</NotAuthorized>
</AuthorizeRouteView>
</Found>
</Router>
</LayoutMiddleware>
<ToastLauncher/>
<DialogLauncher/>
<AlertDialogLauncher/>
<PortalOutlet />
</ChildContent>
<Authorizing>
<Authenticating/>