@using GWMS.UI.Components
@using Microsoft.AspNetCore.Components.Authorization
@inject AuthenticationStateProvider AuthenticationStateProvider
@code {
[CascadingParameter]
private Task AuthenticationStateTask { get; set; }
private bool collapseNavMenu = true;
private string userName = "";
private string NavMenuCssClass => collapseNavMenu ? "collapse" : null;
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 bool showText { get; set; } = true;
protected void ToggleCompress()
{
showText = !showText;
EC_compressUpdated.InvokeAsync(showText);
}
protected string hideText
{
get => showText ? "" : "invisible";
}
[Parameter]
public EventCallback EC_compressUpdated { get; set; }
}