diff --git a/src/PlanningPoker.Client/Configuration/NextEnvironmentConfiguration.cs b/src/PlanningPoker.Client/Configuration/NextEnvironmentConfiguration.cs new file mode 100644 index 0000000..f8c004b --- /dev/null +++ b/src/PlanningPoker.Client/Configuration/NextEnvironmentConfiguration.cs @@ -0,0 +1,9 @@ +namespace PlanningPoker.Client.Configuration +{ + public class NextEnvironmentConfiguration + { + public const string Path = "UI:Features:NextEnvironment"; + + public string RichText { get; set; } + } +} diff --git a/src/PlanningPoker.Client/Pages/Index.razor b/src/PlanningPoker.Client/Pages/Index.razor index 0017745..43707ec 100644 --- a/src/PlanningPoker.Client/Pages/Index.razor +++ b/src/PlanningPoker.Client/Pages/Index.razor @@ -1,11 +1,14 @@ @page "/" @using Microsoft.AspNetCore.SignalR.Client +@using Microsoft.Extensions.Options +@using PlanningPoker.Client.Configuration @using PlanningPoker.Client.Utilities @using PlanningPoker.Hub.Client @using PlanningPoker.Hub.Client.Abstractions @using PlanningPoker.Hub.Client.Abstractions.ViewModels @inject NavigationManager NavigationManager @inject IJSRuntime JSRuntime +@inject IOptions NextEnvironmentConfiguration @if (string.IsNullOrWhiteSpace(CreatedServerAddress)) { @@ -13,7 +16,7 @@
-

Welcome to Just Planning Poker!

+

Welcome to Just Planning Poker!

This is just a planning poker tool. No sign-up, no gathered user data, no fees.

The planning room has a default set of cards, but you can modify this set in the input below. Separate card values with ',' (comma).

@@ -48,6 +51,18 @@
+ @if (NextEnvironmentConfiguration?.Value != null && !string.IsNullOrWhiteSpace(NextEnvironmentConfiguration.Value.RichText)) + { +
+
+
+
+

@((MarkupString)NextEnvironmentConfiguration.Value.RichText)

+
+
+
+
+ } } else { diff --git a/src/PlanningPoker.Client/PlanningPoker.Client.csproj b/src/PlanningPoker.Client/PlanningPoker.Client.csproj index eac368c..6fae65f 100644 --- a/src/PlanningPoker.Client/PlanningPoker.Client.csproj +++ b/src/PlanningPoker.Client/PlanningPoker.Client.csproj @@ -10,6 +10,7 @@ + diff --git a/src/PlanningPoker.Client/Program.cs b/src/PlanningPoker.Client/Program.cs index a0f69e7..201b9ea 100644 --- a/src/PlanningPoker.Client/Program.cs +++ b/src/PlanningPoker.Client/Program.cs @@ -1,7 +1,9 @@ using System.Threading.Tasks; using Blazored.SessionStorage; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using PlanningPoker.Client.Configuration; using PlanningPoker.Client.Storage; namespace PlanningPoker.Client @@ -12,14 +14,15 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.Services.AddBlazoredSessionStorage(); - RegisterDependencies(builder.Services); + RegisterDependencies(builder.Services, builder.Configuration); builder.RootComponents.Add("app"); await builder.Build().RunAsync(); } - private static IServiceCollection RegisterDependencies(IServiceCollection services) + private static IServiceCollection RegisterDependencies(IServiceCollection services, IConfiguration configuration) { services.AddTransient(); + services.Configure(configuration.GetSection(NextEnvironmentConfiguration.Path)); return services; } } diff --git a/src/PlanningPoker.Client/wwwroot/appsettings.Nightly.json b/src/PlanningPoker.Client/wwwroot/appsettings.Nightly.json new file mode 100644 index 0000000..8c29112 --- /dev/null +++ b/src/PlanningPoker.Client/wwwroot/appsettings.Nightly.json @@ -0,0 +1,9 @@ +{ + "UI": { + "Features": { + "NextEnvironment": { + "RichText": "Go to JustPlanningPoker prod, to use the stable release." + } + } + } +} \ No newline at end of file diff --git a/src/PlanningPoker.Client/wwwroot/appsettings.Production.json b/src/PlanningPoker.Client/wwwroot/appsettings.Production.json new file mode 100644 index 0000000..2714e4d --- /dev/null +++ b/src/PlanningPoker.Client/wwwroot/appsettings.Production.json @@ -0,0 +1,9 @@ +{ + "UI": { + "Features": { + "NextEnvironment": { + "RichText": "Go to JustPlanningPoker Nightly, for experimental features!" + } + } + } +} \ No newline at end of file diff --git a/src/PlanningPoker.Client/wwwroot/appsettings.json b/src/PlanningPoker.Client/wwwroot/appsettings.json new file mode 100644 index 0000000..8593c62 --- /dev/null +++ b/src/PlanningPoker.Client/wwwroot/appsettings.json @@ -0,0 +1,2 @@ +{ +} \ No newline at end of file diff --git a/src/PlanningPoker.Server/Program.cs b/src/PlanningPoker.Server/Program.cs index ddc9fc8..3554cea 100644 --- a/src/PlanningPoker.Server/Program.cs +++ b/src/PlanningPoker.Server/Program.cs @@ -19,6 +19,18 @@ public static IWebHost BuildWebHost(string[] args) .AddCommandLine(args) .Build()) .UseStartup() + + // Leaving commented code in the codebase is not a good idea, + // but I think this warrants an exception. + // Blazor does not allow local debugging where you set the ASPNETCORE_ENVIRONMENT to anything + // other than Development: https://github.com/dotnet/aspnetcore/issues/43110#issuecomment-1206573745. + // In order to test environment-specific configuration, + // the below line has to be added. + // Note, this line should *not* be added in production code, + // as it enables locally run code to get static assets from the build output. + // We don't want that behavior on an environment running on published files. + //.UseStaticWebAssets() // <-- This is the line to comment in to test environments. + // End comment block. .Build(); } } diff --git a/src/PlanningPoker.Server/Startup.cs b/src/PlanningPoker.Server/Startup.cs index 45338eb..a800475 100644 --- a/src/PlanningPoker.Server/Startup.cs +++ b/src/PlanningPoker.Server/Startup.cs @@ -40,8 +40,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseWebAssemblyDebugging(); } - app.UseStaticFiles(); app.UseBlazorFrameworkFiles(); + app.UseStaticFiles(); app.UseRouting();