59 lines
2.0 KiB
Plaintext
59 lines
2.0 KiB
Plaintext
@rendermode InteractiveServer
|
|
|
|
@using BlazorStrap
|
|
@using BlazorStrap.V5
|
|
@using HopFrame.Security.Claims
|
|
@using HopFrame.Web.Pages.Administration.Components
|
|
@using HopFrame.Web.Services
|
|
@using static Microsoft.AspNetCore.Components.Web.RenderMode
|
|
|
|
|
|
<BSNavbar Color="BSColor.Dark" IsDark="true" IsFixedTop="true">
|
|
<BSContainer Container="Container.Fluid">
|
|
<BSNavbarBrand>
|
|
<img src="/favicon.png" alt="logo" width="30" class="d-inline-block align-text-top"/>
|
|
HopFrame
|
|
</BSNavbarBrand>
|
|
<BSCollapse IsInNavbar="true">
|
|
<Toggler>
|
|
<BSNavbarToggle/>
|
|
</Toggler>
|
|
<Content>
|
|
<BSNav MarginEnd="Margins.Auto" MarginBottom="Margins.Small" Class="mb-lg-0">
|
|
@foreach (var nav in Subpages) {
|
|
<BSNavItem IsActive="IsNavItemActive(nav.Key)" Url="@nav.Key">@nav.Value</BSNavItem>
|
|
}
|
|
</BSNav>
|
|
|
|
<span style="margin-left: auto; line-height: 100%; color: white">
|
|
logged in as @Context?.User.Username
|
|
</span>
|
|
<BSButton DataId="logout" Size="Size.ExtraSmall" OnClick="Logout" Color="BSColor.Dark">
|
|
<HopIconDisplay Type="HopIconDisplay.HopIcon.Logout"/>
|
|
</BSButton>
|
|
<BSTooltip Placement="Placement.Bottom" Target="logout" ContentAlwaysRendered="false">logout</BSTooltip>
|
|
</Content>
|
|
</BSCollapse>
|
|
</BSContainer>
|
|
</BSNavbar>
|
|
|
|
|
|
@inject NavigationManager Navigator
|
|
@inject ITokenContext Context
|
|
@inject IAuthService Auth
|
|
|
|
@code {
|
|
public static IDictionary<string, string> Subpages = new Dictionary<string, string> {
|
|
{ "administration/users", "Users" },
|
|
{ "administration/groups", "Groups" }
|
|
};
|
|
|
|
public bool IsNavItemActive(string element) {
|
|
return Navigator.Uri.Contains(element);
|
|
}
|
|
|
|
private async void Logout() {
|
|
Navigator.NavigateTo("login?redirect=/administration", true);
|
|
}
|
|
}
|