From 68311f40123b36e310fe7bf99d46516d17c8f14e Mon Sep 17 00:00:00 2001 From: James Kolpack Date: Wed, 14 Jan 2026 09:50:16 -0500 Subject: [PATCH] Refactor ScheduledTeamsList component to enhance student exclusion UI This commit updates the ScheduledTeamsList.razor component by replacing the existing MudChip implementation with InteractiveChip for better user interaction when managing student exclusions. The logic for displaying excluded students has been simplified, improving the overall readability and maintainability of the code. Additionally, the hover functionality has been removed to streamline the user experience. These changes contribute to a more intuitive and responsive scheduling interface. --- .../MeetingSchedule/ScheduledTeamsList.razor | 42 +++++---- .../Features/Teams/Assignment.razor | 93 ++++++++++--------- .../Shared/Components/InteractiveChip.razor | 50 ++++++++++ 3 files changed, 121 insertions(+), 64 deletions(-) create mode 100644 WebApp/Components/Shared/Components/InteractiveChip.razor diff --git a/WebApp/Components/Features/MeetingSchedule/ScheduledTeamsList.razor b/WebApp/Components/Features/MeetingSchedule/ScheduledTeamsList.razor index b46cd17..49d3d22 100644 --- a/WebApp/Components/Features/MeetingSchedule/ScheduledTeamsList.razor +++ b/WebApp/Components/Features/MeetingSchedule/ScheduledTeamsList.razor @@ -55,29 +55,35 @@ AbsentStudents = AbsentStudents.ToList() }); - + @if (nonExcludedStudentCount > 1) + { + + + @formattedName + + + + + + } + else + { - - @formattedName - @if (_hoveredStudent == (team.Id, student.Id) && nonExcludedStudentCount > 1) - { - - } - + @formattedName - + } } @@ -112,8 +118,6 @@ [Parameter] public EventCallback<(int teamId, int timeSlotIndex, int studentId)> OnToggleStudentExclusion { get; set; } - private (int? teamId, int? studentId) _hoveredStudent = (null, null); - private bool IsStudentExcluded(int teamId, int timeSlotIndex, int studentId) { var key = (teamId, timeSlotIndex, studentId); diff --git a/WebApp/Components/Features/Teams/Assignment.razor b/WebApp/Components/Features/Teams/Assignment.razor index 4c15082..add1779 100644 --- a/WebApp/Components/Features/Teams/Assignment.razor +++ b/WebApp/Components/Features/Teams/Assignment.razor @@ -163,7 +163,7 @@ var isAssigned = context.Events.Contains(e); var color = AppIcons.RankedEventColor(eventRank ?? 0); - var style = string.Empty; + var style = "border-style: solid;"; if (isAssigned) { @@ -183,51 +183,54 @@ style += $"border-color:{color}; border-width:medium; color:{Colors.Gray.Lighten1};"; } - - @e.ShortName  - @AppIcons.EventAttributes(e) - @{ - 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; - } - @if (isIncluded) - { - - - - } - else - { - - - - } + 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; - @if (isExcluded) - { - - - - } - else - { - - - - } - + + + @e.ShortName  + @AppIcons.EventAttributes(e) + + + @if (isIncluded) + { + + + + } + else + { + + + + } + + @if (isExcluded) + { + + + + } + else + { + + + + } + + } diff --git a/WebApp/Components/Shared/Components/InteractiveChip.razor b/WebApp/Components/Shared/Components/InteractiveChip.razor new file mode 100644 index 0000000..3855a6f --- /dev/null +++ b/WebApp/Components/Shared/Components/InteractiveChip.razor @@ -0,0 +1,50 @@ +@namespace WebApp.Components.Shared.Components + + + + + @ChildContent + @if (_isHovered && ControlContent != null) + { + @ControlContent + } + + + + +@code { + [Parameter] + public required RenderFragment ChildContent { get; set; } + + [Parameter] + public RenderFragment? ControlContent { get; set; } + + [Parameter] + public Size Size { get; set; } = Size.Small; + + [Parameter] + public Color Color { get; set; } = Color.Default; + + [Parameter] + public Variant Variant { get; set; } = Variant.Text; + + [Parameter] + public string? Style { get; set; } + + [Parameter] + public string? Class { get; set; } + + [Parameter] + public string? WrapperClass { get; set; } + + private bool _isHovered = false; +} \ No newline at end of file