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.
This commit is contained in:
@@ -55,29 +55,35 @@
|
||||
AbsentStudents = AbsentStudents.ToList()
|
||||
});
|
||||
|
||||
<MudStack Row="true" Spacing="0" AlignItems="AlignItems.Center"
|
||||
Style="position: relative; display: inline-flex;"
|
||||
@onmouseenter="@(() => _hoveredStudent = (team.Id, student.Id))"
|
||||
@onmouseleave="@(() => _hoveredStudent = (null, null))">
|
||||
@if (nonExcludedStudentCount > 1)
|
||||
{
|
||||
<InteractiveChip Size="Size.Small"
|
||||
Color="@chipColor"
|
||||
Variant="Variant.Outlined"
|
||||
Style="@(isExcluded ? "opacity: 0.5;" : "")">
|
||||
<ChildContent>
|
||||
<span>@formattedName</span>
|
||||
</ChildContent>
|
||||
<ControlContent>
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close"
|
||||
Size="Size.Small"
|
||||
Color="Color.Error"
|
||||
Variant="Variant.Text"
|
||||
OnClick="@(() => OnToggleStudentExclusion.InvokeAsync((team.Id, TimeSlotIndex, student.Id)))"
|
||||
Style="padding: 0; min-width: 16px; width: 16px; height: 16px; margin-left: 4px;" />
|
||||
</ControlContent>
|
||||
</InteractiveChip>
|
||||
}
|
||||
else
|
||||
{
|
||||
<MudChip T="string"
|
||||
Size="Size.Small"
|
||||
Color="@chipColor"
|
||||
Variant="Variant.Outlined"
|
||||
Style="@(isExcluded ? "opacity: 0.5;" : "")">
|
||||
<MudStack Row="true" Spacing="1" AlignItems="AlignItems.Center">
|
||||
<span>@formattedName</span>
|
||||
@if (_hoveredStudent == (team.Id, student.Id) && nonExcludedStudentCount > 1)
|
||||
{
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Close"
|
||||
Size="Size.Small"
|
||||
Color="Color.Error"
|
||||
Variant="Variant.Text"
|
||||
OnClick="@(() => OnToggleStudentExclusion.InvokeAsync((team.Id, TimeSlotIndex, student.Id)))"
|
||||
Style="padding: 0; min-width: 16px; width: 16px; height: 16px; margin-left: 4px;" />
|
||||
}
|
||||
</MudStack>
|
||||
<span>@formattedName</span>
|
||||
</MudChip>
|
||||
</MudStack>
|
||||
}
|
||||
}
|
||||
</MudStack>
|
||||
</MudStack>
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user