Browse Source

Show cancelled state.

pull/101/head
Abhishek 3 years ago
parent
commit
1cd8391114
  1. 12
      Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift
  2. 8
      Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

12
Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift

@ -24,15 +24,23 @@ class UpcomingEventViewItem: NSCollectionViewItem {
_ subtitle: String, _ subtitle: String,
_ color: NSColor, _ color: NSColor,
_ meetingURL: URL?, _ meetingURL: URL?,
_ delegate: UpcomingEventPanelDelegate?) { _ delegate: UpcomingEventPanelDelegate?,
_ isCancelled: Bool) {
if leadingConstraint.constant != 5 { if leadingConstraint.constant != 5 {
leadingConstraint.constant = 5 leadingConstraint.constant = 5
} }
calendarColorView.layer?.backgroundColor = color.cgColor calendarColorView.layer?.backgroundColor = color.cgColor
eventTitleLabel.stringValue = title
setCalendarButtonTitle(buttonTitle: subtitle) setCalendarButtonTitle(buttonTitle: subtitle)
panelDelegate = delegate 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 { if meetingURL != nil {
zoomButton.isHidden = false zoomButton.isHidden = false

8
Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

@ -39,8 +39,12 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
let currentEventInfo = upcomingEvents[indexPath.item] let currentEventInfo = upcomingEvents[indexPath.item]
let upcomingEventSubtitle = currentEventInfo.isAllDay ? "All-Day" : currentEventInfo.metadataForMeeting() let upcomingEventSubtitle = currentEventInfo.isAllDay ? "All-Day" : currentEventInfo.metadataForMeeting()
item.setup(currentEventInfo.event.title, upcomingEventSubtitle, currentEventInfo.event.calendar.color, item.setup(currentEventInfo.event.title,
currentEventInfo.meetingURL, delegate) upcomingEventSubtitle,
currentEventInfo.event.calendar.color,
currentEventInfo.meetingURL,
delegate,
currentEventInfo.event.status == .canceled)
return item return item
} }

Loading…
Cancel
Save