Bladeren bron

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