From 1cd83911144049054441f3bad7e8255211d01742 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Wed, 11 Aug 2021 10:13:39 -0500 Subject: [PATCH] Show cancelled state. --- .../Upcoming Events/UpcomingEventViewItem.swift | 12 ++++++++++-- .../Upcoming Events/UpcomingEventsDataSource.swift | 8 ++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift b/Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift index 8fb8a80..0f01146 100644 --- a/Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift +++ b/Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift @@ -24,15 +24,23 @@ class UpcomingEventViewItem: NSCollectionViewItem { _ subtitle: String, _ color: NSColor, _ meetingURL: URL?, - _ delegate: UpcomingEventPanelDelegate?) { + _ delegate: UpcomingEventPanelDelegate?, + _ isCancelled: Bool) { if leadingConstraint.constant != 5 { leadingConstraint.constant = 5 } calendarColorView.layer?.backgroundColor = color.cgColor - eventTitleLabel.stringValue = title setCalendarButtonTitle(buttonTitle: subtitle) panelDelegate = delegate + + if isCancelled { + let strikethroughString = NSAttributedString(string: title, attributes: [NSAttributedString.Key.strikethroughStyle: NSUnderlineStyle.single.rawValue, + NSAttributedString.Key.strikethroughColor: NSColor.gray]) + eventTitleLabel.attributedStringValue = strikethroughString + } else { + eventTitleLabel.stringValue = title + } if meetingURL != nil { zoomButton.isHidden = false diff --git a/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift b/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift index ceb80cb..316b1a9 100644 --- a/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift +++ b/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift @@ -39,8 +39,12 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti let currentEventInfo = upcomingEvents[indexPath.item] let upcomingEventSubtitle = currentEventInfo.isAllDay ? "All-Day" : currentEventInfo.metadataForMeeting() - item.setup(currentEventInfo.event.title, upcomingEventSubtitle, currentEventInfo.event.calendar.color, - currentEventInfo.meetingURL, delegate) + item.setup(currentEventInfo.event.title, + upcomingEventSubtitle, + currentEventInfo.event.calendar.color, + currentEventInfo.meetingURL, + delegate, + currentEventInfo.event.status == .canceled) return item }