[REFACTOR] Name change projects and solution

This commit is contained in:
max
2025-08-10 22:41:36 +02:00
parent 3649d4fad4
commit 9edd0690cf
28 changed files with 70 additions and 31 deletions

View File

@@ -0,0 +1,20 @@
@inherits LayoutComponentBase
@layout BaseLayout
<CascadingValue Value="this">
<MudAppBar Color="Color.Primary">
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@(_ => ToggleDrawerOpen())" />
<MudText Typo="Typo.h6">@AppText</MudText>
<MudSpacer/>
<MudTooltip Text="Gitea source">
<MudIconButton Icon="@Icons.Material.Filled.Source" Href="https://git.netzbyte.com/max/Yt-Import" Target="_blank"/>
</MudTooltip>
@if (BaseLayout != null)
{
<MudTooltip Text="@(BaseLayout.DarkTheme ? "Toggle to light mode" : "Toggle to dark mode")">
<MudToggleIconButton @bind-Toggled="@BaseLayout.DarkTheme" Color="Color.Dark" ToggledColor="Color.Warning" Icon="@Icons.Material.Filled.DarkMode" ToggledIcon="@Icons.Material.Filled.LightMode"/>
</MudTooltip>
}
</MudAppBar>
@Body
</CascadingValue>

View File

@@ -0,0 +1,16 @@
using Microsoft.AspNetCore.Components;
namespace Manager.App.Components.Layout;
public partial class ApplicationLayout
{
[CascadingParameter]
public BaseLayout? BaseLayout { get; set; }
public bool DrawerOpen { get; set; } = true;
public string AppText { get; set; } = "YouTube Import";
private void ToggleDrawerOpen()
{
DrawerOpen = !DrawerOpen;
}
}

View File

@@ -0,0 +1,20 @@
@inherits LayoutComponentBase
<MudThemeProvider @ref="@_themeProvider" Theme="@_mudTheme" IsDarkMode="@DarkTheme"/>
<MudPopoverProvider />
<MudDialogProvider/>
<MudSnackbarProvider/>
<CascadingValue Value="this">
<MudLayout>
<MudMainContent>
@Body
</MudMainContent>
</MudLayout>
</CascadingValue>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>

View File

@@ -0,0 +1,37 @@
using Microsoft.AspNetCore.Components;
using MudBlazor;
namespace Manager.App.Components.Layout;
public partial class BaseLayout
{
private readonly MudTheme _mudTheme = new MudTheme();
private MudThemeProvider? _themeProvider;
private bool _isDarkTheme = true;
public event EventHandler<bool>? OnDarkThemeChanged;
public bool DarkTheme
{
get => _isDarkTheme;
set
{
_isDarkTheme = value;
ThemeChanged();
}
}
private void ThemeChanged()
{
StateHasChanged();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender && _themeProvider != null)
{
DarkTheme = await _themeProvider.GetSystemDarkModeAsync();
_themeProvider.IsDarkModeChanged = EventCallback.Factory.Create<bool>(this, x => OnDarkThemeChanged?.Invoke(this, x));
}
}
}

View File

@@ -0,0 +1,18 @@
#blazor-error-ui {
background: lightyellow;
bottom: 0;
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
display: none;
left: 0;
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
position: fixed;
width: 100%;
z-index: 1000;
}
#blazor-error-ui .dismiss {
cursor: pointer;
position: absolute;
right: 0.75rem;
top: 0.5rem;
}

View File

@@ -0,0 +1,16 @@
@inherits LayoutComponentBase
@layout ApplicationLayout
@if (ApplicationLayout != null)
{
<MudDrawer @bind-Open="@ApplicationLayout.DrawerOpen" ClipMode="DrawerClipMode.Always">
<NavMenu/>
<MudSpacer/>
</MudDrawer>
}
else
{
<MudAlert Severity="Severity.Error" Variant="Variant.Outlined">Error getting cascading parameter 'ApplicationLayout'!</MudAlert>
}
@Body

View File

@@ -0,0 +1,9 @@
using Microsoft.AspNetCore.Components;
namespace Manager.App.Components.Layout;
public partial class MainLayout
{
[CascadingParameter]
public ApplicationLayout? ApplicationLayout { get; set; }
}

View File

@@ -0,0 +1,10 @@
.page {
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
}

View File

@@ -0,0 +1,9 @@

<MudNavMenu>
<MudText Typo="Typo.h6" Class="px-4">YouTube Import</MudText>
<MudDivider Class="my-2"/>
<MudNavLink Href="/" Match="NavLinkMatch.Prefix">Home</MudNavLink>
<MudNavLink Href="/Accounts" Match="NavLinkMatch.All">Accounts</MudNavLink>
<MudNavLink Href="/Library" Match="NavLinkMatch.All">Library</MudNavLink>
<MudNavLink Href="/Playlists" Match="NavLinkMatch.All">Playlists</MudNavLink>
</MudNavMenu>