Fixed some dump mistakes

This commit is contained in:
Moritz Deiaco
2024-06-09 10:33:04 +02:00
parent a0f256946e
commit 862b43ae6d
3 changed files with 20 additions and 10 deletions

View File

@@ -151,9 +151,9 @@ public class CoreConfiguration
public class CookieData public class CookieData
{ {
[JsonProperty("ShowCookieConsentBanner")] [JsonProperty("Enabled")]
[Description("This specifies if the cookie consent banner is shown to users.")] [Description("This specifies if the cookie consent banner is shown to users.")]
public bool ShowBanner { get; set; } = true; public bool Enabled { get; set; } = true;
[JsonProperty("BannerTitle")] [JsonProperty("BannerTitle")]
[Description("The title for the cookie consent banner.")] [Description("The title for the cookie consent banner.")]

View File

@@ -6,9 +6,7 @@
@inject ConfigService<CoreConfiguration> ConfigService @inject ConfigService<CoreConfiguration> ConfigService
@inject IdentityService IdentityService @inject IdentityService IdentityService
@ChildContent @if (ShowBanner)
@if (ConfigService.Get().Customisation.CookieConsentBanner.ShowBanner && !IdentityService.HasFlag("CookieAsked").Result)
{ {
<div class="mb-12 mx-8 d-flex justify-content-end fixed-bottom no-pointer-events" style="pointer-events: none;"> <div class="mb-12 mx-8 d-flex justify-content-end fixed-bottom no-pointer-events" style="pointer-events: none;">
<div style="pointer-events: all; max-width: var(--bs-breakpoint-sm)" class="w-100"> <div style="pointer-events: all; max-width: var(--bs-breakpoint-sm)" class="w-100">
@@ -31,10 +29,23 @@
</div> </div>
</div> </div>
} }
@code { @code {
[Parameter] private bool ShowBanner;
public RenderFragment ChildContent { get; set; }
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
var userWasAsked = await IdentityService.HasFlag("CookieAsked");
if (ConfigService.Get().Customisation.CookieConsentBanner.Enabled && !userWasAsked)
ShowBanner = true;
await InvokeAsync(StateHasChanged);
}
}
private async Task Consent() private async Task Consent()
{ {

View File

@@ -55,9 +55,8 @@
if (IdentityService.IsLoggedIn) if (IdentityService.IsLoggedIn)
{ {
<PermissionChecker> <PermissionChecker>
<CookieConsentBanner>
@Body @Body
</CookieConsentBanner> <CookieConsentBanner/>
</PermissionChecker> </PermissionChecker>
} }
else else