Use PageHeader throughout the system

This commit is contained in:
2025-12-25 21:53:15 -05:00
parent 1e36a5661b
commit 023e6c289a
19 changed files with 199 additions and 164 deletions
+27 -16
View File
@@ -1,14 +1,26 @@
@page "/teams/create"
@attribute [Authorize]
@using Microsoft.EntityFrameworkCore
@using WebApp.Components.Shared.Components
@inject AppDbContext Context
@inject NavigationManager NavigationManager
<PageTitle>Create Team - TSA Chapter Organizer</PageTitle>
@if (_events is null)
{
<p><em>Loading...</em></p>
return;
}
<MudText Typo="Typo.h3">Create</MudText>
<MudText Typo="Typo.h4">Team</MudText>
<MudDivider />
<PageHeader
Title="Create"
Subtitle="Team"
ShowBackButton="true"
BackButtonUrl="/teams">
<ActionButtons>
<MudButton OnClick="AddTeam" Variant="Variant.Filled" Color="Color.Primary">Add</MudButton>
<MudButton Href="/teams" Variant="Variant.Text">Cancel</MudButton>
</ActionButtons>
</PageHeader>
<EditForm method="post" Model="Team" OnValidSubmit="AddTeam" FormName="create" Enhance>
<AntiforgeryToken />
@@ -23,17 +35,18 @@
<MudSelectItem T="EventDefinition" Value="@(evt)"></MudSelectItem>
}
</MudSelect>
@if (_existingTeams?.Count == 1)
@switch (_existingTeams?.Count)
{
<MudAlert Severity="Severity.Info" Class="my-2">
A team for @Team.Event.Name already exists. This will be team 2, and the existing team will become team 1.
</MudAlert>
}
else if (_existingTeams?.Count >= 2)
{
<MudAlert Severity="Severity.Error" Class="my-2">
Two teams for @Team.Event.Name already exist. Cannot create a third team.
</MudAlert>
case 1:
<MudAlert Severity="Severity.Info" Class="my-2">
A team for @Team.Event.Name already exists. This will be team 2, and the existing team will become team 1.
</MudAlert>
break;
case >= 2:
<MudAlert Severity="Severity.Error" Class="my-2">
Two teams for @Team.Event.Name already exist. Cannot create a third team.
</MudAlert>
break;
}
<MudDivider Class="my-4" />
@@ -55,8 +68,6 @@
{
<MudAlert Severity="Severity.Error" Class="mt-3">@_errorMessage</MudAlert>
}
<MudButton StartIcon="@Icons.Material.Filled.ArrowBack" Href="students">Back</MudButton>
<MudButton StartIcon="@Icons.Material.Filled.Add" OnClick="AddTeam">Add</MudButton>
</EditForm>
@code {