Добавил коки для тем, а так же добавил темы в настройках. изменил вид баджам в карточках для картриджей

This commit is contained in:
HK committed 2026-06-05 15:36:46 +09:00
1 parent 503cb192db
commit 99521ea5be
16 files changed
+191 -44

No files matched your search

+36 -1
View File
@@ -1,4 +1,8 @@
<RadzenTheme Theme="dark" />
@using Microsoft.AspNetCore.Http
@using Microsoft.Extensions.Options
<RadzenTheme Theme="software" />
<script src="_content/Radzen.Blazor/Radzen.Blazor.js?v=@(typeof(Radzen.Colors).Assembly.GetName().Version)"></script>
@@ -9,3 +13,34 @@
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
</Router>
@code {
[CascadingParameter]
private HttpContext HttpContext { get; set; } = default!;
[Inject]
private ThemeService ThemeService { get; set; } = default!;
[Inject]
private IOptions<CookieThemeServiceOptions> Options { get; set; } = default!;
protected override void OnInitialized()
{
base.OnInitialized();
if (HttpContext != null)
{
var theme = HttpContext.Request.Cookies["CartriXTheme"];
if (!string.IsNullOrEmpty(theme))
{
ThemeService.SetTheme(theme, false);
}
else
{
HttpContext.Response.Cookies.Append("CartriXTheme", "material", new CookieOptions { Secure = Options.Value.IsSecure, Expires = DateTimeOffset.Now.Add(Options.Value.Duration) });
}
}
}
}