소스 검색

Fix Widgets page layout to fill available width

Pins the Widgets page hosting view to the main content column so the
card spans the full available width instead of collapsing to its
intrinsic size, and updates the SwiftUI layout so the preview widgets
stay left-aligned at their natural size with a trailing spacer.

Co-authored-by: Cursor <cursoragent@cursor.com>
huzaifahayat12 2 달 전
부모
커밋
eddbd35974
1개의 변경된 파일21개의 추가작업 그리고 6개의 파일을 삭제
  1. 21 6
      zoom_app/ViewController.swift

+ 21 - 6
zoom_app/ViewController.swift

@@ -5482,6 +5482,11 @@ class ViewController: NSViewController {
             meetingsPageView.trailingAnchor.constraint(equalTo: mainContentColumn.trailingAnchor),
             meetingsPageView.bottomAnchor.constraint(equalTo: mainContentColumn.bottomAnchor),
 
+            widgetsPageView.topAnchor.constraint(equalTo: mainContentColumn.topAnchor),
+            widgetsPageView.leadingAnchor.constraint(equalTo: mainContentColumn.leadingAnchor),
+            widgetsPageView.trailingAnchor.constraint(equalTo: mainContentColumn.trailingAnchor),
+            widgetsPageView.bottomAnchor.constraint(equalTo: mainContentColumn.bottomAnchor),
+
             schedulerRoot.topAnchor.constraint(equalTo: mainContentColumn.topAnchor, constant: 8),
             schedulerRoot.leadingAnchor.constraint(equalTo: mainContentColumn.leadingAnchor, constant: 8),
             schedulerRoot.trailingAnchor.constraint(equalTo: mainContentColumn.trailingAnchor, constant: -8),
@@ -8127,7 +8132,7 @@ private struct WidgetsRootView: View {
     }
 
     var body: some View {
-        VStack(alignment: .leading, spacing: 16) {
+        VStack(alignment: .leading, spacing: 18) {
             HStack {
                 VStack(alignment: .leading, spacing: 3) {
                     Text("Add Widget to Desktop")
@@ -8140,9 +8145,16 @@ private struct WidgetsRootView: View {
             }
 
             GeometryReader { geo in
-                let spacing: CGFloat = 18
-                let rowWidth = variants.reduce(CGFloat(0)) { $0 + $1.previewCardSize.width } + CGFloat(max(variants.count - 1, 0)) * spacing
-                let scale = max(0.40, min(1, (geo.size.width - 28) / max(1, rowWidth)))
+                let count = max(variants.count, 1)
+                let spacing: CGFloat = 24
+                let baseRowWidth = variants.reduce(CGFloat(0)) { $0 + $1.previewCardSize.width }
+                let usableWidth = max(1, geo.size.width)
+                let usableHeight = max(1, geo.size.height)
+                let maxPreviewHeight = variants.map(\.previewCardSize.height).max() ?? 320
+                let widthScale = (usableWidth - CGFloat(count - 1) * spacing) / max(1, baseRowWidth)
+                let heightScale = usableHeight / max(1, maxPreviewHeight)
+                let scale = max(0.45, min(1.0, min(widthScale, heightScale)))
+
                 HStack(alignment: .top, spacing: spacing) {
                     ForEach(variants) { variant in
                         WidgetPreviewAddCard(
@@ -8156,13 +8168,14 @@ private struct WidgetsRootView: View {
                 }
                 .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
             }
-            .frame(height: variants.map(\.previewCardSize.height).max() ?? 320)
+            .frame(maxWidth: .infinity, maxHeight: .infinity)
 
             Text("Tip: Right-click a desktop widget to remove it.")
                 .font(.system(size: 12, weight: .medium))
                 .foregroundStyle(secondaryTextColor)
         }
-        .padding(18)
+        .padding(22)
+        .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
         .background(
             RoundedRectangle(cornerRadius: 18, style: .continuous)
                 .fill(colorScheme == .dark ? Color.white.opacity(0.05) : Color.white.opacity(0.93))
@@ -8171,6 +8184,8 @@ private struct WidgetsRootView: View {
             RoundedRectangle(cornerRadius: 18, style: .continuous)
                 .stroke(colorScheme == .dark ? Color.white.opacity(0.09) : Color.black.opacity(0.08), lineWidth: 1)
         )
+        .padding(.horizontal, 12)
+        .padding(.vertical, 12)
         .overlay(alignment: .top) {
             if let toastMessage {
                 Text(toastMessage)