1
0
mirror of synced 2025-01-19 00:04:05 +01:00

Allow title to be changed via config

This commit is contained in:
shiibe 2024-06-05 22:29:26 -04:00
parent c3b5e11739
commit a5c45b0065
3 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,8 @@
@inherits LayoutComponentBase
@inject Blazored.LocalStorage.ILocalStorageService LocalStorage
@inject AuthService AuthService
@using Microsoft.Extensions.Options;
@using TaikoWebUI.Settings;
<MudThemeProvider IsDarkMode="@isDarkMode" Theme="@taikoWebUiTheme" />
<MudDialogProvider />
@ -17,7 +19,7 @@
</MudAppBar>
<MudDrawer Elevation="0" Style="border-right:1px solid #ededf0" @bind-Open="drawerOpen">
<MudDrawerHeader>
<MudText Typo="Typo.h6">TaikoWebUI</MudText>
<MudText Typo="Typo.h6">@title</MudText>
</MudDrawerHeader>
<NavMenu />
</MudDrawer>
@ -35,9 +37,20 @@
@code {
bool drawerOpen = true;
bool isDarkMode = false;
string title = "TaikoWebUI";
[Inject]
IOptions<WebUiSettings> UiSettings { get; set; } = default!;
protected override void OnInitialized()
{
title = UiSettings.Value.Title;
}
protected override async Task OnInitializedAsync()
{
var hasDrawerOpenEntry = await LocalStorage.ContainKeyAsync("drawerOpen");
if (hasDrawerOpenEntry)

View File

@ -2,6 +2,7 @@
public class WebUiSettings
{
public string Title { get; set; } = "TaikoWebUI";
public bool LoginRequired { get; set; }
public bool OnlyAdmin { get; set; }
public int BoundAccessCodeUpperLimit { get; set; }

View File

@ -1,5 +1,6 @@
{
"WebUiSettings": {
"Title": "TaikoWebUI",
"LoginRequired": "false",
"OnlyAdmin": "false",
"BoundAccessCodeUpperLimit": "3",