mirror of
https://github.com/yattee/yattee.git
synced 2026-07-21 06:42:01 +00:00
Show queue count badge on macOS queue button
Add a queue-count badge to the macOS player controls queue button (MacOSControlsSectionRenderer) and the shared mini player queue button (MiniPlayerView), matching the iOS pill button behavior.
This commit is contained in:
@@ -211,6 +211,9 @@ struct MacOSControlsSectionRenderer: View {
|
||||
controlButton(systemImage: "list.bullet", help: config.buttonType.displayName) {
|
||||
actions.onShowQueue?()
|
||||
}
|
||||
.overlay(alignment: .bottom) {
|
||||
queueBadge
|
||||
}
|
||||
.disabled(isLocked)
|
||||
.opacity(isLocked ? 0.5 : 1.0)
|
||||
}
|
||||
@@ -289,6 +292,23 @@ struct MacOSControlsSectionRenderer: View {
|
||||
MacOSRendererButtonStyle(context: context)
|
||||
}
|
||||
|
||||
/// Badge showing the number of items currently in the queue, mirroring the
|
||||
/// iOS pill queue button. Hidden when the queue is empty.
|
||||
@ViewBuilder
|
||||
private var queueBadge: some View {
|
||||
let count = actions.playerState.queue.count
|
||||
if count > 0 {
|
||||
Text("\(count)")
|
||||
.font(.system(size: context == .bar ? 8 : 9, weight: .bold))
|
||||
.foregroundStyle(.white)
|
||||
.padding(.horizontal, 4)
|
||||
.padding(.vertical, 1)
|
||||
.background(Color.accentColor, in: Capsule())
|
||||
.offset(y: 4)
|
||||
.allowsHitTesting(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func controlButton(
|
||||
systemImage: String,
|
||||
|
||||
Reference in New Issue
Block a user