Skip to content

Commit 7bb74fd

Browse files
committed
tvos import status sheet ui updates
Signed-off-by: Joseph Mattiello <git@joemattiello.com>
1 parent f104ee2 commit 7bb74fd

1 file changed

Lines changed: 53 additions & 34 deletions

File tree

PVUI/Sources/PVSwiftUI/tvOS Media UI/TVMediaImportStatusSheet.swift

Lines changed: 53 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ struct TVMediaImportStatusSheet: View {
3434
@StateObject private var viewModel: ImportProgressViewModel
3535
@FocusState private var focusedItemID: String?
3636
@Namespace private var sheetNamespace
37+
38+
/// Drives `navigationDestination` for system selection rows.
39+
@State private var systemSelectionItemID: UUID?
3740

3841
init(gameImporter: any GameImporting, updatesController: PVGameLibraryUpdatesController, onDismiss: @escaping () -> Void) {
3942
self.gameImporter = gameImporter
@@ -43,44 +46,60 @@ struct TVMediaImportStatusSheet: View {
4346
}
4447

4548
var body: some View {
46-
ZStack {
47-
// Background
48-
TVMediaBackground()
49-
.ignoresSafeArea()
50-
51-
VStack(spacing: 0) {
52-
// Header
53-
header
54-
.padding(.horizontal, 60)
55-
.padding(.top, 50)
56-
.padding(.bottom, 30)
57-
58-
// Content
59-
if viewModel.importQueueItems.isEmpty && !viewModel.isSyncing {
60-
emptyState
61-
} else {
62-
ScrollView {
63-
LazyVStack(spacing: 16) {
64-
// iCloud sync status
65-
if viewModel.isSyncing {
66-
iCloudSyncCard
67-
}
68-
69-
// Import queue items
70-
ForEach(viewModel.importQueueItems) { item in
71-
importItemRow(item)
49+
NavigationStack {
50+
ZStack {
51+
// Background
52+
TVMediaBackground()
53+
.ignoresSafeArea()
54+
55+
VStack(spacing: 0) {
56+
// Header
57+
header
58+
.padding(.horizontal, 60)
59+
.padding(.top, 50)
60+
.padding(.bottom, 30)
61+
62+
// Content
63+
if viewModel.importQueueItems.isEmpty && !viewModel.isSyncing {
64+
emptyState
65+
} else {
66+
ScrollView {
67+
LazyVStack(spacing: 16) {
68+
// iCloud sync status
69+
if viewModel.isSyncing {
70+
iCloudSyncCard
71+
}
72+
73+
// Import queue items
74+
ForEach(viewModel.importQueueItems) { item in
75+
importItemRow(item)
76+
}
7277
}
78+
.padding(.horizontal, 60)
79+
.padding(.bottom, 60)
7380
}
74-
.padding(.horizontal, 60)
75-
.padding(.bottom, 60)
81+
.tvMediaFocusSection()
7682
}
77-
.tvMediaFocusSection()
7883
}
7984
}
80-
}
81-
.tvMediaFocusScope(sheetNamespace)
82-
.tvMediaOnExitCommand {
83-
onDismiss()
85+
.tvMediaFocusScope(sheetNamespace)
86+
.tvMediaOnExitCommand {
87+
onDismiss()
88+
}
89+
#if os(tvOS)
90+
.navigationDestination(item: $systemSelectionItemID) { id in
91+
if let item = viewModel.importQueueItems.first(where: { $0.id == id }) {
92+
SystemSelectionView(item: item, onSystemSelected: { system, queueItem in
93+
if gameImporter.processingState == .idle {
94+
gameImporter.startProcessing()
95+
}
96+
})
97+
} else {
98+
Text("This import is no longer in the queue.")
99+
.foregroundStyle(.white.opacity(0.6))
100+
}
101+
}
102+
#endif
84103
}
85104
}
86105

@@ -260,7 +279,7 @@ struct TVMediaImportStatusSheet: View {
260279
// Action buttons for conflict resolution
261280
if case .conflict = item.status {
262281
Button("Select System") {
263-
// Would present system picker
282+
systemSelectionItemID = item.id
264283
}
265284
.font(.system(size: 12, weight: .bold))
266285
.foregroundStyle(Color.retroBlue)

0 commit comments

Comments
 (0)