浏览代码

Fix Print Contacts list layout and white row styling.

Contacts now scroll from the top with white search and row backgrounds instead of blue pills at the bottom.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 月之前
父节点
当前提交
c236ead0fc
共有 1 个文件被更改,包括 27 次插入8 次删除
  1. 27 8
      smart_printer/PrintContactsView.swift

+ 27 - 8
smart_printer/PrintContactsView.swift

@@ -102,6 +102,7 @@ final class PrintContactsOverlayView: NSView, AppearanceRefreshable {
     private let searchIconView = NSImageView()
     private let searchField = NSTextField()
     private let scrollView = NSScrollView()
+    private let listDocumentView = FlippedDocumentView()
     private let listStack = NSStackView()
     private let printButton = PrintContactsPrintButton()
     private let emptyLabel = NSTextField(labelWithString: "No contacts found")
@@ -141,7 +142,8 @@ final class PrintContactsOverlayView: NSView, AppearanceRefreshable {
 
     func refreshAppearance() {
         layer?.backgroundColor = AppTheme.background.cgColor
-        searchContainer.layer?.backgroundColor = AppTheme.blueLight.cgColor
+        searchContainer.layer?.backgroundColor = AppTheme.cardBackground.cgColor
+        searchContainer.layer?.borderColor = AppTheme.paywallBorder.cgColor
         searchField.textColor = AppTheme.textPrimary
         searchField.backgroundColor = .clear
         searchIconView.contentTintColor = AppTheme.textSecondary
@@ -188,6 +190,7 @@ final class PrintContactsOverlayView: NSView, AppearanceRefreshable {
 
         searchContainer.wantsLayer = true
         searchContainer.layer?.cornerRadius = searchHeight / 2
+        searchContainer.layer?.borderWidth = 1
         searchContainer.translatesAutoresizingMaskIntoConstraints = false
 
         if let image = NSImage(systemSymbolName: "magnifyingglass", accessibilityDescription: "Search") {
@@ -223,12 +226,15 @@ final class PrintContactsOverlayView: NSView, AppearanceRefreshable {
         listStack.spacing = 12
         listStack.translatesAutoresizingMaskIntoConstraints = false
 
+        listDocumentView.translatesAutoresizingMaskIntoConstraints = false
+        listDocumentView.addSubview(listStack)
+
         emptyLabel.font = AppTheme.regularFont(size: 14)
         emptyLabel.alignment = .center
         emptyLabel.isHidden = true
         emptyLabel.translatesAutoresizingMaskIntoConstraints = false
 
-        scrollView.documentView = listStack
+        scrollView.documentView = listDocumentView
 
         backButton.translatesAutoresizingMaskIntoConstraints = false
         printButton.translatesAutoresizingMaskIntoConstraints = false
@@ -269,10 +275,15 @@ final class PrintContactsOverlayView: NSView, AppearanceRefreshable {
             scrollView.topAnchor.constraint(equalTo: searchContainer.bottomAnchor, constant: 16),
             scrollView.bottomAnchor.constraint(equalTo: printButton.topAnchor, constant: -28),
 
-            listStack.leadingAnchor.constraint(equalTo: scrollView.contentView.leadingAnchor),
-            listStack.trailingAnchor.constraint(equalTo: scrollView.contentView.trailingAnchor),
-            listStack.topAnchor.constraint(equalTo: scrollView.contentView.topAnchor),
-            listStack.widthAnchor.constraint(equalTo: scrollView.widthAnchor),
+            listDocumentView.topAnchor.constraint(equalTo: scrollView.contentView.topAnchor),
+            listDocumentView.leadingAnchor.constraint(equalTo: scrollView.contentView.leadingAnchor),
+            listDocumentView.trailingAnchor.constraint(equalTo: scrollView.contentView.trailingAnchor),
+            listDocumentView.widthAnchor.constraint(equalTo: scrollView.contentView.widthAnchor),
+
+            listStack.leadingAnchor.constraint(equalTo: listDocumentView.leadingAnchor),
+            listStack.trailingAnchor.constraint(equalTo: listDocumentView.trailingAnchor),
+            listStack.topAnchor.constraint(equalTo: listDocumentView.topAnchor),
+            listStack.bottomAnchor.constraint(equalTo: listDocumentView.bottomAnchor),
 
             emptyLabel.centerXAnchor.constraint(equalTo: centerXAnchor),
             emptyLabel.centerYAnchor.constraint(equalTo: scrollView.centerYAnchor),
@@ -403,12 +414,14 @@ private final class ContactRowView: NSControl, AppearanceRefreshable {
     required init?(coder: NSCoder) { nil }
 
     func refreshAppearance() {
-        layer?.borderWidth = 0
         if isSelected {
+            layer?.borderWidth = 0
             layer?.backgroundColor = AppTheme.homeActiveBackground.cgColor
             nameLabel.textColor = AppTheme.homeActiveForeground
         } else {
-            layer?.backgroundColor = AppTheme.blue.withAlphaComponent(0.14).cgColor
+            layer?.borderWidth = 1
+            layer?.borderColor = AppTheme.paywallBorder.cgColor
+            layer?.backgroundColor = AppTheme.cardBackground.cgColor
             nameLabel.textColor = AppTheme.textPrimary
         }
     }
@@ -563,3 +576,9 @@ private final class PrintContactsPrintButton: NSControl, AppearanceRefreshable {
         addCursorRect(bounds, cursor: .pointingHand)
     }
 }
+
+// MARK: - Flipped Document View
+
+private final class FlippedDocumentView: NSView {
+    override var isFlipped: Bool { true }
+}