Refactored pages to correct locations
This commit is contained in:
9
Moonlight.Frontend/UI/Shared/Partials/AppHeader.razor
Normal file
9
Moonlight.Frontend/UI/Shared/Partials/AppHeader.razor
Normal file
@@ -0,0 +1,9 @@
|
||||
@using ShadcnBlazor.Sidebars
|
||||
|
||||
<header
|
||||
class="flex h-(--header-height) shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear group-has-data-[collapsible=icon]/sidebar-wrapper:h-(--header-height)"
|
||||
style="--header-height: calc(var(--spacing) * 12)">
|
||||
<div class="flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6">
|
||||
<SidebarTrigger ClassName="-ml-1"/>
|
||||
</div>
|
||||
</header>
|
||||
25
Moonlight.Frontend/UI/Shared/Partials/MainLayout.razor
Normal file
25
Moonlight.Frontend/UI/Shared/Partials/MainLayout.razor
Normal file
@@ -0,0 +1,25 @@
|
||||
@using ShadcnBlazor.Extras.AlertDialogs
|
||||
@using ShadcnBlazor.Extras.Alerts
|
||||
@using ShadcnBlazor.Extras.Dialogs
|
||||
@using ShadcnBlazor.Extras.Toasts
|
||||
@using ShadcnBlazor.Sidebars
|
||||
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<SidebarProvider DefaultOpen="true">
|
||||
<AppSidebar/>
|
||||
|
||||
<SidebarInset>
|
||||
<AppHeader/>
|
||||
|
||||
<div class="mx-8 my-8 max-w-full">
|
||||
<AlertLauncher/>
|
||||
|
||||
@Body
|
||||
</div>
|
||||
|
||||
<ToastLauncher/>
|
||||
<DialogLauncher/>
|
||||
<AlertDialogLauncher/>
|
||||
</SidebarInset>
|
||||
</SidebarProvider>
|
||||
76
Moonlight.Frontend/UI/Shared/Partials/NavUser.razor
Normal file
76
Moonlight.Frontend/UI/Shared/Partials/NavUser.razor
Normal file
@@ -0,0 +1,76 @@
|
||||
@using System.Security.Claims
|
||||
@using LucideBlazor
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
@using ShadcnBlazor.Avatars
|
||||
@using ShadcnBlazor.Dropdowns
|
||||
@using ShadcnBlazor.Interop
|
||||
@using ShadcnBlazor.Sidebars
|
||||
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
<SidebarMenu>
|
||||
<SidebarMenuItem>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger>
|
||||
<Slot>
|
||||
<SidebarMenuButton
|
||||
Size="SidebarMenuButtonSize.Lg"
|
||||
ClassName="data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground"
|
||||
@attributes="context">
|
||||
<Avatar className="h-8 w-8 rounded-lg">
|
||||
<AvatarImage src="https://github.com/ghost.png" alt="Ghost"/>
|
||||
<AvatarFallback className="rounded-lg">GH</AvatarFallback>
|
||||
</Avatar>
|
||||
<div class="grid flex-1 text-left text-sm leading-tight">
|
||||
<span class="truncate font-medium">@Username</span>
|
||||
<span class="truncate text-xs">@Email</span>
|
||||
</div>
|
||||
|
||||
<ChevronsUpDownIcon ClassName="ml-auto size-4"/>
|
||||
</SidebarMenuButton>
|
||||
</Slot>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
ClassName="w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg"
|
||||
Side="@(SidebarProvider.IsMobile ? PositionSide.Bottom : PositionSide.Right)"
|
||||
Align="PositionAlignment.End">
|
||||
<DropdownMenuLabel ClassName="p-0 font-normal">
|
||||
<div class="flex items-center gap-2 px-1 py-1.5 text-left text-sm">
|
||||
<Avatar ClassName="h-8 w-8 rounded-lg">
|
||||
<AvatarImage src="https://github.com/ghost.png" alt="Ghost"/>
|
||||
<AvatarFallback className="rounded-lg">GH</AvatarFallback>
|
||||
</Avatar>
|
||||
<div class="grid flex-1 text-left text-sm leading-tight">
|
||||
<span class="truncate font-medium">@Username</span>
|
||||
<span class="truncate text-xs">@Email</span>
|
||||
</div>
|
||||
</div>
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator/>
|
||||
<DropdownMenuItem OnClick="Logout">
|
||||
<LogOutIcon/>
|
||||
Log out
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</SidebarMenuItem>
|
||||
</SidebarMenu>
|
||||
|
||||
@code
|
||||
{
|
||||
[CascadingParameter] public SidebarProvider SidebarProvider { get; set; }
|
||||
[CascadingParameter] public Task<AuthenticationState> AuthState { get; set; }
|
||||
|
||||
private string Username;
|
||||
private string Email;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var authState = await AuthState;
|
||||
|
||||
Username = authState.User.FindFirst(ClaimTypes.Name)?.Value ?? "N/A";
|
||||
Email = authState.User.FindFirst(ClaimTypes.Email)?.Value ?? "N/A";
|
||||
}
|
||||
|
||||
private void Logout() => Navigation.NavigateTo("/api/auth/logout", true);
|
||||
}
|
||||
Reference in New Issue
Block a user