Skip to content

Commit 3049f45

Browse files
2 parents e96b926 + 86a0ec2 commit 3049f45

22 files changed

Lines changed: 200 additions & 44 deletions

icons/codebreaker_240.jpg

9.66 KB
Loading

src/CodeBreaker.Blazor.Client/CodeBreaker.Blazor.Client.csproj

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
</ItemGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="BlazorApplicationInsights" Version="3.0.5" />
17-
<PackageReference Include="CNinnovation.Codebreaker.GamesClient" Version="3.6.0-beta.24" />
18-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.5" />
19-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.5" />
20-
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.5" PrivateAssets="all" />
21-
<PackageReference Include="Microsoft.Authentication.WebAssembly.Msal" Version="8.0.5" />
16+
<PackageReference Include="BlazorApplicationInsights" Version="3.1.0" />
17+
<PackageReference Include="CNinnovation.Codebreaker.GamesClient" Version="3.7.0" />
18+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.8" />
19+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.8" />
20+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.8" PrivateAssets="all" />
21+
<PackageReference Include="Microsoft.Authentication.WebAssembly.Msal" Version="8.0.8" />
2222
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
23-
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.5" />
24-
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.7.2" />
25-
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.7.2" />
23+
<PackageReference Include="Microsoft.Extensions.Localization" Version="8.0.8" />
24+
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.9.3" />
25+
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="4.9.3" />
26+
<PackageReference Include="System.Text.Json" Version="8.0.4" />
2627
</ItemGroup>
2728

2829
<ItemGroup>

src/CodeBreaker.Blazor.Client/Pages/Authentication.razor

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,21 @@
4242

4343
@code {
4444
[Parameter] public string? Action { get; set; }
45+
46+
[Inject] private NavigationManager NavigationManager { get; set; } = null!;
47+
48+
protected override void OnInitialized()
49+
{
50+
if (Action == "logout-callback")
51+
NavigateToHome();
52+
}
53+
54+
private void NavigateToHome()
55+
{
56+
Task.Run(async () =>
57+
{
58+
await Task.Delay(3000);
59+
NavigationManager.NavigateTo("/", false, true);
60+
});
61+
}
4562
}

src/CodeBreaker.Blazor.Client/Pages/GamePage.razor

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@page "/game"
2+
@attribute [Authorize]
23
@using CodeBreaker.Blazor.Client.Models
34
@using Codebreaker.GameAPIs.Client.Models
45

@@ -14,15 +15,17 @@
1415
<FluentTextField
1516
Class="full-width"
1617
Label="@Loc["GamePage_NameInput"]"
18+
Placeholder="@Loc["GamePage_NameInput_Placeholder"]"
1719
Required
1820
Value="@_gamerName"
19-
ReadOnly />
21+
Disabled />
2022
}
2123
else
2224
{
2325
<FluentSelect
2426
Class="full-width"
2527
Label="@Loc["GamePage_NameInput"]"
28+
Placeholder="@Loc["GamePage_NameInput_Placeholder"]"
2629
Items="_gamerNameSuggestions"
2730
@bind-Value="_gamerName"
2831
Required>
@@ -35,6 +38,7 @@
3538
Class="full-width"
3639
Items="@_gameTypes.Keys"
3740
Label="@Loc["GamePage_GameTypeInput"]"
41+
Placeholder="@Loc["GamePage_SelectGameType_Placeholder"]"
3842
@bind-Value="SelectedGameTypeKey"
3943
Required />
4044
</FluentGridItem>

src/CodeBreaker.Blazor.Client/Pages/GamePage.razor.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public partial class GamePage : IDisposable
1818
//TODO: Get Data from API
1919
private readonly FrozenDictionary<string, GameType> _gameTypes = new Dictionary<string, GameType>() {
2020
{ "6x4", GameType.Game6x4 },
21-
//{ "6x4 Mini", GameType.Game6x4Mini },
21+
{ "6x4 Mini", GameType.Game6x4Mini },
2222
{ "8x5", GameType.Game8x5 },
2323
{ "5x5x4", GameType.Game5x5x4 },
2424
}.ToFrozenDictionary();
@@ -56,7 +56,10 @@ public partial class GamePage : IDisposable
5656

5757
private GameType? SelectedGameType => SelectedGameTypeKey is null ? null : _gameTypes[SelectedGameTypeKey];
5858

59-
private bool CanStartGame => !string.IsNullOrWhiteSpace(_gamerName) && !_loadingGame;
59+
private bool CanStartGame =>
60+
!string.IsNullOrWhiteSpace(_gamerName)
61+
&& !_loadingGame
62+
&& SelectedGameType is not null;
6063

6164
protected override async Task OnInitializedAsync()
6265
{

src/CodeBreaker.Blazor.Client/Pages/ReportsPage.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@page "/reports"
2+
@attribute [Authorize]
23
@using Codebreaker.GameAPIs.Client.Models
34

45
<FluentCard>

src/CodeBreaker.Blazor.Client/Pages/UserInformationPage.razor

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
@page "/user-information"
2-
@using Microsoft.AspNetCore.Authorization;
32
@attribute [Authorize]
43

54
@if (_user is not null) {

src/CodeBreaker.Blazor.Client/Program.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using CodeBreaker.Blazor.Client.Contracts.Services;
44
using CodeBreaker.Blazor.Client.Extensions;
55
using CodeBreaker.Blazor.Client.Services;
6+
using CodeBreaker.Blazor.Client.Services.HttpMessageHandlers;
67
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
78
using Microsoft.FluentUI.AspNetCore.Components;
89

@@ -16,16 +17,26 @@
1617
builder.Services.AddMsalAuthentication(options =>
1718
{
1819
builder.Configuration.Bind("AzureAdB2C", options.ProviderOptions.Authentication);
19-
//options.ProviderOptions.DefaultAccessTokenScopes.Add(""); // TODO
20+
options.ProviderOptions.DefaultAccessTokenScopes.Add("openid");
21+
options.ProviderOptions.DefaultAccessTokenScopes.Add("profile");
22+
options.ProviderOptions.DefaultAccessTokenScopes.Add("offline_access");
23+
options.ProviderOptions.DefaultAccessTokenScopes.Add("https://codebreaker3000.onmicrosoft.com/gateway/games.play");
24+
//options.ProviderOptions.DefaultAccessTokenScopes.Add("https://codebreaker3000.onmicrosoft.com/gateway/live.observe");
25+
//options.ProviderOptions.DefaultAccessTokenScopes.Add("https://codebreaker3000.onmicrosoft.com/gateway/ranking.query");
26+
//options.ProviderOptions.DefaultAccessTokenScopes.Add("https://codebreaker3000.onmicrosoft.com/gateway/bot.trigger");
2027
options.UserOptions.NameClaim = "extension_GamerName";
2128
});
2229

30+
builder.Services.AddTransient<AllAuthorizationMessageHandler>();
31+
2332
builder.Services.AddHttpClient<IGamerNameSuggestionClient, GamerNameSuggestionClient>(configure =>
24-
configure.BaseAddress = new Uri(builder.Configuration.GetRequired("UserApiBase")));
33+
configure.BaseAddress = new Uri(builder.Configuration.GetRequired("UserServicePublicBaseAddress"))
34+
);
2535

2636
builder.Services.AddHttpClient<IGamesClient, GamesClient>(configure =>
27-
configure.BaseAddress = new Uri(builder.Configuration.GetRequired("GameApiBase")));
28-
//.AddHttpMessageHandler<>(); // TODO
37+
configure.BaseAddress = new Uri(builder.Configuration.GetRequired("GameServiceBaseAddress"))
38+
)
39+
.AddHttpMessageHandler<AllAuthorizationMessageHandler>();
2940

3041
builder.Services.AddScoped<IMobileDetectorService, MobileDetectorService>();
3142

src/CodeBreaker.Blazor.Client/Resources/Resource.Designer.cs

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/CodeBreaker.Blazor.Client/Resources/Resource.de.resx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,4 +374,10 @@
374374
<data name="Yes" xml:space="preserve">
375375
<value>Ja</value>
376376
</data>
377+
<data name="GamePage_SelectGameType_Placeholder" xml:space="preserve">
378+
<value>Wählen Sie einen Spieltyp</value>
379+
</data>
380+
<data name="GamePage_NameInput_Placeholder" xml:space="preserve">
381+
<value>Wählen Sie Ihren Spielernamen</value>
382+
</data>
377383
</root>

0 commit comments

Comments
 (0)