瀏覽代碼

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 5 天之前
父節點
當前提交
d734f22cb8
共有 1 個文件被更改,包括 14 次插入3 次删除
  1. 14 3
      zoom_app/ViewController.swift

+ 14 - 3
zoom_app/ViewController.swift

@@ -1071,11 +1071,14 @@ class ViewController: NSViewController {
1071 1071
         meetingsScrollView.hasHorizontalScroller = false
1072 1072
         meetingsScrollView.autohidesScrollers = true
1073 1073
 
1074
-        let meetingsDocument = NSView()
1074
+        let meetingsDocument = FlippedView()
1075 1075
         let meetingsStack = NSStackView()
1076 1076
         meetingsStack.orientation = .vertical
1077 1077
         meetingsStack.spacing = 14
1078 1078
         meetingsStack.alignment = .leading
1079
+        // Keep meeting cards pinned to the top of the scroll content.
1080
+        meetingsStack.setContentHuggingPriority(.required, for: .vertical)
1081
+        meetingsStack.setContentCompressionResistancePriority(.required, for: .vertical)
1079 1082
         let openRecordings = NSButton(title: "Open recordings", target: nil, action: nil)
1080 1083
         openRecordings.isBordered = false
1081 1084
         openRecordings.font = .systemFont(ofSize: 14, weight: .semibold)
@@ -1202,7 +1205,7 @@ class ViewController: NSViewController {
1202 1205
             meetingsStack.topAnchor.constraint(equalTo: meetingsDocument.topAnchor),
1203 1206
             meetingsStack.leadingAnchor.constraint(equalTo: meetingsDocument.leadingAnchor),
1204 1207
             meetingsStack.trailingAnchor.constraint(equalTo: meetingsDocument.trailingAnchor),
1205
-            meetingsStack.bottomAnchor.constraint(equalTo: meetingsDocument.bottomAnchor),
1208
+            meetingsStack.bottomAnchor.constraint(lessThanOrEqualTo: meetingsDocument.bottomAnchor),
1206 1209
 
1207 1210
             openRecordings.leadingAnchor.constraint(equalTo: panel.leadingAnchor, constant: 14),
1208 1211
             openRecordings.trailingAnchor.constraint(equalTo: panel.trailingAnchor, constant: -14),
@@ -1723,12 +1726,17 @@ private final class SearchPillTextField: NSTextField {
1723 1726
     }
1724 1727
 }
1725 1728
 
1729
+private final class FlippedView: NSView {
1730
+    override var isFlipped: Bool { true }
1731
+}
1732
+
1726 1733
 private final class MeetingCardView: NSView {
1727 1734
     private let url: URL?
1728 1735
     private var tracking: NSTrackingArea?
1729 1736
     private var isHovering = false
1730 1737
     private var normalBackgroundColor: CGColor?
1731 1738
     private var normalBorderColor: CGColor?
1739
+    private var normalBorderWidth: CGFloat?
1732 1740
 
1733 1741
     init(url: URL?) {
1734 1742
         self.url = url
@@ -1780,12 +1788,15 @@ private final class MeetingCardView: NSView {
1780 1788
         guard let layer else { return }
1781 1789
         if normalBackgroundColor == nil { normalBackgroundColor = layer.backgroundColor }
1782 1790
         if normalBorderColor == nil { normalBorderColor = layer.borderColor }
1791
+        if normalBorderWidth == nil { normalBorderWidth = layer.borderWidth }
1783 1792
         if isHovering {
1784 1793
             layer.backgroundColor = NSColor.white.withAlphaComponent(0.075).cgColor
1785
-            layer.borderColor = NSColor.white.withAlphaComponent(0.12).cgColor
1794
+            layer.borderColor = NSColor.white.withAlphaComponent(0.85).cgColor
1795
+            layer.borderWidth = max(1.5, layer.borderWidth)
1786 1796
         } else {
1787 1797
             layer.backgroundColor = normalBackgroundColor
1788 1798
             layer.borderColor = normalBorderColor
1799
+            if let normalBorderWidth { layer.borderWidth = normalBorderWidth }
1789 1800
         }
1790 1801
     }
1791 1802
 }