From 9c317d89a39d0871f15f8282aec6c7f3dde7768c Mon Sep 17 00:00:00 2001
From: Ariver <shanghai3168@gmail.com>
Date: Fri, 26 Jun 2026 22:42:44 +0800
Subject: [PATCH] Polish Pro status UI and app grid layout

---
 src/Apptag/AppGridCollectionView.swift |   42 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/src/Apptag/AppGridCollectionView.swift b/src/Apptag/AppGridCollectionView.swift
index 13fe190..8e95bc8 100644
--- a/src/Apptag/AppGridCollectionView.swift
+++ b/src/Apptag/AppGridCollectionView.swift
@@ -564,6 +564,17 @@
         }
     }
 
+    func canPreviewEmptyDrop(path: String, source: String, screenPoint: NSPoint, copy: Bool) -> Bool {
+        guard let coordinator,
+              coordinator.displayStyle != .flat
+        else { return false }
+        return !coordinator.shouldCancelEmptyDropForActiveReorder(
+            path: path,
+            screenPoint: screenPoint,
+            copy: copy
+        )
+    }
+
     private func setup() {
         wantsLayer = true
         layer?.backgroundColor = NSColor.clear.cgColor
@@ -1134,7 +1145,7 @@
         detailScrollView.borderType = .noBorder
         detailScrollView.documentView = detailLabel
 
-        closeButton.action = { [weak self] in self?.hideUsageTips() }
+        closeButton.action = { [weak self] in self?.requestHideUsageTips() }
         previousButton.action = { [weak self] in self?.selectUsageTip(offset: -1) }
         nextButton.action = { [weak self] in self?.selectUsageTip(offset: 1) }
 
@@ -1194,10 +1205,9 @@
         applyCoordinatorState()
     }
 
-    private func hideUsageTips() {
+    private func requestHideUsageTips() {
         Diagnostics.log("usageTips.hud.close")
         clearHoverState()
-        isHidden = true
         coordinator?.onHideUsageTips()
     }
 
@@ -1206,7 +1216,7 @@
         let closeHitOutset: CGFloat = 8
         if closeButton.frame.insetBy(dx: -closeHitOutset, dy: -closeHitOutset).contains(point) {
             closeButton.performPressFeedback()
-            hideUsageTips()
+            requestHideUsageTips()
             return true
         }
         let hitOutset: CGFloat = 6
@@ -1903,8 +1913,12 @@
         let columnWidth = floor((availableWidth - gap * CGFloat(columnCount - 1)) / CGFloat(columnCount))
         var columnHeights = Array(repeating: outerPadding, count: columnCount)
         var items: [LayoutItem] = []
+        let bottomPinnedGroups = groups.enumerated().filter { $0.element.containerID == AppContainerID.appleBuiltIn }
+        let bottomPinnedIndexes = Set(bottomPinnedGroups.map { $0.offset })
 
         for (index, group) in groups.enumerated() {
+            if bottomPinnedIndexes.contains(index) { continue }
+
             let columnIndex = columnHeights.indices.min { columnHeights[$0] < columnHeights[$1] } ?? 0
             let x = outerPadding + CGFloat(columnIndex) * (columnWidth + gap)
             let y = columnHeights[columnIndex]
@@ -1922,8 +1936,24 @@
             columnHeights[columnIndex] = y + height + gap
         }
 
-        let tallest = columnHeights.max() ?? outerPadding
-        let contentHeight = (groups.isEmpty ? outerPadding * 2 : tallest - gap + outerPadding)
+        var contentBottom = columnHeights.max() ?? outerPadding
+        for (index, group) in bottomPinnedGroups {
+            let y = max(outerPadding, contentBottom)
+            let height = AppGridCollectionMetrics.cardHeight(
+                appCount: group.apps.count,
+                width: availableWidth,
+                iconSize: iconSize
+            )
+            items.append(
+                LayoutItem(
+                    index: index,
+                    frame: NSRect(x: outerPadding, y: y, width: availableWidth, height: height)
+                )
+            )
+            contentBottom = y + height + gap
+        }
+
+        let contentHeight = (items.isEmpty ? outerPadding * 2 : contentBottom - gap + outerPadding)
             + max(0, bottomContentPadding)
         return LayoutPlan(
             items: items,

--
Gitblit v1.9.3