mirror of
https://gitlab.com/Hukuta47/cartrix.git
synced 2026-12-05 12:30:55 +00:00
Добавил коки для тем, а так же добавил темы в настройках. изменил вид баджам в карточках для картриджей
This commit is contained in:
1 parent
503cb192db
commit
99521ea5be
16 files changed
+191
-44
No files matched your search
+36
-1
@@ -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) });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user