refactor(split): rename DeepDrftWeb -> DeepDrftPublic and DeepDrftWeb.Client -> DeepDrftPublic.Client (Phase 4)
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
@using DeepDrftPublic.Client.Controls
|
||||
@using DeepDrftPublic.Client.Controls.AudioPlayerBar
|
||||
@using DeepDrftPublic.Client.Services
|
||||
@using DeepDrftPublic.Client.Common
|
||||
@using DeepDrftShared.Client.Common
|
||||
@using Microsoft.AspNetCore.Components
|
||||
@inherits LayoutComponentBase
|
||||
@implements IDisposable
|
||||
|
||||
<MudThemeProvider Theme="@_themeManager.Theme" IsDarkMode="_isDarkMode" />
|
||||
<MudPopoverProvider />
|
||||
<MudDialogProvider />
|
||||
<MudSnackbarProvider />
|
||||
<div class="@ThemeWrapperClass">
|
||||
<MudLayout Style="display: flex; flex-direction: column; min-height: 100vh">
|
||||
<AudioPlayerProvider>
|
||||
<DeepDrftMenu Elevation="_themeManager.AppBarElevation" @bind-IsDarkMode="_isDarkMode" />
|
||||
<MudMainContent Class="flex-grow-1 pt-16 pb-8">
|
||||
<MudContainer MaxWidth="MaxWidth.False" Class="pa-4">
|
||||
@Body
|
||||
</MudContainer>
|
||||
<AudioPlayerBar />
|
||||
</MudMainContent>
|
||||
<footer class="deepdrft-footer">
|
||||
<div class="deepdrft-footer-logo">Deep <span>Drft</span></div>
|
||||
<ul class="deepdrft-footer-links">
|
||||
<li><a href="/tracks">Listen</a></li>
|
||||
<li><a href="#">Sessions</a></li>
|
||||
<li><a href="/tracks">Archive</a></li>
|
||||
<li><a href="#">About</a></li>
|
||||
<li><a href="#">Contact</a></li>
|
||||
</ul>
|
||||
<div class="deepdrft-footer-copy">© 2026 Deep DRFT — Charleston, SC</div>
|
||||
</footer>
|
||||
</AudioPlayerProvider>
|
||||
</MudLayout>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="blazor-error-ui" data-nosnippet>
|
||||
An unhandled error has occurred.
|
||||
<a href="." class="reload">Reload</a>
|
||||
<span class="dismiss">🗙</span>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private const string DarkModeKey = "darkMode";
|
||||
private bool _isDarkMode = true;
|
||||
private PersistingComponentStateSubscription _persistingSubscription;
|
||||
|
||||
[Inject] public required PersistentComponentState PersistentState { get; set; }
|
||||
[Inject] public required DarkModeSettings DarkModeSettings { get; set; }
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
|
||||
// Restore persisted dark mode state (from server prerender)
|
||||
if (PersistentState.TryTakeFromJson<bool>(DarkModeKey, out var restored))
|
||||
{
|
||||
_isDarkMode = restored;
|
||||
DarkModeSettings.IsDarkMode = restored;
|
||||
}
|
||||
else
|
||||
{
|
||||
_isDarkMode = DarkModeSettings.IsDarkMode;
|
||||
}
|
||||
|
||||
// Register to persist state when prerendering completes
|
||||
_persistingSubscription = PersistentState.RegisterOnPersisting(PersistDarkMode);
|
||||
|
||||
// Palettes + typography live in DeepDrftShared.Client.Common.DeepDrftPalettes
|
||||
// so the CMS host can reuse them. We wrap into ThemeManagerTheme to keep
|
||||
// the MudBlazor.ThemeManager integration intact.
|
||||
_themeManager = new ThemeManagerTheme
|
||||
{
|
||||
Theme = DeepDrftPalettes.Default,
|
||||
};
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private ThemeManagerTheme _themeManager;
|
||||
public bool _themeManagerOpen = false;
|
||||
|
||||
void OpenThemeManager(bool value)
|
||||
{
|
||||
_themeManagerOpen = value;
|
||||
}
|
||||
|
||||
void UpdateTheme(ThemeManagerTheme value)
|
||||
{
|
||||
_themeManager = value;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
// Theme wrapper class for CSS targeting
|
||||
private string ThemeWrapperClass => _isDarkMode ? "deepdrft-theme-dark" : "deepdrft-theme-light";
|
||||
|
||||
private Task PersistDarkMode()
|
||||
{
|
||||
PersistentState.PersistAsJson(DarkModeKey, _isDarkMode);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_persistingSubscription.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user