Files
hcs/Hcs.WebApp/Components/Layout/MainLayout.razor

73 lines
2.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@inherits LayoutComponentBase
@implements IDisposable
@inject NavigationManager NavigationManager
@inject NotificationService NotificationService
<RadzenLayout Style="grid-template-areas: 'rz-sidebar rz-header' 'rz-sidebar rz-body'">
<RadzenHeader>
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" Gap="0">
<RadzenSidebarToggle Click="@(() => sidebarExpanded = !sidebarExpanded)" />
<RadzenLabel Text="Система автоматической интеграции с ГИС ЖКХ" />
</RadzenStack>
</RadzenHeader>
<RadzenSidebar @bind-Expanded="@sidebarExpanded">
<RadzenStack Style="height: 100%" JustifyContent="JustifyContent.SpaceBetween">
<RadzenPanelMenu>
<RadzenPanelMenuItem Path="/" Text="Главная" Icon="home" />
<RadzenPanelMenuItem Text="Тестирование" Icon="simulation">
<RadzenPanelMenuItem Path="/test/export" Text="Экспорт" Icon="arrow_outward" />
</RadzenPanelMenuItem>
</RadzenPanelMenu>
<RadzenPanelMenu>
<AuthorizeView>
<Authorized>
<RadzenPanelMenuItem Text="@context.User.Identity?.Name" />
<RadzenPanelMenuItem Path="/identity/logout" Text="Выйти" Icon="logout" />
</Authorized>
<NotAuthorized>
<RadzenPanelMenuItem Path="/account/register" Text="Регистрация" Icon="person_add" />
<RadzenPanelMenuItem Path="/account/login" Text="Вход" Icon="login" />
</NotAuthorized>
</AuthorizeView>
</RadzenPanelMenu>
</RadzenStack>
</RadzenSidebar>
<RadzenBody>
<RadzenNotification Style="position: absolute;top: 0; right: 0;" />
@Body
<div id="blazor-error-ui">
Произошла непредвиденная ошибка
<a href="" class="reload">Перезагрузить</a>
<a class="dismiss">🗙</a>
</div>
</RadzenBody>
</RadzenLayout>
@code {
bool sidebarExpanded = true;
string? currentUrl;
protected override void OnInitialized()
{
currentUrl = NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
NavigationManager.LocationChanged += OnLocationChanged;
}
public void Dispose()
{
NavigationManager.LocationChanged -= OnLocationChanged;
}
private void OnLocationChanged(object? sender, LocationChangedEventArgs e)
{
currentUrl = NavigationManager.ToBaseRelativePath(e.Location);
NotificationService.Messages.Clear();
StateHasChanged();
}
}