diff --git a/Wino.Calendar.ViewModels/EventDetailsPageViewModel.cs b/Wino.Calendar.ViewModels/EventDetailsPageViewModel.cs index fe33de02..ee2e824a 100644 --- a/Wino.Calendar.ViewModels/EventDetailsPageViewModel.cs +++ b/Wino.Calendar.ViewModels/EventDetailsPageViewModel.cs @@ -27,8 +27,19 @@ public partial class EventDetailsPageViewModel : CalendarBaseViewModel private readonly IMailDialogService _dialogService; private readonly IWinoRequestDelegator _winoRequestDelegator; private readonly INavigationService _navigationService; + private readonly IUnderlyingThemeService _underlyingThemeService; public CalendarSettings CurrentSettings { get; } + public INativeAppService NativeAppService => _nativeAppService; + + [ObservableProperty] + public partial bool IsDarkWebviewRenderer { get; set; } + + /// + /// Returns true if the current event has attachments. + /// Currently always returns false until attachments are implemented. + /// + public bool HasAttachments => false; // TODO: Implement when CalendarItem attachments are added #region Details @@ -40,6 +51,12 @@ public partial class EventDetailsPageViewModel : CalendarBaseViewModel [NotifyPropertyChangedFor(nameof(CurrentRsvpStatus))] public partial CalendarItemViewModel CurrentEvent { get; set; } + partial void OnCurrentEventChanged(CalendarItemViewModel value) + { + // Notify the view to re-render the description + Messenger.Send(new CalendarDescriptionRenderingRequested()); + } + [ObservableProperty] public partial CalendarItemViewModel SeriesParent { get; set; } [ObservableProperty] @@ -127,7 +144,8 @@ public partial class EventDetailsPageViewModel : CalendarBaseViewModel IPreferencesService preferencesService, IMailDialogService dialogService, IWinoRequestDelegator winoRequestDelegator, - INavigationService navigationService) + INavigationService navigationService, + IUnderlyingThemeService underlyingThemeService) { _calendarService = calendarService; _nativeAppService = nativeAppService; @@ -135,8 +153,10 @@ public partial class EventDetailsPageViewModel : CalendarBaseViewModel _dialogService = dialogService; _winoRequestDelegator = winoRequestDelegator; _navigationService = navigationService; + _underlyingThemeService = underlyingThemeService; CurrentSettings = _preferencesService.GetCurrentCalendarSettings(); + IsDarkWebviewRenderer = _underlyingThemeService.IsUnderlyingThemeDark(); // Initialize RSVP status options RsvpStatusOptions.Add(new RsvpStatusOption(CalendarItemStatus.Accepted)); diff --git a/Wino.Core.Domain/Translations/en_US/resources.json b/Wino.Core.Domain/Translations/en_US/resources.json index 8168f1b6..a25d0c29 100644 --- a/Wino.Core.Domain/Translations/en_US/resources.json +++ b/Wino.Core.Domain/Translations/en_US/resources.json @@ -97,6 +97,10 @@ "CalendarEventRsvpPanel_SendReplyMessage": "Send a reply message", "CalendarEventRsvpPanel_Tentative": "Tentative", "CalendarEventRsvpPanel_Title": "Response Options", + "CalendarAttendeeStatus_Accepted": "Accepted", + "CalendarAttendeeStatus_Declined": "Declined", + "CalendarAttendeeStatus_NeedsAction": "Needs Action", + "CalendarAttendeeStatus_Tentative": "Tentative", "CalendarEventDetails_Attachments": "Attachments", "CalendarEventDetails_Details": "Details", "CalendarEventDetails_EditSeries": "Edit Series", diff --git a/Wino.Mail.WinUI/Helpers/CalendarXamlHelpers.cs b/Wino.Mail.WinUI/Helpers/CalendarXamlHelpers.cs index 23f06614..612c47cc 100644 --- a/Wino.Mail.WinUI/Helpers/CalendarXamlHelpers.cs +++ b/Wino.Mail.WinUI/Helpers/CalendarXamlHelpers.cs @@ -110,4 +110,31 @@ public static class CalendarXamlHelpers /// public static bool HasOnlineMeetingLink(CalendarItemViewModel calendarItemViewModel) => calendarItemViewModel != null && !string.IsNullOrEmpty(calendarItemViewModel.CalendarItem?.HtmlLink); + + /// + /// Returns the text representation of an attendee's status. + /// + public static string GetAttendeeStatusText(AttendeeStatus status) + { + return status switch + { + AttendeeStatus.Accepted => Translator.CalendarAttendeeStatus_Accepted, + AttendeeStatus.Declined => Translator.CalendarAttendeeStatus_Declined, + AttendeeStatus.Tentative => Translator.CalendarAttendeeStatus_Tentative, + AttendeeStatus.NeedsAction => Translator.CalendarAttendeeStatus_NeedsAction, + _ => string.Empty + }; + } + + /// + /// Returns visibility for attendee status badge. + /// Only shows status for non-organizers and when status is not NeedsAction. + /// + public static Microsoft.UI.Xaml.Visibility GetAttendeeStatusVisibility(AttendeeStatus status) + { + // Don't show "Needs Action" status as it's the default + return status == AttendeeStatus.NeedsAction + ? Microsoft.UI.Xaml.Visibility.Collapsed + : Microsoft.UI.Xaml.Visibility.Visible; + } } diff --git a/Wino.Mail.WinUI/Views/Calendar/EventDetailsPage.xaml b/Wino.Mail.WinUI/Views/Calendar/EventDetailsPage.xaml index 23967693..63472a39 100644 --- a/Wino.Mail.WinUI/Views/Calendar/EventDetailsPage.xaml +++ b/Wino.Mail.WinUI/Views/Calendar/EventDetailsPage.xaml @@ -162,7 +162,10 @@ Background="{ThemeResource DividerStrokeColorDefaultBrush}" /> -