From 76ae2717b2d5f3ae967ddf1850abc916c2f87ea4 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 20 Jun 2026 23:24:48 +0200 Subject: [PATCH] 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. --- Yattee/Views/Player/MiniPlayerView.swift | 23 +++++++++++++++---- .../macOS/MacOSControlsSectionRenderer.swift | 20 ++++++++++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Yattee/Views/Player/MiniPlayerView.swift b/Yattee/Views/Player/MiniPlayerView.swift index 0ea29268..c22c73ca 100644 --- a/Yattee/Views/Player/MiniPlayerView.swift +++ b/Yattee/Views/Player/MiniPlayerView.swift @@ -519,10 +519,25 @@ struct MiniPlayerView: View { incrementTapCount(for: config) navigationCoordinator?.isMiniPlayerQueueSheetPresented = true } label: { - Image(systemName: "list.bullet") - .font(isTabAccessory ? .title3 : .title2) - .frame(width: 32, height: 32) - .contentShape(Rectangle()) + ZStack(alignment: .bottom) { + Image(systemName: "list.bullet") + .font(isTabAccessory ? .title3 : .title2) + .frame(width: 32, height: 32) + + // Badge showing queue count + let queueCount = playerState?.queue.count ?? 0 + if queueCount > 0 { + Text("\(queueCount)") + .font(.system(size: 9, weight: .bold)) + .foregroundStyle(.white) + .padding(.horizontal, 4) + .padding(.vertical, 1) + .background(Color.accentColor, in: Capsule()) + .offset(y: 4) + .allowsHitTesting(false) + } + } + .contentShape(Rectangle()) } .buttonStyle(.plain) } diff --git a/Yattee/Views/Player/macOS/MacOSControlsSectionRenderer.swift b/Yattee/Views/Player/macOS/MacOSControlsSectionRenderer.swift index 3048622e..5993c49b 100644 --- a/Yattee/Views/Player/macOS/MacOSControlsSectionRenderer.swift +++ b/Yattee/Views/Player/macOS/MacOSControlsSectionRenderer.swift @@ -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,