This commit introduces two new utility classes: StudentNameFormatter and TeamStudentNameFormatter, which provide methods for formatting student names with options for indicating absence and overlaps. The Team class has been updated to remove the StudentsFirstNames property, and various components across the WebApp have been refactored to utilize the new formatting utilities. This enhances the maintainability and readability of the code while improving the presentation of student names in the UI.
59 lines
1.9 KiB
Plaintext
59 lines
1.9 KiB
Plaintext
@using WebApp.Models
|
|
@using Core.Utility
|
|
|
|
@if (Title != null)
|
|
{
|
|
<MudText Typo="Typo.h4">@Title</MudText>
|
|
}
|
|
|
|
<MudToggleGroup T="Team"
|
|
SelectionMode="SelectionMode.MultiSelection"
|
|
Values="@SelectedTeams"
|
|
ValuesChanged="@OnSelectedTeamsChanged"
|
|
Vertical="true"
|
|
CheckMark>
|
|
@foreach (var team in Teams.OrderByEventFormatFirst().ThenBy(e => e.Event.Name))
|
|
{
|
|
<MudToggleItem Value="@team" Style="font-size: .75rem;">
|
|
<MudTooltip Text="@TeamStudentNameFormatter.FormatStudentList(
|
|
team,
|
|
new TeamStudentNameFormatter.FormatOptions
|
|
{
|
|
CaptainIndicator = TeamStudentNameFormatter.CaptainIndicatorStyle.Captain,
|
|
Ordering = TeamStudentNameFormatter.OrderingStyle.None
|
|
})">
|
|
<div style="display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%;">
|
|
<span class="ellipsis" style="flex: 1; min-width: 0;">@team.ToString()</span>
|
|
@if (ShowEventAttributes)
|
|
{
|
|
<EventAttributes EventDefinition="@team.Event"></EventAttributes>
|
|
}
|
|
</div>
|
|
</MudTooltip>
|
|
</MudToggleItem>
|
|
}
|
|
</MudToggleGroup>
|
|
|
|
@code {
|
|
[Parameter]
|
|
public IEnumerable<Team> Teams { get; set; } = [];
|
|
|
|
[Parameter]
|
|
public IEnumerable<Team> SelectedTeams { get; set; } = [];
|
|
|
|
[Parameter]
|
|
public EventCallback<IEnumerable<Team>> SelectedTeamsChanged { get; set; }
|
|
|
|
[Parameter]
|
|
public string? Title { get; set; }
|
|
|
|
[Parameter]
|
|
public bool ShowEventAttributes { get; set; } = true;
|
|
|
|
private async Task OnSelectedTeamsChanged(IEnumerable<Team> value)
|
|
{
|
|
SelectedTeams = value;
|
|
await SelectedTeamsChanged.InvokeAsync(value);
|
|
}
|
|
}
|