[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,22 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Application</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<base href="/"/>
<link rel="stylesheet" href="app.css"/>
<link rel="icon" type="image/png" href="favicon.png"/>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet"/>
<link href="_content/MudBlazor/MudBlazor.min.css?v=@Metadata.Version" rel="stylesheet"/>
<HeadOutlet/>
</head>
<body>
<Routes @rendermode="InteractiveServer"/>
<script src="_framework/blazor.web.js"></script>
<script src="_content/MudBlazor/MudBlazor.min.js?v=@Metadata.Version"></script>
</body>
</html>

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>

View File

@@ -0,0 +1,36 @@
@page "/Error"
@using System.Diagnostics
<PageTitle>Error</PageTitle>
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
@code{
[CascadingParameter] private HttpContext? HttpContext { get; set; }
private string? RequestId { get; set; }
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
protected override void OnInitialized() =>
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier;
}

View File

@@ -0,0 +1,3 @@
@page "/"
<PageTitle>Home</PageTitle>

View File

@@ -0,0 +1,6 @@
<Router AppAssembly="typeof(Program).Assembly">
<Found Context="routeData">
<RouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)"/>
<FocusOnNavigate RouteData="routeData" Selector="h1"/>
</Found>
</Router>

View File

@@ -0,0 +1,13 @@
@using System.Net.Http
@using System.Net.Http.Json
@using Microsoft.AspNetCore.Components.Forms
@using Microsoft.AspNetCore.Components.Routing
@using Microsoft.AspNetCore.Components.Web
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using Manager.App
@using Manager.App.Components
@* MudBlazor *@
@using MudBlazor