Преглед на файлове

Center paywall footer links in equal-width columns and remove dividers.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 преди 5 часа
родител
ревизия
0a8c9098d7
променени са 1 файла, в които са добавени 19 реда и са изтрити 31 реда
  1. 19 31
      smart_printer/PaywallView.swift

+ 19 - 31
smart_printer/PaywallView.swift

@@ -708,23 +708,21 @@ final class PaywallView: NSView, AppearanceRefreshable {
708 708
         let termsLink = PaywallFooterLink(title: "Terms of Service")
709 709
         let supportLink = PaywallFooterLink(title: "Support")
710 710
 
711
-        let links: [(PaywallFooterLink, Bool)] = [
712
-            (continueWithFreePlanLink, true),
713
-            (restoreLink, true),
714
-            (privacyLink, true),
715
-            (termsLink, true),
716
-            (supportLink, false),
711
+        let links = [
712
+            continueWithFreePlanLink,
713
+            restoreLink,
714
+            privacyLink,
715
+            termsLink,
716
+            supportLink,
717 717
         ]
718 718
 
719
-        let linkGroups = links.map { link, showsSeparator in
720
-            makeFooterLinkGroup(link: link, showsSeparator: showsSeparator)
721
-        }
719
+        let linkCells = links.map { makeFooterLinkCell(link: $0) }
722 720
 
723
-        let linksStack = NSStackView(views: linkGroups)
721
+        let linksStack = NSStackView(views: linkCells)
724 722
         linksStack.orientation = .horizontal
725 723
         linksStack.spacing = 0
726 724
         linksStack.alignment = .centerY
727
-        linksStack.distribution = .equalSpacing
725
+        linksStack.distribution = .fillEqually
728 726
         linksStack.translatesAutoresizingMaskIntoConstraints = false
729 727
 
730 728
         container.addSubview(linksStack)
@@ -738,29 +736,19 @@ final class PaywallView: NSView, AppearanceRefreshable {
738 736
         return container
739 737
     }
740 738
 
741
-    private func makeFooterLinkGroup(link: PaywallFooterLink, showsSeparator: Bool) -> NSView {
742
-        let group = NSStackView()
743
-        group.orientation = .horizontal
744
-        group.spacing = 8
745
-        group.alignment = .centerY
746
-        group.translatesAutoresizingMaskIntoConstraints = false
747
-        group.addArrangedSubview(link)
748
-        if showsSeparator {
749
-            group.addArrangedSubview(makeFooterSeparator())
750
-        }
751
-        return group
752
-    }
739
+    private func makeFooterLinkCell(link: PaywallFooterLink) -> NSView {
740
+        let cell = NSView()
741
+        cell.translatesAutoresizingMaskIntoConstraints = false
753 742
 
754
-    private func makeFooterSeparator() -> NSView {
755
-        let separator = NSView()
756
-        separator.translatesAutoresizingMaskIntoConstraints = false
757
-        separator.wantsLayer = true
758
-        separator.layer?.backgroundColor = AppTheme.paywallBorder.cgColor
743
+        cell.addSubview(link)
759 744
         NSLayoutConstraint.activate([
760
-            separator.widthAnchor.constraint(equalToConstant: 1),
761
-            separator.heightAnchor.constraint(equalToConstant: 12),
745
+            link.centerXAnchor.constraint(equalTo: cell.centerXAnchor),
746
+            link.centerYAnchor.constraint(equalTo: cell.centerYAnchor),
747
+            link.topAnchor.constraint(equalTo: cell.topAnchor),
748
+            link.bottomAnchor.constraint(equalTo: cell.bottomAnchor),
762 749
         ])
763
-        return separator
750
+
751
+        return cell
764 752
     }
765 753
 
766 754
     private func selectPlan(_ plan: PaywallPlan) {