splits/Splits/HelpView.swift

78 lines
2.1 KiB
Swift

//
// ModalView.swift
// Splits
//
// Created by Isaac Greene on 2022-04-03.
//
import SwiftUI
struct HelpView: View {
@State var mathSheet = false
@State var problemSheet = false
var body: some View {
ScrollView {
VStack {
Text("Help")
.font(.largeTitle)
.bold()
.padding(.top, 40)
Text("Due to limitations in the system, you can only use kilometers and miles at this time. \nSmaller units like meters and feet are not supported. \nYou can, however, use decimals, such as .2km or .8mi.\n\nI apologize for any inconvenience. In the future, I hope to make our app easier to use.\n\nI'm currently looking to add help articles about running to this page and it'll have loads of stuff about running and pace and all that stuff to actually help you with running. If I do, the purpose of this app might change.")
.padding()
Button("See our math", action: {
self.mathSheet.toggle()
})
.frame(width: 130, height: 40, alignment: .center)
.background(.tertiary)
.foregroundColor(.primary)
.cornerRadius(12)
.padding(30)
.sheet(isPresented: self.$mathSheet, content: {
algorithmView()
})
}
}
}
}
struct algorithmView: View {
var body: some View {
Text("The Algorithm")
.font(.largeTitle)
.bold()
VStack(alignment: .leading, spacing: 0) {
Text("Calculating pace is fairly straightforward, and does not change with increased complexity. The standard formula is simply this:\n")
mathView()
Text("\nWhere:\n")
HStack {
Text("\"t\"")
.font(.custom("Charter", size: 18))
Text("is total time")
}
HStack{
Text("\"d\"")
.font(.custom("Charter", size: 18))
Text("is distance")
}
HStack {
Text("\"p\"")
.font(.custom("Charter", size: 18))
Text("is the resulting pace")
}
}
.padding()
}
}
struct mathView: View {
var body: some View {
HStack {
Spacer()
MathView(latex: "\\frac{t}{d} = p")
.frame(width: 200, height: 50)
}
}
}