From 5fdda086270f4e4dc78df51c904d9b95e46e04d5 Mon Sep 17 00:00:00 2001 From: James Kolpack Date: Wed, 14 Jan 2026 10:22:44 -0500 Subject: [PATCH] Refactor chip variants in event and team components for consistency This commit updates various components within the Events and MeetingSchedule features to utilize standardized chip variants defined in the AppIcons class. The changes include replacing hardcoded chip variants with calls to the new methods for event, team, and student chips, enhancing consistency across the UI. Additionally, the UnscheduledStudentsList component has been updated to include necessary using directives, improving code clarity. These modifications contribute to a more uniform and maintainable user interface. --- .../Events/Components/EventAttributes.razor | 2 +- .../MeetingSchedule/ScheduledTeamsList.razor | 7 +- .../UnscheduledStudentsList.razor | 6 +- .../Features/Students/Registration.razor | 1 + .../Features/Teams/Assignment.razor | 150 +++++++++--------- .../Teams/Components/TeamStudents.razor | 2 +- WebApp/Models/AppIcons.cs | 15 ++ 7 files changed, 102 insertions(+), 81 deletions(-) diff --git a/WebApp/Components/Features/Events/Components/EventAttributes.razor b/WebApp/Components/Features/Events/Components/EventAttributes.razor index 0ba1f1c..c2ff455 100644 --- a/WebApp/Components/Features/Events/Components/EventAttributes.razor +++ b/WebApp/Components/Features/Events/Components/EventAttributes.razor @@ -4,7 +4,7 @@ { @EventDefinition.LevelOfEffort } *@ - + @{ var loeIcon = AppIcons.LevelOfEffortIcon(EventDefinition.LevelOfEffort); var loeColor = AppIcons.IconColors.GetValueOrDefault(loeIcon, "inherit"); diff --git a/WebApp/Components/Features/MeetingSchedule/ScheduledTeamsList.razor b/WebApp/Components/Features/MeetingSchedule/ScheduledTeamsList.razor index 49d3d22..38a25d5 100644 --- a/WebApp/Components/Features/MeetingSchedule/ScheduledTeamsList.razor +++ b/WebApp/Components/Features/MeetingSchedule/ScheduledTeamsList.razor @@ -29,7 +29,8 @@
+ Color="Color.Default" + Variant="@AppIcons.TeamChipVariant()"> @team
@@ -59,7 +60,7 @@ { @formattedName @@ -79,7 +80,7 @@ @formattedName diff --git a/WebApp/Components/Features/MeetingSchedule/UnscheduledStudentsList.razor b/WebApp/Components/Features/MeetingSchedule/UnscheduledStudentsList.razor index 04b6f19..fbd7e68 100644 --- a/WebApp/Components/Features/MeetingSchedule/UnscheduledStudentsList.razor +++ b/WebApp/Components/Features/MeetingSchedule/UnscheduledStudentsList.razor @@ -1,5 +1,6 @@ @using Core.Calculation @using Core.Utility +@using WebApp.Models @if (UnscheduledStudents.Any()) { @@ -18,7 +19,7 @@ } - + @formattedName @@ -40,7 +41,8 @@
+ Color="@chipColor" + Variant="@AppIcons.TeamChipVariant()"> @if (isScheduled) { diff --git a/WebApp/Components/Features/Students/Registration.razor b/WebApp/Components/Features/Students/Registration.razor index af22628..eeb466b 100644 --- a/WebApp/Components/Features/Students/Registration.razor +++ b/WebApp/Components/Features/Students/Registration.razor @@ -94,6 +94,7 @@ @team diff --git a/WebApp/Components/Features/Teams/Assignment.razor b/WebApp/Components/Features/Teams/Assignment.razor index add1779..ed64720 100644 --- a/WebApp/Components/Features/Teams/Assignment.razor +++ b/WebApp/Components/Features/Teams/Assignment.razor @@ -153,85 +153,87 @@ .Concat(context.Events) .Distinct(); } - @foreach (var e in - allStudentEvents - .OrderBy(e => - context.Student.EventRankings - .Find(ser => ser.EventDefinition == e)?.Rank ?? 10)) - { - var eventRank = context.Student.EventRankings.Find(er => er.EventDefinition == e)?.Rank; - var isAssigned = context.Events.Contains(e); - - var color = AppIcons.RankedEventColor(eventRank ?? 0); - var style = "border-style: solid;"; - - if (isAssigned) + + @foreach (var e in + allStudentEvents + .OrderBy(e => + context.Student.EventRankings + .Find(ser => ser.EventDefinition == e)?.Rank ?? 10)) { - style += "border-color:black; border-width:thin;"; - if (eventRank.HasValue) + var eventRank = context.Student.EventRankings.Find(er => er.EventDefinition == e)?.Rank; + var isAssigned = context.Events.Contains(e); + + var color = AppIcons.RankedEventColor(eventRank ?? 0); + var style = "border-style: solid;"; + + if (isAssigned) { - style += $"background:{color};"; - if (eventRank == 1) - style += $"color:black"; + style += "border-color:black; border-width:thin;"; + if (eventRank.HasValue) + { + style += $"background:{color};"; + if (eventRank == 1) + style += $"color:black"; + } + else + style += $"background:{Colors.Gray.Lighten3};"; } else - style += $"background:{Colors.Gray.Lighten3};"; + { + if (eventRank.HasValue) + style += $"border-color:{color}; border-width:medium; color:{Colors.Gray.Lighten1};"; + } + + var isIncluded = _assignmentRequirements + .Find(ar => + ar.EventDefinition == e + && ar.Student == context.Student + && ar.Requirement == Requirement.Include) == null; + var isExcluded = _assignmentRequirements + .Find(ar => + ar.EventDefinition == e + && ar.Student == context.Student + && ar.Requirement == Requirement.Exclude) == null; + + + + @e.ShortName  + @AppIcons.EventAttributes(e) + + + @if (isIncluded) + { + + + + } + else + { + + + + } + + @if (isExcluded) + { + + + + } + else + { + + + + } + + } - else - { - if (eventRank.HasValue) - style += $"border-color:{color}; border-width:medium; color:{Colors.Gray.Lighten1};"; - } - - var isIncluded = _assignmentRequirements - .Find(ar => - ar.EventDefinition == e - && ar.Student == context.Student - && ar.Requirement == Requirement.Include) == null; - var isExcluded = _assignmentRequirements - .Find(ar => - ar.EventDefinition == e - && ar.Student == context.Student - && ar.Requirement == Requirement.Exclude) == null; - - - - @e.ShortName  - @AppIcons.EventAttributes(e) - - - @if (isIncluded) - { - - - - } - else - { - - - - } - - @if (isExcluded) - { - - - - } - else - { - - - - } - - - } + diff --git a/WebApp/Components/Features/Teams/Components/TeamStudents.razor b/WebApp/Components/Features/Teams/Components/TeamStudents.razor index 51c9f0f..70936d7 100644 --- a/WebApp/Components/Features/Teams/Components/TeamStudents.razor +++ b/WebApp/Components/Features/Teams/Components/TeamStudents.razor @@ -17,7 +17,7 @@ @if (eventRank.HasValue) { diff --git a/WebApp/Models/AppIcons.cs b/WebApp/Models/AppIcons.cs index 1a1afe6..b889659 100644 --- a/WebApp/Models/AppIcons.cs +++ b/WebApp/Models/AppIcons.cs @@ -154,5 +154,20 @@ namespace WebApp.Models }; return $"{number}{suffix}"; } + + /// + /// Returns the standard chip variant for student chips (Outlined). + /// + public static Variant StudentChipVariant() => Variant.Outlined; + + /// + /// Returns the standard chip variant for event chips (Filled). + /// + public static Variant EventChipVariant() => Variant.Filled; + + /// + /// Returns the standard chip variant for team chips (Filled). + /// + public static Variant TeamChipVariant() => Variant.Filled; } }