cc6e0d71a7
This commit updates the Calendar component to include the ITeamMeetingHistoryService, allowing for the loading and display of meeting histories alongside event occurrences. The calendar items are now wrapped in CalendarItemWrapper to accommodate both events and meetings. Additionally, error handling and logging are implemented to ensure robustness during the loading process. This enhancement improves the overall functionality and user experience of the calendar feature by providing a comprehensive view of both events and meetings.
72 lines
2.0 KiB
C#
72 lines
2.0 KiB
C#
using Heron.MudCalendar;
|
|
|
|
namespace WebApp.Models;
|
|
|
|
/// <summary>
|
|
/// Type discriminator for calendar item types.
|
|
/// </summary>
|
|
public enum CalendarItemType
|
|
{
|
|
Event,
|
|
Meeting
|
|
}
|
|
|
|
/// <summary>
|
|
/// Wrapper class for calendar items that can hold either a CalendarEventItem or CalendarMeetingItem.
|
|
/// This allows MudCalendar to display mixed item types while maintaining type safety.
|
|
/// </summary>
|
|
public class CalendarItemWrapper : CalendarItem
|
|
{
|
|
/// <summary>
|
|
/// Gets the type of calendar item this wrapper contains.
|
|
/// </summary>
|
|
public CalendarItemType ItemType { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets the wrapped CalendarEventItem if ItemType is Event, otherwise null.
|
|
/// </summary>
|
|
public CalendarEventItem? EventItem { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Gets the wrapped CalendarMeetingItem if ItemType is Meeting, otherwise null.
|
|
/// </summary>
|
|
public CalendarMeetingItem? MeetingItem { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Parameterless constructor required by Heron.MudCalendar component.
|
|
/// </summary>
|
|
public CalendarItemWrapper()
|
|
{
|
|
// Initialize base class properties to avoid null reference issues
|
|
Text = string.Empty;
|
|
Start = DateTime.MinValue;
|
|
End = DateTime.MinValue;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a wrapper for a CalendarEventItem.
|
|
/// </summary>
|
|
public CalendarItemWrapper(CalendarEventItem eventItem)
|
|
{
|
|
ItemType = CalendarItemType.Event;
|
|
EventItem = eventItem;
|
|
// Delegate properties to wrapped item
|
|
Text = eventItem.Text;
|
|
Start = eventItem.Start;
|
|
End = eventItem.End;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a wrapper for a CalendarMeetingItem.
|
|
/// </summary>
|
|
public CalendarItemWrapper(CalendarMeetingItem meetingItem)
|
|
{
|
|
ItemType = CalendarItemType.Meeting;
|
|
MeetingItem = meetingItem;
|
|
// Delegate properties to wrapped item
|
|
Text = meetingItem.Text;
|
|
Start = meetingItem.Start;
|
|
End = meetingItem.End;
|
|
}
|
|
}
|