Pārlūkot izejas kodu

Fix meeting card click handling across schedule carousel.

Use native button actions per card for reliable click behavior on all cards and truncate long titles so the date chip remains visible.

Made-with: Cursor
huzaifahayat12 3 mēneši atpakaļ
vecāks
revīzija
e443a31d71
1 mainītis faili ar 14 papildinājumiem un 4 dzēšanām
  1. 14 4
      meetings_app/ViewController.swift

+ 14 - 4
meetings_app/ViewController.swift

@@ -1970,6 +1970,9 @@ private extension ViewController {
         ])
 
         let title = textLabel(meeting.title, font: typography.cardTitle, color: palette.textPrimary)
+        title.lineBreakMode = .byTruncatingTail
+        title.maximumNumberOfLines = 1
+        title.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
         let subtitle = textLabel(meeting.subtitle ?? "Google Calendar", font: typography.cardSubtitle, color: palette.textPrimary)
         let time = textLabel(scheduleTimeText(for: meeting), font: typography.cardTime, color: palette.textSecondary)
         let duration = textLabel(scheduleDurationText(for: meeting), font: NSFont.systemFont(ofSize: 11, weight: .medium), color: palette.textMuted)
@@ -2004,6 +2007,7 @@ private extension ViewController {
             title.leadingAnchor.constraint(equalTo: icon.trailingAnchor, constant: 6),
             title.centerYAnchor.constraint(equalTo: icon.centerYAnchor),
             title.trailingAnchor.constraint(lessThanOrEqualTo: dayChip.leadingAnchor, constant: -8),
+            title.widthAnchor.constraint(lessThanOrEqualToConstant: 130),
 
             subtitle.leadingAnchor.constraint(equalTo: card.leadingAnchor, constant: 10),
             subtitle.topAnchor.constraint(equalTo: icon.bottomAnchor, constant: 10),
@@ -2018,8 +2022,11 @@ private extension ViewController {
             duration.trailingAnchor.constraint(lessThanOrEqualTo: card.trailingAnchor, constant: -10)
         ])
 
-        let hit = HoverTrackingView()
+        let hit = HoverButton(title: "", target: self, action: #selector(scheduleCardButtonPressed(_:)))
         hit.translatesAutoresizingMaskIntoConstraints = false
+        hit.isBordered = false
+        hit.bezelStyle = .regularSquare
+        hit.identifier = NSUserInterfaceItemIdentifier(meeting.meetURL.absoluteString)
         hit.addSubview(card)
         NSLayoutConstraint.activate([
             card.leadingAnchor.constraint(equalTo: hit.leadingAnchor),
@@ -2027,9 +2034,6 @@ private extension ViewController {
             card.topAnchor.constraint(equalTo: hit.topAnchor),
             card.bottomAnchor.constraint(equalTo: hit.bottomAnchor)
         ])
-        hit.onClick = { [weak self] in
-            self?.openMeetingURL(meeting.meetURL)
-        }
         hit.onHoverChanged = { [weak self] hovering in
             guard let self else { return }
             let base = self.palette.sectionCard
@@ -2621,6 +2625,12 @@ private extension ViewController {
         scrollScheduleCards(direction: 1)
     }
 
+    @objc func scheduleCardButtonPressed(_ sender: NSButton) {
+        guard let raw = sender.identifier?.rawValue,
+              let url = URL(string: raw) else { return }
+        openMeetingURL(url)
+    }
+
     @objc func scheduleConnectButtonPressed(_ sender: NSButton) {
         scheduleConnectClicked()
     }