commit 4448378bcf1e580a0c65f4f6289d7f82cf1a1ba3 Author: daniel-c-harvey Date: Sat Aug 30 01:04:19 2025 -0400 Initial MudBlazor app diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3d8a696 --- /dev/null +++ b/.gitignore @@ -0,0 +1,295 @@ +bin/ +obj/ +/packages/ +riderModule.iml +/_ReSharper.Caches/ + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +# VS Code +.vscode/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Typescript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs \ No newline at end of file diff --git a/DeepDrftHome.sln b/DeepDrftHome.sln new file mode 100644 index 0000000..d5d4a6a --- /dev/null +++ b/DeepDrftHome.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftWeb", "DeepDrftWeb\DeepDrftWeb\DeepDrftWeb.csproj", "{7E629215-7EF7-465D-B7F2-2CED53C4BFEC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeepDrftWeb.Client", "DeepDrftWeb\DeepDrftWeb.Client\DeepDrftWeb.Client.csproj", "{E76D21B4-308B-487B-B8D6-59D6AE49F1F7}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7E629215-7EF7-465D-B7F2-2CED53C4BFEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E629215-7EF7-465D-B7F2-2CED53C4BFEC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E629215-7EF7-465D-B7F2-2CED53C4BFEC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E629215-7EF7-465D-B7F2-2CED53C4BFEC}.Release|Any CPU.Build.0 = Release|Any CPU + {E76D21B4-308B-487B-B8D6-59D6AE49F1F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E76D21B4-308B-487B-B8D6-59D6AE49F1F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E76D21B4-308B-487B-B8D6-59D6AE49F1F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E76D21B4-308B-487B-B8D6-59D6AE49F1F7}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/DeepDrftWeb/DeepDrftWeb.Client/DeepDrftWeb.Client.csproj b/DeepDrftWeb/DeepDrftWeb.Client/DeepDrftWeb.Client.csproj new file mode 100644 index 0000000..a997134 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/DeepDrftWeb.Client.csproj @@ -0,0 +1,16 @@ + + + + net9.0 + enable + enable + true + Default + + + + + + + + diff --git a/DeepDrftWeb/DeepDrftWeb.Client/Layout/MainLayout.razor b/DeepDrftWeb/DeepDrftWeb.Client/Layout/MainLayout.razor new file mode 100644 index 0000000..119dfac --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/Layout/MainLayout.razor @@ -0,0 +1,103 @@ +@inherits LayoutComponentBase + + + + + + + + + Application + + + + + + + + + @Body + + + + +
+ An unhandled error has occurred. + Reload + 🗙 +
+ +@code { + private bool _drawerOpen = true; + private bool _isDarkMode = true; + private MudTheme? _theme = null; + + protected override void OnInitialized() + { + base.OnInitialized(); + + _theme = new() + { + PaletteLight = _lightPalette, + PaletteDark = _darkPalette, + LayoutProperties = new LayoutProperties() + }; + } + + private void DrawerToggle() + { + _drawerOpen = !_drawerOpen; + } + + private void DarkModeToggle() + { + _isDarkMode = !_isDarkMode; + } + + private readonly PaletteLight _lightPalette = new() + { + Black = "#110e2d", + AppbarText = "#424242", + AppbarBackground = "rgba(255,255,255,0.8)", + DrawerBackground = "#ffffff", + GrayLight = "#e8e8e8", + GrayLighter = "#f9f9f9", + }; + + private readonly PaletteDark _darkPalette = new() + { + Primary = "#7e6fff", + Surface = "#1e1e2d", + Background = "#1a1a27", + BackgroundGray = "#151521", + AppbarText = "#92929f", + AppbarBackground = "rgba(26,26,39,0.8)", + DrawerBackground = "#1a1a27", + ActionDefault = "#74718e", + ActionDisabled = "#9999994d", + ActionDisabledBackground = "#605f6d4d", + TextPrimary = "#b2b0bf", + TextSecondary = "#92929f", + TextDisabled = "#ffffff33", + DrawerIcon = "#92929f", + DrawerText = "#92929f", + GrayLight = "#2a2833", + GrayLighter = "#1e1e2d", + Info = "#4a86ff", + Success = "#3dcb6c", + Warning = "#ffb545", + Error = "#ff3f5f", + LinesDefault = "#33323e", + TableLines = "#33323e", + Divider = "#292838", + OverlayLight = "#1e1e2d80", + }; + + public string DarkLightModeButtonIcon => _isDarkMode switch + { + true => Icons.Material.Rounded.AutoMode, + false => Icons.Material.Outlined.DarkMode, + }; +} + + diff --git a/DeepDrftWeb/DeepDrftWeb.Client/Layout/NavMenu.razor b/DeepDrftWeb/DeepDrftWeb.Client/Layout/NavMenu.razor new file mode 100644 index 0000000..3f08809 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/Layout/NavMenu.razor @@ -0,0 +1,10 @@ + + + Home + Counter + + Weather + + + + diff --git a/DeepDrftWeb/DeepDrftWeb.Client/Pages/Counter.razor b/DeepDrftWeb/DeepDrftWeb.Client/Pages/Counter.razor new file mode 100644 index 0000000..83d09a7 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/Pages/Counter.razor @@ -0,0 +1,19 @@ +@page "/counter" + + +Counter + +Counter + +Current count: @currentCount + +Click me + +@code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } +} diff --git a/DeepDrftWeb/DeepDrftWeb.Client/Pages/Home.razor b/DeepDrftWeb/DeepDrftWeb.Client/Pages/Home.razor new file mode 100644 index 0000000..6aaa2a4 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/Pages/Home.razor @@ -0,0 +1,59 @@ +@page "/" + +Home + +Hello, world! +Welcome to your new app, powered by MudBlazor and the .NET 9 Template! + + + You can find documentation and examples on our website here: + + www.mudblazor.com + + + +
+Interactivity in this Template +
+ + When you opt for the "Global" Interactivity Location,
+ the render modes are defined in App.razor and consequently apply to all child components.
+ In this case, providers are globally set in the MainLayout.
+
+ On the other hand, if you choose the "Per page/component" Interactivity Location,
+ it is necessary to include the
+
+ <MudPopoverProvider />
+ <MudDialogProvider />
+ <MudSnackbarProvider />
+
+ components on every interactive page.
+
+ If a render mode is not specified for a page, it defaults to Server-Side Rendering (SSR),
+ similar to this page. While MudBlazor allows pages to be rendered in SSR,
+ please note that interactive features, such as buttons and dropdown menus, will not be functional. +
+ +
+What's New in Blazor with the Release of .NET 9 +
+ +Prerendering + + If you're exploring the features of .NET 9 Blazor,
you might be pleasantly surprised to learn that each page is prerendered on the server,
regardless of the selected render mode.

+ This means that you'll need to inject all necessary services on the server,
even when opting for the wasm (WebAssembly) render mode.

+ This prerendering functionality is crucial to ensuring that WebAssembly mode feels fast and responsive,
especially when it comes to initial page load times.

+ For more information on how to detect prerendering and leverage the RenderContext, you can refer to the following link: + + More details + +
+ +
+InteractiveAuto + + A discussion on how to achieve this can be found here: + + More details + + diff --git a/DeepDrftWeb/DeepDrftWeb.Client/Pages/Weather.razor b/DeepDrftWeb/DeepDrftWeb.Client/Pages/Weather.razor new file mode 100644 index 0000000..3ffd7d8 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/Pages/Weather.razor @@ -0,0 +1,60 @@ +@page "/weather" + + + +Weather + +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() + { + // Simulate asynchronous loading to demonstrate a loading indicator + await Task.Delay(500); + + var startDate = DateOnly.FromDateTime(DateTime.Now); + var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; + forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = startDate.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = summaries[Random.Shared.Next(summaries.Length)] + }).ToArray(); + } + + private class WeatherForecast + { + public DateOnly Date { get; set; } + public int TemperatureC { get; set; } + public string? Summary { get; set; } + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + } +} diff --git a/DeepDrftWeb/DeepDrftWeb.Client/Program.cs b/DeepDrftWeb/DeepDrftWeb.Client/Program.cs new file mode 100644 index 0000000..57602e1 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/Program.cs @@ -0,0 +1,8 @@ +using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using MudBlazor.Services; + +var builder = WebAssemblyHostBuilder.CreateDefault(args); + +builder.Services.AddMudServices(); + +await builder.Build().RunAsync(); diff --git a/DeepDrftWeb/DeepDrftWeb.Client/Routes.razor b/DeepDrftWeb/DeepDrftWeb.Client/Routes.razor new file mode 100644 index 0000000..f756e19 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/Routes.razor @@ -0,0 +1,6 @@ + + + + + + diff --git a/DeepDrftWeb/DeepDrftWeb.Client/_Imports.razor b/DeepDrftWeb/DeepDrftWeb.Client/_Imports.razor new file mode 100644 index 0000000..3aa70bc --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/_Imports.razor @@ -0,0 +1,10 @@ +@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 MudBlazor +@using MudBlazor.Services diff --git a/DeepDrftWeb/DeepDrftWeb.Client/wwwroot/appsettings.Development.json b/DeepDrftWeb/DeepDrftWeb.Client/wwwroot/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/wwwroot/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/DeepDrftWeb/DeepDrftWeb.Client/wwwroot/appsettings.json b/DeepDrftWeb/DeepDrftWeb.Client/wwwroot/appsettings.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.Client/wwwroot/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/DeepDrftWeb/DeepDrftWeb.sln b/DeepDrftWeb/DeepDrftWeb.sln new file mode 100644 index 0000000..b7a11bc --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb.sln @@ -0,0 +1,50 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.0.0 +MinimumVisualStudioVersion = 16.0.0.0 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeepDrftWeb", "DeepDrftWeb\DeepDrftWeb.csproj", "{76E9ECCD-3DAE-4C67-AAC3-101A21E22184}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DeepDrftWeb.Client", "DeepDrftWeb.Client\DeepDrftWeb.Client.csproj", "{DA187C08-E74D-4F28-8FF2-CD74C5473F9C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Debug|x64.ActiveCfg = Debug|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Debug|x64.Build.0 = Debug|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Debug|x86.ActiveCfg = Debug|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Debug|x86.Build.0 = Debug|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Release|Any CPU.Build.0 = Release|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Release|x64.ActiveCfg = Release|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Release|x64.Build.0 = Release|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Release|x86.ActiveCfg = Release|Any CPU + {DA187C08-E74D-4F28-8FF2-CD74C5473F9C}.Release|x86.Build.0 = Release|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Debug|Any CPU.Build.0 = Debug|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Debug|x64.ActiveCfg = Debug|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Debug|x64.Build.0 = Debug|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Debug|x86.ActiveCfg = Debug|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Debug|x86.Build.0 = Debug|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Release|Any CPU.ActiveCfg = Release|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Release|Any CPU.Build.0 = Release|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Release|x64.ActiveCfg = Release|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Release|x64.Build.0 = Release|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Release|x86.ActiveCfg = Release|Any CPU + {76E9ECCD-3DAE-4C67-AAC3-101A21E22184}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E25814BD-2D52-4BA2-B9BD-0B80E2221977} + EndGlobalSection +EndGlobal diff --git a/DeepDrftWeb/DeepDrftWeb/Components/App.razor b/DeepDrftWeb/DeepDrftWeb/Components/App.razor new file mode 100644 index 0000000..e5611cb --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb/Components/App.razor @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/DeepDrftWeb/DeepDrftWeb/Components/Pages/Error.razor b/DeepDrftWeb/DeepDrftWeb/Components/Pages/Error.razor new file mode 100644 index 0000000..576cc2d --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb/Components/Pages/Error.razor @@ -0,0 +1,36 @@ +@page "/Error" +@using System.Diagnostics + +Error + +

Error.

+

An error occurred while processing your request.

+ +@if (ShowRequestId) +{ +

+ Request ID: @RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more 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. +

+ +@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; +} diff --git a/DeepDrftWeb/DeepDrftWeb/Components/_Imports.razor b/DeepDrftWeb/DeepDrftWeb/Components/_Imports.razor new file mode 100644 index 0000000..ac766ef --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb/Components/_Imports.razor @@ -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 MudBlazor +@using MudBlazor.Services +@using DeepDrftWeb +@using DeepDrftWeb.Client +@using DeepDrftWeb.Components diff --git a/DeepDrftWeb/DeepDrftWeb/DeepDrftWeb.csproj b/DeepDrftWeb/DeepDrftWeb/DeepDrftWeb.csproj new file mode 100644 index 0000000..406f3ea --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb/DeepDrftWeb.csproj @@ -0,0 +1,15 @@ + + + + net9.0 + enable + enable + + + + + + + + + \ No newline at end of file diff --git a/DeepDrftWeb/DeepDrftWeb/Program.cs b/DeepDrftWeb/DeepDrftWeb/Program.cs new file mode 100644 index 0000000..45d1eae --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb/Program.cs @@ -0,0 +1,40 @@ +using MudBlazor.Services; +using DeepDrftWeb.Client.Pages; +using DeepDrftWeb.Components; + +var builder = WebApplication.CreateBuilder(args); + +// Add MudBlazor services +builder.Services.AddMudServices(); + +// Add services to the container. +builder.Services.AddRazorComponents() + .AddInteractiveServerComponents() + .AddInteractiveWebAssemblyComponents(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseWebAssemblyDebugging(); +} +else +{ + app.UseExceptionHandler("/Error", createScopeForErrors: true); + // 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.UseAntiforgery(); + +app.MapStaticAssets(); +app.MapRazorComponents() + .AddInteractiveServerRenderMode() + .AddInteractiveWebAssemblyRenderMode() + .AddAdditionalAssemblies(typeof(DeepDrftWeb.Client._Imports).Assembly); + +app.Run(); diff --git a/DeepDrftWeb/DeepDrftWeb/appsettings.Development.json b/DeepDrftWeb/DeepDrftWeb/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/DeepDrftWeb/DeepDrftWeb/appsettings.json b/DeepDrftWeb/DeepDrftWeb/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/DeepDrftWeb/DeepDrftWeb/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/DeepDrftWeb/DeepDrftWeb/wwwroot/favicon.ico b/DeepDrftWeb/DeepDrftWeb/wwwroot/favicon.ico new file mode 100644 index 0000000..1239223 Binary files /dev/null and b/DeepDrftWeb/DeepDrftWeb/wwwroot/favicon.ico differ