2022-01-06 15:02:53 +00:00
import Foundation
import SwiftUI
struct Help : View {
static let wikiURL = URL ( string : " https://github.com/yattee/yattee/wiki " ) !
2022-07-03 22:13:06 +00:00
static let matrixURL = URL ( string : " https://tinyurl.com/matrix-yattee " ) !
static let discordURL = URL ( string : " https://yattee.stream/discord " ) !
2022-01-06 15:02:53 +00:00
static let issuesURL = URL ( string : " https://github.com/yattee/yattee/issues " ) !
static let milestonesURL = URL ( string : " https://github.com/yattee/yattee/milestones " ) !
static let donationsURL = URL ( string : " https://github.com/yattee/yattee/wiki/Donations " ) !
static let contributingURL = URL ( string : " https://github.com/yattee/yattee/wiki/Contributing " ) !
@ Environment ( \ . openURL ) private var openURL
var body : some View {
Group {
ScrollView ( . vertical , showsIndicators : false ) {
VStack ( alignment : . leading , spacing : 0 ) {
Section {
2022-09-04 15:28:30 +00:00
header ( " I am lost " . localized ( ) )
2022-01-06 15:02:53 +00:00
Text ( " You can find information about using Yattee in the Wiki pages. " )
. padding ( . bottom , 8 )
2022-09-04 15:28:30 +00:00
helpItemLink ( " Wiki " . localized ( ) , url : Self . wikiURL , systemImage : " questionmark.circle " )
2022-01-06 15:02:53 +00:00
. padding ( . bottom , 8 )
}
Spacer ( )
Section {
2022-09-04 15:28:30 +00:00
header ( " I want to ask a question " . localized ( ) )
2022-01-06 15:02:53 +00:00
2022-07-03 22:13:06 +00:00
Text ( " Discussions take place in Discord and Matrix. It's a good spot for general questions. " )
2022-01-06 15:02:53 +00:00
. padding ( . bottom , 8 )
2022-09-04 15:28:30 +00:00
helpItemLink ( " Discord Server " . localized ( ) , url : Self . discordURL , systemImage : " message " )
2022-07-03 22:13:06 +00:00
. padding ( . bottom , 8 )
2022-09-04 15:28:30 +00:00
helpItemLink ( " Matrix Channel " . localized ( ) , url : Self . matrixURL , systemImage : " message " )
2022-01-06 15:02:53 +00:00
. padding ( . bottom , 8 )
}
Spacer ( )
Section {
2022-09-04 15:28:30 +00:00
header ( " I found a bug / " . localized ( ) )
header ( " I have a feature request " . localized ( ) )
2022-01-06 15:02:53 +00:00
Text ( " Bugs and great feature ideas can be sent to the GitHub issues tracker. " )
Text ( " If you are reporting a bug, include all relevant details (especially: app \ u{00a0}version, used device and system version, steps to reproduce). " )
Text ( " If you are interested what's coming in future updates, you can track project Milestones. " )
. padding ( . bottom , 8 )
VStack ( alignment : . leading , spacing : 8 ) {
2022-09-04 15:28:30 +00:00
helpItemLink ( " Issues Tracker " . localized ( ) , url : Self . issuesURL , systemImage : " ladybug " )
helpItemLink ( " Milestones " . localized ( ) , url : Self . milestonesURL , systemImage : " list.star " )
2022-01-06 15:02:53 +00:00
}
. padding ( . bottom , 8 )
}
Spacer ( )
Section {
2022-09-04 15:28:30 +00:00
header ( " I like this app! " . localized ( ) )
2022-01-06 15:02:53 +00:00
2022-09-04 15:28:30 +00:00
Text ( " That's nice to hear. It is fun to deliver apps other people want to use. You can consider donating to the project or help by contributing to new features development. " )
2022-01-06 15:02:53 +00:00
. padding ( . bottom , 8 )
VStack ( alignment : . leading , spacing : 8 ) {
2022-09-04 15:28:30 +00:00
helpItemLink ( " Donations " . localized ( ) , url : Self . donationsURL , systemImage : " dollarsign.circle " )
helpItemLink ( " Contributing " . localized ( ) , url : Self . contributingURL , systemImage : " hammer " )
2022-01-06 15:02:53 +00:00
}
. padding ( . bottom , 8 )
}
}
#if os ( iOS )
. padding ( . horizontal )
#endif
}
}
#if os ( tvOS )
. frame ( maxWidth : 1000 )
#else
. frame ( maxWidth : . infinity , alignment : . leading )
#endif
. navigationTitle ( " Help " )
}
func header ( _ text : String ) -> some View {
Text ( text )
. fontWeight ( . bold )
. font ( . title3 )
. padding ( . bottom , 6 )
}
func helpItemLink ( _ label : String , url : URL , systemImage : String ) -> some View {
Group {
#if os ( tvOS )
VStack {
Button { } label : {
HStack ( spacing : 8 ) {
Image ( systemName : systemImage )
Text ( label )
}
. font ( . system ( size : 25 ) . bold ( ) )
}
Text ( url . absoluteString )
}
. frame ( maxWidth : . infinity )
#else
Button {
openURL ( url )
} label : {
Label ( label , systemImage : systemImage )
}
#endif
}
}
}
struct Help_Previews : PreviewProvider {
static var previews : some View {
Help ( )
}
}