From 5cbcceba9a31a450ad2a47f31b91eb92325bd165 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Fri, 17 Apr 2026 19:03:46 +0200 Subject: [PATCH] Polish AddSourceView layout on tvOS Add a TVSourceRowLabelStyle for consistent icon/text spacing, switch the Scan Network button to TVFormRowButtonStyle so it matches the NavigationLink rows, and drop the duplicate navigationTitle in AddWebDAV/AddSMB views since the title is already shown in the TVSidebarDetailContainer sidebar. --- .../Views/Settings/AddSource/AddSMBView.swift | 2 ++ .../Settings/AddSource/AddWebDAVView.swift | 2 ++ Yattee/Views/Settings/AddSourceView.swift | 17 ++++++++++++++++- .../Views/Settings/TVSettingsButtonStyles.swift | 12 ++++++++++++ 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Yattee/Views/Settings/AddSource/AddSMBView.swift b/Yattee/Views/Settings/AddSource/AddSMBView.swift index 84532b36..15d0b30a 100644 --- a/Yattee/Views/Settings/AddSource/AddSMBView.swift +++ b/Yattee/Views/Settings/AddSource/AddSMBView.swift @@ -54,10 +54,12 @@ struct AddSMBView: View { #if os(iOS) .scrollDismissesKeyboard(.interactively) #endif + #if !os(tvOS) .navigationTitle(String(localized: "sources.addSMB")) #if os(iOS) .navigationBarTitleDisplayMode(.inline) #endif + #endif .onAppear { if let prefillServer { server = prefillServer diff --git a/Yattee/Views/Settings/AddSource/AddWebDAVView.swift b/Yattee/Views/Settings/AddSource/AddWebDAVView.swift index 301cc7cf..e137e543 100644 --- a/Yattee/Views/Settings/AddSource/AddWebDAVView.swift +++ b/Yattee/Views/Settings/AddSource/AddWebDAVView.swift @@ -55,10 +55,12 @@ struct AddWebDAVView: View { #if os(iOS) .scrollDismissesKeyboard(.interactively) #endif + #if !os(tvOS) .navigationTitle(String(localized: "sources.addWebDAV")) #if os(iOS) .navigationBarTitleDisplayMode(.inline) #endif + #endif .onAppear { if let url = prefillURL { urlString = url.absoluteString diff --git a/Yattee/Views/Settings/AddSourceView.swift b/Yattee/Views/Settings/AddSourceView.swift index e6945d58..b2ca0a1d 100644 --- a/Yattee/Views/Settings/AddSourceView.swift +++ b/Yattee/Views/Settings/AddSourceView.swift @@ -120,6 +120,9 @@ struct AddSourceView: View { #endif } label: { Label(String(localized: "sources.addWebDAV"), systemImage: "externaldrive.connected.to.line.below") + #if os(tvOS) + .labelStyle(TVSourceRowLabelStyle()) + #endif } NavigationLink { @@ -135,6 +138,9 @@ struct AddSourceView: View { #endif } label: { Label(String(localized: "sources.addSMB"), systemImage: "server.rack") + #if os(tvOS) + .labelStyle(TVSourceRowLabelStyle()) + #endif } NavigationLink { @@ -150,6 +156,9 @@ struct AddSourceView: View { #endif } label: { Label(String(localized: "sources.addRemoteServer"), systemImage: "globe") + #if os(tvOS) + .labelStyle(TVSourceRowLabelStyle()) + #endif } NavigationLink { @@ -178,6 +187,9 @@ struct AddSourceView: View { .aspectRatio(contentMode: .fit) .frame(width: 24, height: 24) } + #if os(tvOS) + .labelStyle(TVSourceRowLabelStyle()) + #endif } } @@ -187,9 +199,12 @@ struct AddSourceView: View { showingNetworkDiscovery = true } label: { Label(String(localized: "discovery.scanNetwork"), systemImage: "wifi") + #if os(tvOS) + .labelStyle(TVSourceRowLabelStyle()) + #endif } #if os(tvOS) - .buttonStyle(TVSettingsButtonStyle()) + .buttonStyle(TVFormRowButtonStyle()) #endif } footer: { Text(String(localized: "sources.footer.discovery")) diff --git a/Yattee/Views/Settings/TVSettingsButtonStyles.swift b/Yattee/Views/Settings/TVSettingsButtonStyles.swift index 11ab6f29..1d2efe0b 100644 --- a/Yattee/Views/Settings/TVSettingsButtonStyles.swift +++ b/Yattee/Views/Settings/TVSettingsButtonStyles.swift @@ -144,6 +144,18 @@ struct TVSettingsToggle: View { } } +/// Label style for source rows - explicit icon/text spacing +struct TVSourceRowLabelStyle: LabelStyle { + func makeBody(configuration: Configuration) -> some View { + HStack(spacing: 20) { + configuration.icon + .frame(width: 36, height: 36) + configuration.title + Spacer(minLength: 0) + } + } +} + /// Button style for form rows (toggles, pickers) - matches form appearance struct TVFormRowButtonStyle: ButtonStyle { @Environment(\.isFocused) private var isFocused