Files
chapter-organizer/WebApp/Components/Features/Teams/Details.razor
T
poprhythm b4c11cd0a6 Enhance UI with MudTooltip for action buttons across various components
This commit adds MudTooltip components to action buttons in the Calendar, Events, Students, and Teams features, improving user experience by providing contextual information on button actions. The changes ensure that users receive helpful hints when hovering over buttons, enhancing accessibility and usability throughout the application.
2026-01-17 10:41:46 -05:00

90 lines
2.9 KiB
Plaintext

@page "/teams/details"
@attribute [Authorize]
@using Microsoft.EntityFrameworkCore
@using WebApp.Components.Shared.Components
@using WebApp.Components.Features.Teams.Components
@inject AppDbContext Context
@inject NavigationManager NavigationManager
@inject IJSRuntime JSRuntime
@if (Team is null)
{
<p><em>Loading...</em></p>
return;
}
<PageHeader
Title="Team Details"
ShowBackButton="true"
BackButtonUrl="@(ReturnUrl ?? "/teams")">
<ActionButtons>
<div class="no-print">
<MudTooltip Text="Print">
<MudButton StartIcon="@Icons.Material.Filled.Print"
OnClick="PrintPage"
Variant="Variant.Outlined">Print</MudButton>
</MudTooltip>
<MudTooltip Text="Edit">
<MudButton StartIcon="@Icons.Material.Filled.Edit"
Href="@($"/teams/edit?id={Team.Id}&returnUrl={ReturnUrl ?? "/teams"}")"
Variant="Variant.Outlined">Edit</MudButton>
</MudTooltip>
</div>
</ActionButtons>
</PageHeader>
<MudPaper Elevation="2" Class="pa-3 pa-md-6">
<MudText Typo="Typo.h5" Class="mb-4">Team Information</MudText>
<MudGrid Spacing="3">
<MudItem xs="12" sm="6">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Event</MudText>
<MudText Typo="Typo.body1">@Team.Event.Name</MudText>
</MudItem>
<MudItem xs="12" sm="6">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Event Format</MudText>
<MudText Typo="Typo.body1">@Team.Event.EventFormat</MudText>
</MudItem>
<MudItem xs="12" sm="6">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Team Identifier</MudText>
<MudText Typo="Typo.body1">@(Team.Identifier ?? "N/A")</MudText>
</MudItem>
<MudItem xs="12" sm="6">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Captain</MudText>
<MudText Typo="Typo.body1">@(Team.Captain?.FirstNameLastName ?? "N/A")</MudText>
</MudItem>
<MudItem xs="12">
<MudText Typo="Typo.subtitle2" Class="mud-text-secondary">Team Members</MudText>
<TeamStudents Team="@Team" />
</MudItem>
</MudGrid>
</MudPaper>
@code {
[SupplyParameterFromQuery]
private int Id { get; set; }
[SupplyParameterFromQuery]
private string? ReturnUrl { get; set; }
private Team? Team { get; set; }
protected override async Task OnInitializedAsync()
{
Team = await Context.Teams
.Include(t => t.Event)
.Include(t => t.Students)
.Include(t => t.Captain)
.FirstOrDefaultAsync(m => m.Id == Id);
if (Team is null)
{
NavigationManager.NavigateTo("notfound");
}
}
private async Task PrintPage()
{
await JSRuntime.InvokeVoidAsync("window.print");
}
}