diff --git a/src/Recyclarr.Gui/App.razor b/src/Recyclarr.Gui/App.razor new file mode 100644 index 00000000..843f201a --- /dev/null +++ b/src/Recyclarr.Gui/App.razor @@ -0,0 +1,11 @@ + + + + + + Not found + +

Sorry, there's nothing at this address.

+
+
+
\ No newline at end of file diff --git a/src/Recyclarr.Gui/Data/WeatherForecast.cs b/src/Recyclarr.Gui/Data/WeatherForecast.cs new file mode 100644 index 00000000..7c713e66 --- /dev/null +++ b/src/Recyclarr.Gui/Data/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace Recyclarr.Gui.Data +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} diff --git a/src/Recyclarr.Gui/Data/WeatherForecastService.cs b/src/Recyclarr.Gui/Data/WeatherForecastService.cs new file mode 100644 index 00000000..f30bb10d --- /dev/null +++ b/src/Recyclarr.Gui/Data/WeatherForecastService.cs @@ -0,0 +1,21 @@ +namespace Recyclarr.Gui.Data +{ + public class WeatherForecastService + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + public Task GetForecastAsync(DateTime startDate) + { + var rng = new Random(); + return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = startDate.AddDays(index), + TemperatureC = rng.Next(-20, 55), + Summary = Summaries[rng.Next(Summaries.Length)] + }).ToArray()); + } + } +} diff --git a/src/Recyclarr.Gui/Pages/Counter.razor b/src/Recyclarr.Gui/Pages/Counter.razor new file mode 100644 index 00000000..0cc164c3 --- /dev/null +++ b/src/Recyclarr.Gui/Pages/Counter.razor @@ -0,0 +1,17 @@ +@page "/counter" + +Counter + +Counter +Current count: @currentCount +Click me + + +@code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } +} diff --git a/src/Recyclarr.Gui/Pages/Error.cshtml b/src/Recyclarr.Gui/Pages/Error.cshtml new file mode 100644 index 00000000..d82ecac4 --- /dev/null +++ b/src/Recyclarr.Gui/Pages/Error.cshtml @@ -0,0 +1,42 @@ +@page +@model Recyclarr.Gui.Pages.ErrorModel + + + + + + + + Error + + + + + +
+
+

Error.

+

An error occurred while processing your request.

+ + @if (Model.ShowRequestId) + { +

+ Request ID: @Model.RequestId +

+ } + +

Development Mode

+

+ Swapping to the Development environment displays detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+
+
+ + + diff --git a/src/Recyclarr.Gui/Pages/Error.cshtml.cs b/src/Recyclarr.Gui/Pages/Error.cshtml.cs new file mode 100644 index 00000000..1f214afd --- /dev/null +++ b/src/Recyclarr.Gui/Pages/Error.cshtml.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Diagnostics; + +namespace Recyclarr.Gui.Pages +{ + [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] + [IgnoreAntiforgeryToken] + public class ErrorModel : PageModel + { + public string? RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + private readonly ILogger _logger; + + public ErrorModel(ILogger logger) + { + _logger = logger; + } + + public void OnGet() + { + RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; + } + } +} diff --git a/src/Recyclarr.Gui/Pages/FetchData.razor b/src/Recyclarr.Gui/Pages/FetchData.razor new file mode 100644 index 00000000..6b41e6bc --- /dev/null +++ b/src/Recyclarr.Gui/Pages/FetchData.razor @@ -0,0 +1,42 @@ +@page "/fetchdata" +@using Recyclarr.Gui.Data +@inject WeatherForecastService ForecastService + +Weather forecast + +Weather forecast +This component demonstrates fetching data from the server. +@if (forecasts == null) +{ + +} +else +{ + + + Date + Temp. (C) + Temp. (F) + Summary + + + @context.Date + @context.TemperatureC + @context.TemperatureF + @context.Summary + + + + + +} + + +@code { + private WeatherForecast[]? forecasts; + + protected override async Task OnInitializedAsync() + { + forecasts = await ForecastService.GetForecastAsync(DateTime.Now); + } +} diff --git a/src/Recyclarr.Gui/Pages/Index.razor b/src/Recyclarr.Gui/Pages/Index.razor new file mode 100644 index 00000000..7994d546 --- /dev/null +++ b/src/Recyclarr.Gui/Pages/Index.razor @@ -0,0 +1,7 @@ +@page "/" + +Index + +Hello, world! +Welcome to your new app, powered by MudBlazor! +You can find documentation and examples on our website here: www.mudblazor.com diff --git a/src/Recyclarr.Gui/Pages/_Host.cshtml b/src/Recyclarr.Gui/Pages/_Host.cshtml new file mode 100644 index 00000000..6d282722 --- /dev/null +++ b/src/Recyclarr.Gui/Pages/_Host.cshtml @@ -0,0 +1,8 @@ +@page "/" +@namespace Recyclarr.Gui.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@{ + Layout = "_Layout"; +} + + \ No newline at end of file diff --git a/src/Recyclarr.Gui/Pages/_Layout.cshtml b/src/Recyclarr.Gui/Pages/_Layout.cshtml new file mode 100644 index 00000000..32673979 --- /dev/null +++ b/src/Recyclarr.Gui/Pages/_Layout.cshtml @@ -0,0 +1,31 @@ +@using Microsoft.AspNetCore.Components.Web +@namespace Recyclarr.Gui.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers + + + + + + + + + + + + + @RenderBody() + +
+ + An error has occurred. This application may no longer respond until reloaded. + + + An unhandled exception has occurred. See browser dev tools for details. + + Reload + 🗙 +
+ + + + diff --git a/src/Recyclarr.Gui/Program.cs b/src/Recyclarr.Gui/Program.cs new file mode 100644 index 00000000..9c3b0abd --- /dev/null +++ b/src/Recyclarr.Gui/Program.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Web; +using Recyclarr.Gui.Data; +using MudBlazor.Services; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. +builder.Services.AddRazorPages(); +builder.Services.AddServerSideBlazor(); +builder.Services.AddSingleton(); +builder.Services.AddMudServices(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); + +app.UseStaticFiles(); + +app.UseRouting(); + +app.MapBlazorHub(); +app.MapFallbackToPage("/_Host"); + +app.Run(); \ No newline at end of file diff --git a/src/Recyclarr.Gui/Properties/launchSettings.json b/src/Recyclarr.Gui/Properties/launchSettings.json new file mode 100644 index 00000000..8a8f3b2b --- /dev/null +++ b/src/Recyclarr.Gui/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61949", + "sslPort": 44393 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Recyclarr.Gui": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/Recyclarr.Gui/Recyclarr.Gui.csproj b/src/Recyclarr.Gui/Recyclarr.Gui.csproj new file mode 100644 index 00000000..d675fc56 --- /dev/null +++ b/src/Recyclarr.Gui/Recyclarr.Gui.csproj @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/Recyclarr.Gui/Shared/MainLayout.razor b/src/Recyclarr.Gui/Shared/MainLayout.razor new file mode 100644 index 00000000..926047b8 --- /dev/null +++ b/src/Recyclarr.Gui/Shared/MainLayout.razor @@ -0,0 +1,34 @@ +@inherits LayoutComponentBase + + + + + + + + + + + + + + + Recyclarr.Gui + + + + + + @Body + + + + +@code { + bool _drawerOpen = true; + + void DrawerToggle() + { + _drawerOpen = !_drawerOpen; + } +} \ No newline at end of file diff --git a/src/Recyclarr.Gui/Shared/NavMenu.razor b/src/Recyclarr.Gui/Shared/NavMenu.razor new file mode 100644 index 00000000..07724847 --- /dev/null +++ b/src/Recyclarr.Gui/Shared/NavMenu.razor @@ -0,0 +1,5 @@ + + Home + Counter + Fetch data + diff --git a/src/Recyclarr.Gui/_Imports.razor b/src/Recyclarr.Gui/_Imports.razor new file mode 100644 index 00000000..4914d1a5 --- /dev/null +++ b/src/Recyclarr.Gui/_Imports.razor @@ -0,0 +1,11 @@ +@using System.Net.Http +@using Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Components.Authorization +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using MudBlazor +@using Recyclarr.Gui +@using Recyclarr.Gui.Shared diff --git a/src/Recyclarr.Gui/appsettings.Development.json b/src/Recyclarr.Gui/appsettings.Development.json new file mode 100644 index 00000000..51737579 --- /dev/null +++ b/src/Recyclarr.Gui/appsettings.Development.json @@ -0,0 +1,10 @@ +{ + "DetailedErrors": true, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/src/Recyclarr.Gui/appsettings.json b/src/Recyclarr.Gui/appsettings.json new file mode 100644 index 00000000..d9d9a9bf --- /dev/null +++ b/src/Recyclarr.Gui/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/src/Recyclarr.Gui/wwwroot/favicon.ico b/src/Recyclarr.Gui/wwwroot/favicon.ico new file mode 100644 index 00000000..47ad60e4 Binary files /dev/null and b/src/Recyclarr.Gui/wwwroot/favicon.ico differ diff --git a/src/Recyclarr.sln b/src/Recyclarr.sln index a4cd94ea..c4925c7f 100644 --- a/src/Recyclarr.sln +++ b/src/Recyclarr.sln @@ -31,6 +31,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersionControl.Tests", "Ver EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Recyclarr.TestLibrary", "Recyclarr.TestLibrary\Recyclarr.TestLibrary.csproj", "{77D1C695-94D4-46A9-8F12-41E54AF97750}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Recyclarr.Gui", "Recyclarr.Gui\Recyclarr.Gui.csproj", "{53EECBC0-E0EA-4D6C-925C-5DB8C42CCB85}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -85,6 +87,10 @@ Global {77D1C695-94D4-46A9-8F12-41E54AF97750}.Debug|Any CPU.Build.0 = Debug|Any CPU {77D1C695-94D4-46A9-8F12-41E54AF97750}.Release|Any CPU.ActiveCfg = Release|Any CPU {77D1C695-94D4-46A9-8F12-41E54AF97750}.Release|Any CPU.Build.0 = Release|Any CPU + {53EECBC0-E0EA-4D6C-925C-5DB8C42CCB85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {53EECBC0-E0EA-4D6C-925C-5DB8C42CCB85}.Debug|Any CPU.Build.0 = Debug|Any CPU + {53EECBC0-E0EA-4D6C-925C-5DB8C42CCB85}.Release|Any CPU.ActiveCfg = Release|Any CPU + {53EECBC0-E0EA-4D6C-925C-5DB8C42CCB85}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution EndGlobalSection