Merge pull request #190 from hargata/Hargata/alternate.logo

allows users to inject their own logo.
This commit is contained in:
Hargata Softworks 2024-01-30 14:43:51 -07:00 committed by GitHub
commit d816f73598
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View File

@ -9,6 +9,7 @@ namespace CarCareTracker.Helper
{
UserConfig GetUserConfig(ClaimsPrincipal user);
bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData);
string GetLogoUrl();
public bool DeleteUserConfig(int userId);
}
public class ConfigHelper : IConfigHelper
@ -24,6 +25,15 @@ namespace CarCareTracker.Helper
_userConfig = userConfig;
_cache = memoryCache;
}
public string GetLogoUrl()
{
var logoUrl = _config["LUBELOGGER_LOGO_URL"];
if (string.IsNullOrWhiteSpace(logoUrl))
{
logoUrl = "/defaults/lubelogger_logo.png";
}
return logoUrl;
}
public bool SaveUserConfig(ClaimsPrincipal user, UserConfig configData)
{
var storedUserId = user.FindFirstValue(ClaimTypes.NameIdentifier);

View File

@ -2,6 +2,7 @@
@inject IConfigHelper config
@{
var enableAuth = config.GetUserConfig(User).EnableAuth;
var logoUrl = config.GetLogoUrl();
}
@model string
@{
@ -35,7 +36,7 @@
<div class="container">
<div class="row mt-2">
<div class="d-flex lubelogger-navbar">
<img src="/defaults/lubelogger_logo.png" />
<img src="@logoUrl" />
<div class="lubelogger-navbar-button">
<button type="button" class="btn btn-dark" onclick="showMobileNav()"><i class="bi bi-list lubelogger-menu-icon"></i></button>
</div>