mirror of
https://github.com/yattee/yattee.git
synced 2026-06-04 13:54:19 +00:00
The Settings (quality/audio/subtitles) and Queue panels now slide in from the right and occupy the right half of the screen, matching the info/comments details panel introduced in 92cc8b79f. Video stays visible on the left so the user retains visual context while browsing. Both panels supply their own ultraThinMaterial backdrop and use a custom title bar (replacing NavigationStack's auto-title on tvOS) so the title styling and symmetric padding match across panels and across pushed destination screens. The Menu button now pops the quality panel's pushed Video/Audio/Subtitles detail screens before dismissing the panel itself. Removes the background Button from the focus tree while either panel is open so D-pad left/right inside a row no longer escapes focus into the player and triggers a seek. Initial focus is steered into the first row programmatically since tvOS doesn't auto-focus inline overlays the way it does for fullScreenCover. Doubles the queue thumbnail size on tvOS (160x90) for readability at the half-screen panel width.
86 lines
2.8 KiB
Swift
86 lines
2.8 KiB
Swift
//
|
|
// QueueItemRow.swift
|
|
// Yattee
|
|
//
|
|
// A row displaying a queued video with drag handle and remove action.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct QueueItemRow: View {
|
|
@Environment(\.appEnvironment) private var appEnvironment
|
|
|
|
let queuedVideo: QueuedVideo
|
|
/// Position in queue (nil hides the number, used for history items)
|
|
let index: Int?
|
|
let isCurrentlyPlaying: Bool
|
|
let onRemove: () -> Void
|
|
let onTap: () -> Void
|
|
|
|
var body: some View {
|
|
Button(action: onTap) {
|
|
HStack(spacing: 12) {
|
|
// Index number or playing indicator
|
|
Group {
|
|
if isCurrentlyPlaying {
|
|
Image(systemName: "waveform")
|
|
.font(.caption)
|
|
.foregroundStyle(.tint)
|
|
.symbolEffect(.variableColor.iterative, options: .repeating)
|
|
} else if let index {
|
|
Text("\(index)")
|
|
.font(.caption)
|
|
.fontWeight(.medium)
|
|
.foregroundStyle(.secondary)
|
|
} else {
|
|
// No index - show empty space (for history items)
|
|
Color.clear
|
|
}
|
|
}
|
|
.frame(width: 24)
|
|
|
|
// Thumbnail
|
|
DeArrowVideoThumbnail(
|
|
video: queuedVideo.video,
|
|
cornerRadius: 6,
|
|
duration: queuedVideo.video.formattedDuration
|
|
)
|
|
#if os(tvOS)
|
|
.frame(width: 160, height: 90)
|
|
#else
|
|
.frame(width: 80, height: 45)
|
|
#endif
|
|
.opacity(isCurrentlyPlaying ? 0.6 : 1.0)
|
|
|
|
// Video info
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
Text(queuedVideo.video.displayTitle(using: appEnvironment?.deArrowBrandingProvider))
|
|
.font(.subheadline)
|
|
.fontWeight(.medium)
|
|
.lineLimit(2)
|
|
.foregroundStyle(isCurrentlyPlaying ? .secondary : .primary)
|
|
|
|
Text(queuedVideo.video.author.name)
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
.lineLimit(1)
|
|
}
|
|
|
|
Spacer()
|
|
}
|
|
.contentShape(Rectangle())
|
|
}
|
|
.buttonStyle(.plain)
|
|
#if os(iOS)
|
|
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
|
Button(role: .destructive) {
|
|
onRemove()
|
|
} label: {
|
|
Label(String(localized: "queue.item.remove"), systemImage: "trash")
|
|
}
|
|
}
|
|
#endif
|
|
.opacity(isCurrentlyPlaying ? 0.8 : 1.0)
|
|
}
|
|
}
|