WIP: hide empty collection count pills
This commit is contained in:
@@ -1493,6 +1493,11 @@ final class ClipboardPanelView: NSVisualEffectView, NSSearchFieldDelegate {
|
||||
return ClipboardSortMode.allCases.compactMap { collectionButtons[$0]?.count }
|
||||
}
|
||||
|
||||
var debugCollectionCountLabelHiddenStates: [Bool] {
|
||||
updateCollectionButtons()
|
||||
return ClipboardSortMode.allCases.compactMap { collectionButtons[$0]?.debugCountLabelIsHidden }
|
||||
}
|
||||
|
||||
var debugCollectionChipAccessibilityLabels: [String] {
|
||||
updateCollectionButtons()
|
||||
return ClipboardSortMode.allCases.compactMap { collectionButtons[$0]?.accessibilityLabel() }
|
||||
@@ -1565,6 +1570,11 @@ final class ClipboardPanelView: NSVisualEffectView, NSSearchFieldDelegate {
|
||||
return viewModel.collectionNames.compactMap { customCollectionButtons[$0]?.count }
|
||||
}
|
||||
|
||||
var debugCustomCollectionCountLabelHiddenStates: [Bool] {
|
||||
updateCollectionButtons()
|
||||
return viewModel.collectionNames.compactMap { customCollectionButtons[$0]?.debugCountLabelIsHidden }
|
||||
}
|
||||
|
||||
var debugCustomCollectionColorHexes: [String: String] {
|
||||
Dictionary(uniqueKeysWithValues: viewModel.collectionNames.map { name in
|
||||
(name, ClipboardCollectionVisuals.hexString(for: collectionColor(forCollectionNamed: name)))
|
||||
@@ -2109,6 +2119,7 @@ private final class CollectionChipView: NSView {
|
||||
? NSColor.controlAccentColor.withAlphaComponent(0.16)
|
||||
: NSColor.labelColor.withAlphaComponent(0.07)
|
||||
).cgColor
|
||||
updateCountLabelVisibility()
|
||||
updateAccessibility()
|
||||
updateChrome()
|
||||
}
|
||||
@@ -2138,9 +2149,14 @@ private final class CollectionChipView: NSView {
|
||||
func setCount(_ count: Int) {
|
||||
self.count = count
|
||||
countLabel.stringValue = count > 999 ? "999+" : "\(count)"
|
||||
updateCountLabelVisibility()
|
||||
updateAccessibility()
|
||||
}
|
||||
|
||||
private func updateCountLabelVisibility() {
|
||||
countLabel.isHidden = count == 0
|
||||
}
|
||||
|
||||
private func updateAccessibility() {
|
||||
let noun = count == 1 ? "clip" : "clips"
|
||||
let selectedText = isSelected ? "selected, " : ""
|
||||
@@ -2291,6 +2307,10 @@ private final class CollectionChipView: NSView {
|
||||
isKeyboardFocused
|
||||
}
|
||||
|
||||
var debugCountLabelIsHidden: Bool {
|
||||
countLabel.isHidden
|
||||
}
|
||||
|
||||
func debugDropItem(_ itemID: UUID) {
|
||||
onDropItem?(itemID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user