cca56c8f62
- menu DatiMacchine visibile solo in debug - update akltre librerie nuget
53 lines
1.4 KiB
C#
53 lines
1.4 KiB
C#
// Licensed to the .NET Foundation under one or more agreements.
|
|
// The .NET Foundation licenses this file to you under the MIT license.
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
|
|
namespace MagMan.UI.Shared
|
|
{
|
|
public partial class NavMenu
|
|
{
|
|
|
|
|
|
[CascadingParameter]
|
|
private Task<AuthenticationState> AuthenticationStateTask { get; set; }
|
|
|
|
private bool collapseNavMenu = true;
|
|
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
|
protected bool showText { get; set; } = true;
|
|
private string userName = "";
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
|
var user = authState.User;
|
|
if (user.Identity.IsAuthenticated)
|
|
{
|
|
userName = $"{user.Identity.Name}";
|
|
}
|
|
else
|
|
{
|
|
userName = "Non Autenticato";
|
|
}
|
|
}
|
|
|
|
private void ToggleNavMenu()
|
|
{
|
|
collapseNavMenu = !collapseNavMenu;
|
|
}
|
|
protected string hideText
|
|
{
|
|
get => showText ? "" : "invisible";
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<bool> EC_compressUpdated { get; set; }
|
|
|
|
#if DEBUG
|
|
protected bool isDebug = true;
|
|
#else
|
|
protected bool isDebug = false;
|
|
#endif
|
|
|
|
}
|
|
} |