Renders every page through the themed shell with a themed navigation menu

This commit is contained in:
BinaryAlley committed 2026-08-20 10:21:05 -07:00
1 parent e37bb3ecc6
commit 4ef8570854
19 files changed
+707 -104

No files matched your search

@@ -0,0 +1,30 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Themes;
/// <summary>
/// Data transfer object for the model available to the themed layout template while rendering the shell of a page.
/// </summary>
/// <param name="Title">The title of the page, rendered by the theme.</param>
/// <param name="AssetBase">The base URL of the theme assets.</param>
/// <param name="AppHead">The application head links, such as its global stylesheets.</param>
/// <param name="Nav">The rendered navigation menu of the page.</param>
/// <param name="Content">The rendered content section of the page.</param>
/// <param name="AudioPlayer">The rendered audio player, when the current user is authenticated.</param>
/// <param name="AppScripts">The application global scripts, such as its client libraries and configuration.</param>
/// <param name="Scripts">The rendered script section of the page.</param>
/// <param name="MainStyle">The inline style of the main content area, used to fill the viewport when the user is not authenticated.</param>
[DebuggerDisplay("Title: {Title}")]
public sealed record ThemeLayoutModelDto(
string Title,
string AssetBase,
string AppHead,
string Nav,
string Content,
string AudioPlayer,
string AppScripts,
string Scripts,
string MainStyle
);
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Themes;
/// <summary>
/// Data transfer object for the page content handed to the layout renderer, which wraps it in the themed shell.
/// </summary>
/// <param name="Title">The title of the page, displayed by the themed shell.</param>
/// <param name="Content">The rendered HTML content of the page section.</param>
/// <param name="Script">The rendered script element of the page section, when the template defines one.</param>
[DebuggerDisplay("Title: {Title}")]
public sealed record ThemeLayoutPageDto(
string Title,
string Content,
string Script
);
@@ -0,0 +1,21 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Themes;
/// <summary>
/// Data transfer object for a menu entry of the themed navigation menu, either a link or a submenu.
/// </summary>
/// <param name="Label">The localized label of the menu entry.</param>
/// <param name="Url">The URL of the link, or <see langword="null"/> for a submenu.</param>
/// <param name="CssClass">The CSS classes of the link, such as <c>nav-link</c> for AJAX navigation.</param>
/// <param name="Children">The child links of a submenu, empty for a plain link.</param>
[DebuggerDisplay("Label: {Label}")]
public sealed record ThemeNavEntryDto(
string Label,
string? Url,
string? CssClass,
IReadOnlyList<ThemeNavEntryDto> Children
);
@@ -0,0 +1,19 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Themes;
/// <summary>
/// Data transfer object for the model available to the themed navigation menu template.
/// </summary>
/// <param name="SiteName">The name of the site displayed by the navigation menu.</param>
/// <param name="MobileSections">The menu sections of the mobile navigation menu.</param>
/// <param name="MenubarSections">The menu sections of the desktop navigation menu bar.</param>
[DebuggerDisplay("SiteName: {SiteName}")]
public sealed record ThemeNavMenuDto(
string SiteName,
IReadOnlyList<ThemeNavSectionDto> MobileSections,
IReadOnlyList<ThemeNavSectionDto> MenubarSections
);
@@ -0,0 +1,17 @@
#region ========================================================================= USING =====================================================================================
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Presentation.Web.Common.DTO.Themes;
/// <summary>
/// Data transfer object for a menu section of the themed navigation menu.
/// </summary>
/// <param name="Label">The localized label of the menu section.</param>
/// <param name="Items">The menu entries of the section, visible to the current user.</param>
[DebuggerDisplay("Label: {Label}")]
public sealed record ThemeNavSectionDto(
string Label,
IReadOnlyList<ThemeNavEntryDto> Items
);
@@ -9,10 +9,8 @@ namespace Lumina.Presentation.Web.Common.DTO.Themes;
/// </summary>
/// <param name="Content">The rendered HTML content of the page section.</param>
/// <param name="Script">The rendered script element of the page section, when the template defines one.</param>
/// <param name="AssetBase">The base URL of the theme assets, used to load the theme stylesheet of the page.</param>
[DebuggerDisplay("Content length: {Content.Length}, Script length: {Script.Length}")]
public sealed record ThemeViewDto(
string Content,
string Script,
string AssetBase
string Script
);
@@ -304,6 +304,9 @@ public static class PresentationWebLayerServices
services.AddScoped<ThemeService>();
services.AddSingleton<ThemeTemplateEngine>();
services.AddScoped<ThemePageRenderer>();
services.AddScoped<RazorViewToStringRenderer>();
services.AddScoped<ThemeNavBuilder>();
services.AddScoped<ThemeLayoutRenderer>();
services.AddScoped<IAuthorizationHandler, InitializationHandler>();
services.AddScoped<IAuthorizationHandler, RoleAuthorizationHandler>();