Переглянути джерело

Fix meetings list layout and hover

Pin meeting cards to the top in the scroll view and strengthen hover styling with a brighter border.

Made-with: Cursor
huzaifahayat12 3 місяців тому
батько
коміт
d734f22cb8
1 змінених файлів з 14 додано та 3 видалено
  1. 14 3
      zoom_app/ViewController.swift

+ 14 - 3
zoom_app/ViewController.swift

@@ -1071,11 +1071,14 @@ class ViewController: NSViewController {
         meetingsScrollView.hasHorizontalScroller = false
         meetingsScrollView.autohidesScrollers = true
 
-        let meetingsDocument = NSView()
+        let meetingsDocument = FlippedView()
         let meetingsStack = NSStackView()
         meetingsStack.orientation = .vertical
         meetingsStack.spacing = 14
         meetingsStack.alignment = .leading
+        // Keep meeting cards pinned to the top of the scroll content.
+        meetingsStack.setContentHuggingPriority(.required, for: .vertical)
+        meetingsStack.setContentCompressionResistancePriority(.required, for: .vertical)
         let openRecordings = NSButton(title: "Open recordings", target: nil, action: nil)
         openRecordings.isBordered = false
         openRecordings.font = .systemFont(ofSize: 14, weight: .semibold)
@@ -1202,7 +1205,7 @@ class ViewController: NSViewController {
             meetingsStack.topAnchor.constraint(equalTo: meetingsDocument.topAnchor),
             meetingsStack.leadingAnchor.constraint(equalTo: meetingsDocument.leadingAnchor),
             meetingsStack.trailingAnchor.constraint(equalTo: meetingsDocument.trailingAnchor),
-            meetingsStack.bottomAnchor.constraint(equalTo: meetingsDocument.bottomAnchor),
+            meetingsStack.bottomAnchor.constraint(lessThanOrEqualTo: meetingsDocument.bottomAnchor),
 
             openRecordings.leadingAnchor.constraint(equalTo: panel.leadingAnchor, constant: 14),
             openRecordings.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -14),
@@ -1723,12 +1726,17 @@ private final class SearchPillTextField: NSTextField {
     }
 }
 
+private final class FlippedView: NSView {
+    override var isFlipped: Bool { true }
+}
+
 private final class MeetingCardView: NSView {
     private let url: URL?
     private var tracking: NSTrackingArea?
     private var isHovering = false
     private var normalBackgroundColor: CGColor?
     private var normalBorderColor: CGColor?
+    private var normalBorderWidth: CGFloat?
 
     init(url: URL?) {
         self.url = url
@@ -1780,12 +1788,15 @@ private final class MeetingCardView: NSView {
         guard let layer else { return }
         if normalBackgroundColor == nil { normalBackgroundColor = layer.backgroundColor }
         if normalBorderColor == nil { normalBorderColor = layer.borderColor }
+        if normalBorderWidth == nil { normalBorderWidth = layer.borderWidth }
         if isHovering {
             layer.backgroundColor = NSColor.white.withAlphaComponent(0.075).cgColor
-            layer.borderColor = NSColor.white.withAlphaComponent(0.12).cgColor
+            layer.borderColor = NSColor.white.withAlphaComponent(0.85).cgColor
+            layer.borderWidth = max(1.5, layer.borderWidth)
         } else {
             layer.backgroundColor = normalBackgroundColor
             layer.borderColor = normalBorderColor
+            if let normalBorderWidth { layer.borderWidth = normalBorderWidth }
         }
     }
 }