Updated sidebar and header

This commit is contained in:
2025-03-30 17:54:07 +02:00
parent 3f511cefa8
commit e1c0722fce
5 changed files with 238 additions and 254 deletions

View File

@@ -1,57 +1,28 @@
@using MoonCore.Exceptions
@using Moonlight.Client.Interfaces
@using Moonlight.Client.Services
@using Moonlight.Client.UI.Partials
@using Moonlight.Shared.Misc
@using Moonlight.Client.UI.Components
@using Moonlight.Client.UI.Partials
@using MoonCore.Blazor.Tailwind.Toasts
@using MoonCore.Blazor.Tailwind.Modals
@inherits LayoutComponentBase
@inject IServiceProvider ServiceProvider
@inject ILogger<MainLayout> Logger
@inject FrontendConfiguration Configuration
<PageTitle>@Configuration.Title</PageTitle>
<ThemeLoader />
@if (IsLoading)
{
<div class="h-full w-full min-h-[100dvh] flex items-center justify-center">
<div id="loader"></div>
</div>
}
else if (CurrentScreen != null)
{
<CascadingValue Value="this" IsFixed="true">
@CurrentScreen
</CascadingValue>
}
else
{
<div>
<AppSidebar Layout="this"/>
<div class="lg:pl-72">
<AppHeader Layout="this"/>
<main class="py-10">
<div class="px-4 sm:px-6 lg:px-8">
<CascadingValue Value="this" IsFixed="true">
@Body
</CascadingValue>
</div>
</main>
<div class="relative isolate flex min-h-svh w-full max-lg:flex-col bg-gray-950">
<AppSidebar Layout="this"/>
<AppHeader Layout="this" />
<main class="flex flex-1 flex-col lg:pb-5 lg:min-w-0 lg:pt-5 lg:pr-3.5 lg:pl-64">
<div class="grow p-6 lg:rounded-lg lg:p-10 lg:ring-1 lg:shadow-xs lg:bg-gray-900 lg:ring-white/10">
<div class="mx-auto max-w-7xl">
<CascadingValue Value="this" IsFixed="true">
@Body
</CascadingValue>
</div>
</div>
</div>
}
</main>
</div>
<ToastLauncher/>
<ModalLauncher/>
@code
{
// Mobile navigation
@@ -63,26 +34,4 @@ else
ShowMobileNavigation = !ShowMobileNavigation;
await OnStateChanged();
}
// App loaders & screens
private bool IsLoading = true;
private RenderFragment? CurrentScreen;
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (!firstRender)
return;
await Load();
}
public async Task Load()
{
IsLoading = true;
await InvokeAsync(StateHasChanged);
//
IsLoading = false;
await InvokeAsync(StateHasChanged);
}
}