c9ef169989
Updated the Calendar component's route from "/event-calendar" to "/calendar" for clarity. Enhanced the Home component to provide dynamic content based on the presence of students and teams, introducing new sections for "Getting Started" and "Team Building". Improved the DashboardCard component to support emphasized styling for better visual hierarchy. Updated the navigation menu to reflect these changes and ensure a more intuitive user experience.
68 lines
2.0 KiB
Plaintext
68 lines
2.0 KiB
Plaintext
@page "/calendar"
|
|
@attribute [Authorize]
|
|
@using WebApp.Components.Shared.Components
|
|
@using WebApp.Models
|
|
@using WebApp.Services
|
|
@using Heron.MudCalendar
|
|
@inject IEventOccurrenceService EventOccurrenceService
|
|
|
|
<PageHeader Title="Event Calendar" Description="View competition schedules and event occurrences">
|
|
<ActionButtons>
|
|
<MudButton StartIcon="@Icons.Material.Filled.ImportExport" Href="calendar/event-occurrences/import" Variant="Variant.Filled" Color="Color.Primary">Import</MudButton>
|
|
</ActionButtons>
|
|
</PageHeader>
|
|
|
|
<MudPaper Elevation="2" Class="pa-6">
|
|
@if (_calendarItems == null)
|
|
{
|
|
<MudProgressLinear Indeterminate="true" />
|
|
<MudText>Loading calendar events...</MudText>
|
|
}
|
|
else
|
|
{
|
|
<MudCalendar T="CalendarEventItem"
|
|
Items="_calendarItems"
|
|
View="CalendarView.Day"
|
|
CurrentDay=_calendarDate
|
|
/>
|
|
}
|
|
</MudPaper>
|
|
|
|
@code {
|
|
private List<CalendarEventItem>? _calendarItems;
|
|
private DateTime _calendarDate = DateTime.Today;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await LoadCalendarEvents();
|
|
}
|
|
|
|
private async Task LoadCalendarEvents()
|
|
{
|
|
var occurrences = await EventOccurrenceService.GetEventOccurrencesAsync();
|
|
_calendarItems = occurrences
|
|
.Select(occ => new CalendarEventItem(occ))
|
|
.ToList();
|
|
|
|
// Find the next date with events
|
|
_calendarDate = GetNextDateWithEvents();
|
|
}
|
|
|
|
private DateTime GetNextDateWithEvents()
|
|
{
|
|
if (_calendarItems == null || !_calendarItems.Any())
|
|
{
|
|
return DateTime.Today;
|
|
}
|
|
|
|
var today = DateTime.Today;
|
|
var nextEvent = _calendarItems
|
|
.Where(item => item.Start.Date >= today)
|
|
.OrderBy(item => item.Start)
|
|
.FirstOrDefault();
|
|
|
|
return nextEvent?.Start.Date ?? _calendarItems.OrderBy(item => item.Start).First().Start.Date;
|
|
}
|
|
}
|
|
|