2023-02-11 22:04:02 +00:00
|
|
|
@using ImageBoardServerApp.Auth
|
2023-03-01 13:44:06 +00:00
|
|
|
@using ImageBoardServerApp.Data.Repository
|
2023-02-11 22:04:02 +00:00
|
|
|
@inject AuthenticationStateProvider authStateProvider
|
|
|
|
@inject NavigationManager navManager
|
|
|
|
|
|
|
|
<div class="top-row ps-3 navbar navbar-dark">
|
2023-01-18 12:56:24 +00:00
|
|
|
<div class="container-fluid">
|
2023-05-31 12:13:18 +00:00
|
|
|
<img src="img/static/logo_trans.png" width="32" height="32" alt="Logo"/>
|
|
|
|
<a class="navbar-brand" href="/">BulletBoard</a>
|
2023-01-18 12:56:24 +00:00
|
|
|
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
|
|
|
|
<span class="navbar-toggler-icon"></span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
|
|
|
|
<nav class="flex-column">
|
2023-05-31 12:13:18 +00:00
|
|
|
<div class="nav-item px-3">
|
|
|
|
<NavLink class="nav-link" href="/" Match="NavLinkMatch.All">
|
|
|
|
<span class="oi oi-home" aria-hidden="true"></span> Home
|
|
|
|
</NavLink>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<text class="topicTitle">
|
|
|
|
Boards
|
|
|
|
</text>
|
2023-03-01 13:44:06 +00:00
|
|
|
@foreach (BoardData b in boards)
|
|
|
|
{
|
|
|
|
<div class="nav-item px-3">
|
2023-05-31 12:13:18 +00:00
|
|
|
<NavLink class="nav-link" href="@b.Tag" Match="NavLinkMatch.All">
|
|
|
|
<span class="oi oi-chat" aria-hidden="true"></span> /@b.Tag/ - @b.Topic
|
2023-03-01 13:44:06 +00:00
|
|
|
</NavLink>
|
|
|
|
</div>
|
|
|
|
}
|
2023-05-31 12:13:18 +00:00
|
|
|
|
|
|
|
<div class="account">
|
|
|
|
<text class="topicTitle">
|
|
|
|
Account
|
|
|
|
</text>
|
|
|
|
<AuthorizeView>
|
|
|
|
<Authorized>
|
|
|
|
<div class="nav-item px-3">
|
|
|
|
<NavLink class="nav-link" href="/sys/you" Match="NavLinkMatch.All">
|
|
|
|
<span class="oi oi-cog" aria-hidden="true"></span> Account Settings
|
|
|
|
</NavLink>
|
|
|
|
</div>
|
|
|
|
<div class="nav-item px-3">
|
|
|
|
<NavLink class="nav-link" href="/" @onclick="logout" Match="NavLinkMatch.All">
|
|
|
|
<span class="oi oi-account-logout" aria-hidden="true"></span> Logout
|
|
|
|
</NavLink>
|
|
|
|
</div>
|
|
|
|
</Authorized>
|
|
|
|
<NotAuthorized>
|
|
|
|
<div class="nav-item px-3">
|
|
|
|
<NavLink class="nav-link" href="/sys/login" Match="NavLinkMatch.All">
|
|
|
|
<span class="oi oi-account-login" aria-hidden="true"></span> Login
|
|
|
|
</NavLink>
|
|
|
|
</div>
|
|
|
|
<div class="nav-item px-3">
|
|
|
|
<NavLink class="nav-link" href="/sys/register" Match="NavLinkMatch.All">
|
|
|
|
<span class="oi oi-plus" aria-hidden="true"></span> Register
|
|
|
|
</NavLink>
|
|
|
|
</div>
|
|
|
|
</NotAuthorized>
|
|
|
|
</AuthorizeView>
|
|
|
|
</div>
|
2023-01-18 12:56:24 +00:00
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
@code {
|
|
|
|
private bool collapseNavMenu = true;
|
|
|
|
|
|
|
|
private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;
|
|
|
|
|
|
|
|
private void ToggleNavMenu()
|
|
|
|
{
|
|
|
|
collapseNavMenu = !collapseNavMenu;
|
|
|
|
}
|
2023-02-11 22:04:02 +00:00
|
|
|
|
|
|
|
private async Task logout()
|
|
|
|
{
|
|
|
|
var customAuthStateProvider = (CustomAuthenticationStateProvider) authStateProvider;
|
|
|
|
await customAuthStateProvider.UpdateAuthenticationStateAsync(null);
|
|
|
|
navManager.NavigateTo("/", true);
|
|
|
|
}
|
2023-03-01 13:44:06 +00:00
|
|
|
|
|
|
|
public List<BoardData> boards { get; set; }
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
|
|
|
boards = await BoardsRepository.getBoardsAsync();
|
|
|
|
}
|
|
|
|
|
2023-01-18 12:56:24 +00:00
|
|
|
}
|