Refactor views

This commit is contained in:
Arkadiusz Fal
2026-02-09 01:13:02 +01:00
parent 8464464199
commit 612dce6b9f
43 changed files with 143 additions and 125 deletions

View File

@@ -13,10 +13,12 @@ import SwiftUI
/// For completed downloads, uses VideoRowView with tap zone support (thumbnail plays, text opens info).
/// For active downloads, shows custom progress UI with no tap actions.
struct DownloadRowView: View {
@Environment(\.appEnvironment) private var appEnvironment
let download: Download
let isActive: Bool
var onDelete: (() -> Void)? = nil
// Queue context (optional, enables auto-play when provided)
var queueSource: QueueSource? = nil
var sourceLabel: String? = nil
@@ -24,8 +26,6 @@ struct DownloadRowView: View {
var videoIndex: Int? = nil
var loadMoreVideos: LoadMoreVideosCallback? = nil
@Environment(\.appEnvironment) private var appEnvironment
// Cache watch progress to avoid CoreData fetches on every re-render
@State private var cachedWatchProgress: Double?
@State private var cachedWatchedSeconds: TimeInterval?

View File

@@ -339,14 +339,14 @@ private struct ActiveDownloadsSectionContentView: View {
/// Only accesses manager.completedDownloads, so won't re-render when activeDownloads progress updates.
/// Generates rows directly for VideoListContainer (no Section wrapper).
private struct CompletedDownloadsSectionContentView: View {
@Environment(\.appEnvironment) private var appEnvironment
let manager: DownloadManager
let settings: DownloadSettings
let searchText: String
let listStyle: VideoListStyle
let isGroupedMode: Bool
@Environment(\.appEnvironment) private var appEnvironment
private var completedFiltered: [Download] {
guard !searchText.isEmpty else { return manager.completedDownloads }
let query = searchText.lowercased()