mod layout
This commit is contained in:
parent
d8c41ad712
commit
9491ff26d8
|
|
@ -1,5 +1,8 @@
|
|||
@inherits FluxorLayout
|
||||
|
||||
@inject IState<AuthState> AuthState
|
||||
@inject IDispatcher Dispatcher
|
||||
|
||||
<AuthStateInitializer />
|
||||
|
||||
@* Required *@
|
||||
|
|
@ -12,7 +15,35 @@
|
|||
@* Needed for snackbars *@
|
||||
<MudSnackbarProvider />
|
||||
|
||||
@Body
|
||||
<MudLayout>
|
||||
|
||||
<MudAppBar Elevation="1" Dense="true">
|
||||
</MudAppBar>
|
||||
|
||||
<MudDrawer @bind-Open="_drawerOpen"
|
||||
ClipMode="DrawerClipMode.Always"
|
||||
Elevation="2"
|
||||
Variant="@DrawerVariant.Mini"
|
||||
OpenMiniOnHover="true">
|
||||
<NavMenu/>
|
||||
</MudDrawer>
|
||||
|
||||
<MudMainContent>
|
||||
<MudContainer MaxWidth="MaxWidth.ExtraLarge" Class="py-4">
|
||||
@if (AuthState.Value.Error is not null)
|
||||
{
|
||||
<MudAlert Severity="Severity.Error"
|
||||
Class="mb-4"
|
||||
ShowCloseIcon="true"
|
||||
CloseIconClicked="@ClearAuthError">
|
||||
@AuthState.Value.Error
|
||||
</MudAlert>
|
||||
}
|
||||
@Body
|
||||
</MudContainer>
|
||||
</MudMainContent>
|
||||
</MudLayout>
|
||||
|
||||
|
||||
<div id="blazor-error-ui" data-nosnippet>
|
||||
An unhandled error has occurred.
|
||||
|
|
@ -23,6 +54,8 @@
|
|||
|
||||
@code
|
||||
{
|
||||
private bool _drawerOpen = true;
|
||||
|
||||
private bool _isDarkMode = false;
|
||||
|
||||
private readonly MudTheme _theme = new()
|
||||
|
|
@ -63,7 +96,12 @@
|
|||
// }
|
||||
};
|
||||
|
||||
// private void ToggleDrawer() => _drawerOpen = !_drawerOpen;
|
||||
private void ClearAuthError()
|
||||
{
|
||||
Dispatcher.Dispatch(new ClearAuthErrorAction());
|
||||
}
|
||||
|
||||
private void ToggleDrawer() => _drawerOpen = !_drawerOpen;
|
||||
|
||||
private void ToggleDarkMode() => _isDarkMode = !_isDarkMode;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
@inherits FluxorComponent
|
||||
|
||||
@inject IState<AuthState> AuthState
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
<MudNavMenu>
|
||||
@if (AuthState.Value.IsClubEditor || AuthState.Value.IsSuperAdmin)
|
||||
{
|
||||
@* // Tage und Auswertungen des ausgewählten Vereins *@
|
||||
|
||||
|
||||
<MudDivider Class="my-2" />
|
||||
|
||||
<MudNavGroup Title="Administration"
|
||||
Icon="@Icons.Material.Filled.AdminPanelSettings"
|
||||
Expanded="false">
|
||||
|
||||
@* // Stammdaten des ausgewählten Vereins *@
|
||||
|
||||
@* // mandantenübergreifende Verwaltung *@
|
||||
@if (AuthState.Value.IsSuperAdmin)
|
||||
{
|
||||
<MudNavLink Href="/admin/clubs"
|
||||
Match="NavLinkMatch.Prefix"
|
||||
Icon="@Icons.Material.Filled.People">
|
||||
Vereine verwalten
|
||||
</MudNavLink>
|
||||
}
|
||||
|
||||
</MudNavGroup>
|
||||
}
|
||||
</MudNavMenu>
|
||||
|
||||
@code {
|
||||
|
||||
}
|
||||
|
|
@ -22,4 +22,9 @@ namespace Koogle.Web.Store.AuthState
|
|||
/// Action to initialize authentication state (load current user and permissions).
|
||||
/// </summary>
|
||||
public record InitializeAuthAction;
|
||||
|
||||
/// <summary>
|
||||
/// Action to clear the current error message.
|
||||
/// </summary>
|
||||
public record ClearAuthErrorAction;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,4 +66,14 @@ public static class AuthReducers
|
|||
IsLoading = false,
|
||||
IsAuthenticated = false
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ClearAuthErrorAction.
|
||||
/// </summary>
|
||||
[ReducerMethod(typeof(ClearAuthErrorAction))]
|
||||
public static AuthState OnClearError(AuthState state)
|
||||
=> state with
|
||||
{
|
||||
Error = null
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ public record AuthState
|
|||
/// </summary>
|
||||
public bool IsAuthenticated { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Error message if authentication failed.
|
||||
/// </summary>
|
||||
public string? Error { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// The current user's data.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<ItemGroup>
|
||||
<ProjectReference Include="..\Koogle.Application\Koogle.Application.csproj" />
|
||||
<ProjectReference Include="..\Koogle.Domain\Koogle.Domain.csproj" />
|
||||
<ProjectReference Include="..\Koogle.Infrastrcuture\Koogle.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\Koogle.Infrastructure\Koogle.Infrastructure.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue