ReadKeep/readeck/UI/Menu/PlayerQueueResumeButton.swift
Ilyas Hallak e68959afce Refactor: Move Utils to UI/Utils, improve SpeechPlayer UI, enhance state management, remove legacy files, and optimize queue handling
- Move and replace utility files (SafariUtil, SpeechQueue, StringExtensions, TTSManager, VoiceManager)
- Refactor and extend SpeechPlayer components (UI, progress, volume, queue)
- Improved state and EnvironmentObject management (PlayerUIState)
- UI and logic optimizations in menu and tab views
- Remove obsolete and duplicate files
- General code and UX improvements
2025-07-14 21:34:39 +02:00

51 lines
2.0 KiB
Swift

import SwiftUI
struct PlayerQueueResumeButton: View {
@ObservedObject private var queue = SpeechQueue.shared
@EnvironmentObject var playerUIState: PlayerUIState
private let playerViewModel = SpeechPlayerViewModel()
var body: some View {
if queue.hasItems, !playerUIState.isPlayerVisible {
Button(action: {
playerViewModel.resume()
playerUIState.showPlayer()
}) {
HStack(spacing: 12) {
VStack(alignment: .leading, spacing: 2) {
Text("Vorlese-Queue")
.font(.caption2)
.foregroundColor(.secondary)
Text("\(queue.queueItems.count) Artikel in der Queue")
.font(.subheadline)
.foregroundColor(.primary)
}
Spacer()
Button(action: {
playerViewModel.resume()
playerUIState.showPlayer()
}) {
Text("Weiterhören")
.font(.subheadline)
.fontWeight(.semibold)
.padding(.horizontal, 14)
.padding(.vertical, 6)
.background(Color.accentColor.opacity(0.15))
.foregroundColor(.accentColor)
.cornerRadius(8)
}
.buttonStyle(PlainButtonStyle())
}
.padding(.vertical, 14)
.padding(.horizontal, 20)
}
.buttonStyle(PlainButtonStyle())
.background(Color(.systemBackground))
.listRowInsets(EdgeInsets())
.listRowBackground(Color(.systemBackground))
.padding(.bottom, 8)
.transition(.opacity)
.animation(.spring(), value: queue.hasItems)
}
}
}