Add help link for adding Invidious account

This commit is contained in:
Arkadiusz Fal 2022-01-06 15:56:03 +01:00
parent c1e219e46e
commit b5d187c52f

View File

@ -16,6 +16,7 @@ struct AccountForm: View {
@State private var validationDebounce = Debounce() @State private var validationDebounce = Debounce()
@Environment(\.colorScheme) private var colorScheme @Environment(\.colorScheme) private var colorScheme
@Environment(\.openURL) private var openURL
@Environment(\.presentationMode) private var presentationMode @Environment(\.presentationMode) private var presentationMode
var body: some View { var body: some View {
@ -62,6 +63,10 @@ struct AccountForm: View {
#if os(macOS) #if os(macOS)
.padding(.horizontal) .padding(.horizontal)
#endif #endif
#if os(iOS)
helpButton
#endif
} }
#else #else
formFields formFields
@ -71,6 +76,22 @@ struct AccountForm: View {
.onChange(of: password) { _ in validate() } .onChange(of: password) { _ in validate() }
} }
var helpButton: some View {
Group {
if instance.app == .invidious {
Button {
openURL(URL(string: "https://github.com/yattee/yattee/wiki/Adding-Invidious-instance-and-account")!)
} label: {
Label("How to add Invidious account?", systemImage: "questionmark.circle")
#if os(macOS)
.help("How to add Invidious account?")
.labelStyle(.iconOnly)
#endif
}
}
}
}
var formFields: some View { var formFields: some View {
Group { Group {
if !instance.app.accountsUsePassword { if !instance.app.accountsUsePassword {
@ -105,6 +126,10 @@ struct AccountForm: View {
Spacer() Spacer()
#if os(macOS)
helpButton
#endif
Button("Save", action: submitForm) Button("Save", action: submitForm)
.disabled(!isValid) .disabled(!isValid)
#if !os(tvOS) #if !os(tvOS)