From 5383882bdc9236ca4fff8fd93e9c1ba45df0d02b Mon Sep 17 00:00:00 2001 From: Alex Hesketh Date: Thu, 22 Feb 2024 15:15:55 +0000 Subject: [PATCH] Client changes --- API.Client/Clients/PersonClient.cs | 2 +- API.Data/Faction.cs | 1 + API.Data/Person.cs | 3 +- API.Data/Post/Faction.cs | 2 + API.Data/Post/Person.cs | 1 + API.Data/Post/Player.cs | 4 +- API.Data/Put/Person.cs | 12 +++- .../Components/Dialogs/EditPlayDialog.razor | 13 ++++- Website/Components/Layout/MainLayout.razor | 2 + Website/Components/Layout/NavMenu.razor | 21 ++++--- .../Components/Pages/Data/FactionsPage.razor | 7 ++- .../Components/Pages/Data/PeoplePage.razor | 55 +++++++++++++++---- .../Components/Pages/Stats/FactionPage.razor | 7 +++ 13 files changed, 103 insertions(+), 27 deletions(-) diff --git a/API.Client/Clients/PersonClient.cs b/API.Client/Clients/PersonClient.cs index 37b89ab..4e28179 100644 --- a/API.Client/Clients/PersonClient.cs +++ b/API.Client/Clients/PersonClient.cs @@ -3,7 +3,7 @@ namespace Hesketh.MecatolArchives.API.Client.Clients; -public sealed class PersonClient : EntityClient +public sealed class PersonClient : EntityClient { public PersonClient(HttpClient client, IAuthHeaderProvider authHeaderProvider) : base(client, authHeaderProvider, "people") diff --git a/API.Data/Faction.cs b/API.Data/Faction.cs index d592a14..c34af20 100644 --- a/API.Data/Faction.cs +++ b/API.Data/Faction.cs @@ -3,6 +3,7 @@ public sealed class Faction : IEntity { public string Name { get; set; } = null!; + public bool HideFromStatistics { get; set; } = false; public string? Link { get; set; } = null; public Guid Identifier { get; set; } } \ No newline at end of file diff --git a/API.Data/Person.cs b/API.Data/Person.cs index 0f0dad6..4905cef 100644 --- a/API.Data/Person.cs +++ b/API.Data/Person.cs @@ -7,7 +7,8 @@ public sealed class Person : IEntity public string Name { get; set; } = null!; public Colour? DefaultColour { get; set; } = null; public Guid Identifier { get; set; } - + public bool HideFromStatistics { get; set; } = false; + public string Initials { get diff --git a/API.Data/Post/Faction.cs b/API.Data/Post/Faction.cs index 6c8d583..ec133d6 100644 --- a/API.Data/Post/Faction.cs +++ b/API.Data/Post/Faction.cs @@ -3,4 +3,6 @@ public sealed class Faction { public string Name { get; set; } = null!; + public bool HideFromStatistics { get; set; } = false; + public string? Link { get; set; } = null; } \ No newline at end of file diff --git a/API.Data/Post/Person.cs b/API.Data/Post/Person.cs index fa2bc92..1f3519d 100644 --- a/API.Data/Post/Person.cs +++ b/API.Data/Post/Person.cs @@ -4,4 +4,5 @@ public sealed class Person { public string Name { get; set; } = null!; public Guid? DefaultColourId { get; set; } = null; + public bool HideFromStatistics { get; set; } = false; } \ No newline at end of file diff --git a/API.Data/Post/Player.cs b/API.Data/Post/Player.cs index b8f3041..111dda9 100644 --- a/API.Data/Post/Player.cs +++ b/API.Data/Post/Player.cs @@ -8,12 +8,14 @@ public Player(Data.Player model) Points = model.Points; Winner = model.Winner; Eliminated = model.Eliminated; - + DraftOrder = model.DraftOrder; + PersonIdentifier = model.Person.Identifier; FactionIdentifier = model.Faction.Identifier; ColourIdentifier = model.Colour.Identifier; } + public uint DraftOrder { get; set; } public uint Points { get; set; } public bool Winner { get; set; } public bool Eliminated { get; set; } diff --git a/API.Data/Put/Person.cs b/API.Data/Put/Person.cs index fc11274..36c3724 100644 --- a/API.Data/Put/Person.cs +++ b/API.Data/Put/Person.cs @@ -1,8 +1,18 @@ namespace Hesketh.MecatolArchives.API.Data.Put; -public sealed class Person +public sealed class Person : IEntity { + public Person() {} + + public Person(Data.Person person) + { + Identifier = person.Identifier; + Name = person.Name; + DefaultColourId = person.DefaultColour?.Identifier; + } + public Guid Identifier { get; set; } public string Name { get; set; } = null!; + public bool HideFromStatistics { get; set; } = false; public Guid? DefaultColourId { get; set; } = null; } \ No newline at end of file diff --git a/Website/Components/Dialogs/EditPlayDialog.razor b/Website/Components/Dialogs/EditPlayDialog.razor index c05e27f..63d1f6f 100644 --- a/Website/Components/Dialogs/EditPlayDialog.razor +++ b/Website/Components/Dialogs/EditPlayDialog.razor @@ -74,6 +74,7 @@ Player Colour Faction + Draft Eliminated Points Winner @@ -109,6 +110,9 @@ } + + + @@ -166,7 +170,8 @@ Faction = player.Faction, Person = player.Person, Points = player.Points, - Winner = player.Winner + Winner = player.Winner, + DraftOrder = player.DraftOrder }); } @@ -215,7 +220,8 @@ FactionIdentifier = x.Faction!.Identifier, PersonIdentifier = x.Person!.Identifier, Points = x.Points, - Winner = x.Winner + Winner = x.Winner, + DraftOrder = x.DraftOrder }).ToList(), PointGoal = _play.PointGoal, RulesVersion = _play.RulesVersion, @@ -329,7 +335,8 @@ public uint Points { get; set; } public bool Winner { get; set; } public bool Eliminated { get; set; } - + public uint DraftOrder { get; set; } + public Person? Person { get; set; } public Faction? Faction { get; set; } public Colour? Colour { get; set; } diff --git a/Website/Components/Layout/MainLayout.razor b/Website/Components/Layout/MainLayout.razor index 1cabddf..9998dd2 100644 --- a/Website/Components/Layout/MainLayout.razor +++ b/Website/Components/Layout/MainLayout.razor @@ -58,7 +58,9 @@ MECATOL ARCHIVES + + diff --git a/Website/Components/Layout/NavMenu.razor b/Website/Components/Layout/NavMenu.razor index 0f1b156..c42fc1d 100644 --- a/Website/Components/Layout/NavMenu.razor +++ b/Website/Components/Layout/NavMenu.razor @@ -3,11 +3,18 @@ Games Players Factions - - Colours - Expansions - Factions - Variants - People - + @if (Authenticated) + { + + Colours + Expansions + Factions + Variants + People + + } + +@code { + [CascadingParameter] public bool Authenticated { get; set; } = false; +} diff --git a/Website/Components/Pages/Data/FactionsPage.razor b/Website/Components/Pages/Data/FactionsPage.razor index f33a4d0..4b678a1 100644 --- a/Website/Components/Pages/Data/FactionsPage.razor +++ b/Website/Components/Pages/Data/FactionsPage.razor @@ -20,6 +20,8 @@ } + + @if (!_dataGrid.ReadOnly) { @@ -47,6 +49,8 @@ + +