From 45e1189c7759c353b2d5c9f40f32aa1b83523a03 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Wed, 10 Aug 2022 08:47:58 -0400 Subject: [PATCH] Fix truncated upcoming event cells. --- Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift b/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift index 85ec97fa..4fec0843 100644 --- a/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift +++ b/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift @@ -60,7 +60,8 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti } else { let currentEventInfo = upcomingEvents[indexPath.item] let bufferWidth: CGFloat = currentEventInfo.meetingURL != nil ? 60.0 : 20.0 - let attributedString = NSAttributedString(string: currentEventInfo.event.title, attributes: [NSAttributedString.Key.font: avenirBookFont]) + let longerString = currentEventInfo.event.title.count >= currentEventInfo.metadataForMeeting().count ? currentEventInfo.event.title : currentEventInfo.metadataForMeeting() + let attributedString = NSAttributedString(string: longerString ?? CLEmptyString, attributes: [NSAttributedString.Key.font: avenirBookFont]) let maxWidth = min(attributedString.size().width + bufferWidth, UpcomingEventsDataSource.panelWidth / 2) return NSSize(width: maxWidth, height: collectionView.frame.height - 20) }