Files
chapter-organizer/WebApp/Components/Features/MeetingSchedule/UnscheduledStudentsList.razor
T
poprhythm 5fdda08627 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.
2026-01-14 10:22:44 -05:00

81 lines
3.5 KiB
Plaintext

@using Core.Calculation
@using Core.Utility
@using WebApp.Models
@if (UnscheduledStudents.Any())
{
<MudText Typo="Typo.body1" HtmlTag="strong">Unscheduled</MudText>
<MudStack>
@foreach (var student in UnscheduledStudents)
{
<MudItem>
@{
var formattedName = StudentNameFormatter.FormatStudentName(
student,
new StudentNameFormatter.FormatOptions
{
IsAbsent = AbsentStudents.Contains(student)
});
}
<MudStack Row="true" Spacing="2" AlignItems="AlignItems.Center">
<MudStack Row="true" Spacing="1" AlignItems="AlignItems.Center">
<MudChip T="string" Size="Size.Small" Variant="@AppIcons.StudentChipVariant()" Class="font-style-italic">
@formattedName
</MudChip>
</MudStack>
<MudStack Row="true" Spacing="1" Wrap="Wrap.Wrap" AlignItems="AlignItems.Center">
@foreach (var unassignedTeam in UnassignedTeams(student))
{
var isPossibleAddition = PossibleAdditions.Contains(unassignedTeam, new TeamIdComparer());
var scheduledTeamIds = ScheduledTeams.Select(t => t.Id).ToHashSet();
var isScheduled = scheduledTeamIds.Contains(unassignedTeam.Id);
var chipColor = isPossibleAddition ? Color.Success : Color.Default;
var teamMembers = TeamStudentNameFormatter.FormatStudentList(
unassignedTeam,
new TeamStudentNameFormatter.FormatOptions
{
Ordering = TeamStudentNameFormatter.OrderingStyle.None
});
<MudTooltip Text="@teamMembers">
<div @onclick="@(() => OnToggleTeam.InvokeAsync(unassignedTeam))" style="cursor: pointer; display: inline-block;">
<MudChip T="string"
Size="Size.Small"
Color="@chipColor"
Variant="@AppIcons.TeamChipVariant()">
@if (isScheduled)
{
<MudIcon Icon="@Icons.Material.Filled.Check" Size="Size.Small" Style="margin-right: 4px;" />
}
@unassignedTeam
</MudChip>
</div>
</MudTooltip>
}
</MudStack>
</MudStack>
</MudItem>
}
</MudStack>
}
@code {
[Parameter]
public IEnumerable<Student> UnscheduledStudents { get; set; } = [];
[Parameter]
public IEnumerable<Student> AbsentStudents { get; set; } = [];
[Parameter]
public IEnumerable<Team> ScheduledTeams { get; set; } = [];
[Parameter]
public IEnumerable<Team> PossibleAdditions { get; set; } = [];
[Parameter]
public Func<Student, IEnumerable<Team>> UnassignedTeams { get; set; } = null!;
[Parameter]
public EventCallback<Team> OnToggleTeam { get; set; }
}