Skip to content

Commit

Permalink
not sure why i did this i just dont want to finish ap econ
Browse files Browse the repository at this point in the history
  • Loading branch information
JayAgra committed Nov 27, 2024
1 parent 3f2f774 commit 93ae4fa
Show file tree
Hide file tree
Showing 25 changed files with 211 additions and 198 deletions.
34 changes: 17 additions & 17 deletions ios/TeamViewStats.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ struct TeamViewStats: View {
ScrollView {
if !teamDetail.teamData.isEmpty {
Picker("type", selection: $teamDetail.statType) {
Text("avg")
Text("Avg")
.tag(StatType.mean)
Text("25th")
.tag(StatType.first)
Text("median")
Text("Median")
.tag(StatType.median)
Text("75th")
.tag(StatType.third)
Text("decaying")
Text("Decaying")
.tag(StatType.decay)
}
.pickerStyle(.segmented)
Expand All @@ -42,19 +42,19 @@ struct TeamViewStats: View {
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].intake)))s")
.font(.title)
Text("intake")
Text("Intake")
}
.frame(maxWidth: .infinity)
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].travel)))s")
.font(.title)
Text("move")
Text("Move")
}
.frame(maxWidth: .infinity)
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].outtake)))s")
.font(.title)
Text("outtake")
Text("Outtake")
}
.frame(maxWidth: .infinity)
}
Expand All @@ -63,19 +63,19 @@ struct TeamViewStats: View {
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].speaker)))")
.font(.title)
Text("speaker")
Text("Speaker")
}
.frame(maxWidth: .infinity)
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].amplifier)))")
.font(.title)
Text("amplifier")
Text("Amplifier")
}
.frame(maxWidth: .infinity)
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].auto_scores)))")
.font(.title)
Text("auto scores")
Text("Auto scores")
}
.frame(maxWidth: .infinity)
}
Expand All @@ -84,19 +84,19 @@ struct TeamViewStats: View {
VStack {
Text("\(Int(((teamDetail.teamData[0].trap_note ?? 0) * 100).rounded()))%")
.font(.title)
Text("trap note")
Text("Trap note")
}
.frame(maxWidth: .infinity)
VStack {
Text("\(Int(((teamDetail.teamData[0].climb ?? 0) * 100).rounded()))%")
.font(.title)
Text("climb")
Text("Climb")
}
.frame(maxWidth: .infinity)
VStack {
Text("\(Int(((teamDetail.teamData[0].buddy_climb ?? 0) * 100).rounded()))%")
.font(.title)
Text("buddy climb")
Text("Buddy climb")
}
.frame(maxWidth: .infinity)
}
Expand All @@ -105,19 +105,19 @@ struct TeamViewStats: View {
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].auto_preload)))")
.font(.title)
Text("auto preload")
Text("Auto preload")
}
.frame(maxWidth: .infinity)
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].auto_wing)))")
.font(.title)
Text("auto wing")
Text("Auto wing")
}
.frame(maxWidth: .infinity)
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].auto_center)))")
.font(.title)
Text("auto center")
Text("Auto center")
}
.frame(maxWidth: .infinity)
}
Expand All @@ -126,7 +126,7 @@ struct TeamViewStats: View {
VStack {
Text("\(String(getRelevantData(item: teamDetail.teamData[0].points))) pts")
.font(.title)
Text("performance rating")
Text("Performance rating")
}
.frame(maxWidth: .infinity)
}
Expand All @@ -137,7 +137,7 @@ struct TeamViewStats: View {
ProgressView()
.controlSize(.large)
.padding()
Text("loading")
Text("Loading...")
.font(.title)
Spacer()
}
Expand Down
18 changes: 9 additions & 9 deletions ios/beartracks/bearTracks/DataView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ struct DataView: View {
.padding(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
#if os(visionOS)
Text("match \(String(appState.dataEntries[index].Brief.match_num))")
Text("Match \(String(appState.dataEntries[index].Brief.match_num))")
.font(.title3)
.padding(.trailing)
.frame(maxWidth: .infinity, alignment: .trailing)
#else
Text("match \(String(appState.dataEntries[index].Brief.match_num))")
Text("Match \(String(appState.dataEntries[index].Brief.match_num))")
.font(UIDevice.current.userInterfaceIdiom == .pad ? .title2 : .title)
.padding(.trailing)
.frame(maxWidth: .infinity, alignment: .trailing)
#endif
}
HStack {
Text("#\(String(appState.dataEntries[index].Brief.id))from \(String(appState.dataEntries[index].Brief.from_team))")
Text("#\(String(appState.dataEntries[index].Brief.id))by \(String(appState.dataEntries[index].Brief.from_team))")
.padding(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
}
Expand All @@ -68,31 +68,31 @@ struct DataView: View {
} else {
if self.loadFailed {
VStack {
Label("failed", systemImage: "xmark.seal.fill")
Label("Failute", systemImage: "xmark.seal.fill")
.padding(.bottom)
.labelStyle(.iconOnly)
.foregroundStyle(Color.pink)
Text("load failed")
Text("Encountered a fatal error when attempting to load data.")
.padding(.bottom)
}
.navigationTitle("Data")
} else {
if self.loadComplete {
VStack {
Label("none", systemImage: "questionmark.app.dashed")
Label("None", systemImage: "questionmark.app.dashed")
.padding(.bottom)
.labelStyle(.iconOnly)
.foregroundStyle(Color.pink)
Text("no data")
Text("No data was returned.")
.padding(.bottom)
}
.navigationTitle("Data")
} else {
VStack {
Label("loading", systemImage: "hourglass")
Label("Loading", systemImage: "hourglass")
.padding(.bottom)
.labelStyle(.iconOnly)
Text("loading data...")
Text("Loading...")
.padding(.bottom)
}
.navigationTitle("Data")
Expand Down
14 changes: 7 additions & 7 deletions ios/beartracks/bearTracks/DetailedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct DetailedView: View {
.padding(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
VStack {
Text("Author:")
Text("Author: ")
.fontWeight(.bold)
.frame(maxWidth: .infinity, alignment: .leading)
Text("\(detailData[0].FullMain.name) (\(String(detailData[0].FullMain.from_team)))")
Expand Down Expand Up @@ -112,7 +112,7 @@ struct DetailedView: View {
}
.padding([.top, .leading])
VStack {
Text("cycles")
Text("Cycles")
.font(.title2)
.frame(maxWidth: .infinity, alignment: .leading)
VStack {
Expand Down Expand Up @@ -275,11 +275,11 @@ struct DetailedView: View {
.padding([.top, .leading])
} // end scrollview
} else {
Text("unsupported season")
Text("Error: Unsupported Season")
.padding(.bottom)
}
} else {
Text("loading details...")
Text("Loading...")
.padding(.bottom)
}
}
Expand All @@ -305,15 +305,15 @@ struct DetailedView: View {
self.gameData = try decoder.decode(
[MatchTime2024].self, from: Data(result[0].FullMain.game.utf8))
} catch {
print("parse error")
print("Parse error")
}
}
}
} catch {
print("parse error")
print("Parse error")
}
} else if let error = error {
print("fetch error: \(error)")
print("Fetch error: \(error)")
}
}
.resume()
Expand Down
44 changes: 22 additions & 22 deletions ios/beartracks/bearTracks/LoginView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ struct LoginView: View {
if !loading {
if !create {
#if !os(watchOS)
Text("log in")
Text("Log In")
.font(.title3)
.padding(.top)
#endif
TextField("username", text: $authData[0])
TextField("Username", text: $authData[0])
#if !os(watchOS) && !os(tvOS)
.padding([.leading, .trailing, .bottom])
.textFieldStyle(RoundedBorderTextFieldStyle())
#endif
.autocorrectionDisabled(true)
.textInputAutocapitalization(.never)
.textContentType(.username)
SecureField("password", text: $authData[1])
SecureField("Password", text: $authData[1])
#if !os(watchOS) && !os(tvOS)
.padding()
.textFieldStyle(RoundedBorderTextFieldStyle())
#endif
.autocorrectionDisabled(true)
.textInputAutocapitalization(.never)
.textContentType(.password)
Button("login") {
Button("Log In") {
authAction(type: "login", data: ["username": authData[0], "password": authData[1]])
}
#if !os(watchOS)
Expand All @@ -54,39 +54,39 @@ struct LoginView: View {
.font(.title3)
.buttonStyle(.bordered)
#if !os(watchOS)
Button("create") {
Button("Create") {
self.create = true
}
#endif
} else {
#if !os(watchOS) && !os(tvOS)
Text("create account")
Text("Create Account")
.font(.title3)
.padding(.top)
TextField("team code", text: $authData[3])
TextField("Team code", text: $authData[3])
.padding([.leading, .trailing])
.textFieldStyle(RoundedBorderTextFieldStyle())
.keyboardType(.numberPad)
.onChange(of: authData[3]) { _ in
authData[3] = String(authData[3].prefix(5))
}
TextField("full name", text: $authData[2])
TextField("Full name", text: $authData[2])
.padding([.leading, .trailing])
.textFieldStyle(RoundedBorderTextFieldStyle())
.textContentType(.name)
TextField("username", text: $authData[0])
TextField("Username", text: $authData[0])
.padding([.leading, .trailing])
.textFieldStyle(RoundedBorderTextFieldStyle())
.autocorrectionDisabled(true)
.textInputAutocapitalization(.never)
.textContentType(.username)
SecureField("password", text: $authData[1])
SecureField("Password", text: $authData[1])
.padding([.leading, .trailing])
.textFieldStyle(RoundedBorderTextFieldStyle())
.autocorrectionDisabled(true)
.textInputAutocapitalization(.never)
.textContentType(.newPassword)
Button("create") {
Button("Create") {
authAction(
type: "create",
data: [
Expand All @@ -97,7 +97,7 @@ struct LoginView: View {
.padding()
.font(.title3)
.buttonStyle(.bordered)
Button("login") {
Button("Log In") {
self.create = false
}
#endif
Expand All @@ -117,9 +117,9 @@ struct LoginView: View {
isPresented: $showAlert,
content: {
Alert(
title: Text("Auth Error"),
title: Text("Authentication Error"),
message: Text(alertMessage),
dismissButton: .default(Text("ok"))
dismissButton: .default(Text("OK"))
)
})
}
Expand All @@ -144,34 +144,34 @@ struct LoginView: View {
loading = false
showAlert = true
if type == "login" {
alertMessage = "bad credentials"
alertMessage = "Bad Credentials"
} else {
if httpResponse.statusCode == 400 {
alertMessage =
"you supplied some data the server didn't like very much. your username, full name, and/or password contained characters other than a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \\ _ [ _ ] { } | ? . ,"
"You supplied some data the server did not like. Your account was **not** created. Please try agian following these conditions- your Username, Full name, and Password must contain only the following characters: a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \\ _ { } | ? . ,"
} else if httpResponse.statusCode == 409 {
alertMessage = "username taken"
alertMessage = "Username taken. Your account was **not** created. Please try again with a new username."
} else if httpResponse.statusCode == 403 {
alertMessage = "bad access key"
alertMessage = "Invalid access key. Ask your team lead or the application developers for another one. If your team failed to provide any data at a competition, your team's access key may have been indefinitely revoked. Your account was **not** created."
} else if httpResponse.statusCode == 413 {
alertMessage =
"your username, full name, and/or password were not between 3 and 64 characters (8 min for password)"
"Field lengths- your Username, Full name, and Password must be between 3 and 64 characters (8 min for password). Your account was **not** created. Please try agian, abiding by these requirements."
} else {
alertMessage = "creation failed"
alertMessage = "Account creation failed. Your account was **not** created. Please try again (unexpected error)."
}
}
}
}
} else {
loading = false
showAlert = true
alertMessage = "network error"
alertMessage = "Network Error"
}
}.resume()
} catch {
loading = false
showAlert = true
alertMessage = "failed to serialize auth object"
alertMessage = "Fatal Client Error: Failed to serialize authentication object"
}
}
}
Expand Down
Loading

0 comments on commit 93ae4fa

Please sign in to comment.