From 1da613a0e590c136650dbfe248da9a3c8df95abc Mon Sep 17 00:00:00 2001 From: durualayli Date: Tue, 27 Jan 2026 12:03:54 -0500 Subject: [PATCH 1/4] Readding sports and fixing UI --- score-ios/Models/Game.swift | 2 +- score-ios/Models/Sport.swift | 12 ++++++------ score-ios/Networking/NetworkManager.swift | 2 +- score-ios/ViewModels/PastGameViewModel.swift | 6 +++--- .../Views/ListViews/UpcomingGamesView.swift | 19 ++++++++++--------- 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/score-ios/Models/Game.swift b/score-ios/Models/Game.swift index 64384f9..f125d9d 100644 --- a/score-ios/Models/Game.swift +++ b/score-ios/Models/Game.swift @@ -55,7 +55,7 @@ struct Game : GameType, Identifiable { self.address = game.location ?? "N/A" self.timeUpdates = parseScoreBreakdown(game.scoreBreakdown) self.gameUpdates = parseBoxScore(decodeBoxScoreArray(boxScores: game.boxScore)) - self.ticketLink = game.ticketLink + //self.ticketLink = game.ticketLink } init( diff --git a/score-ios/Models/Sport.swift b/score-ios/Models/Sport.swift index 837a2fa..453e9af 100644 --- a/score-ios/Models/Sport.swift +++ b/score-ios/Models/Sport.swift @@ -14,9 +14,9 @@ enum Sport : String, Identifiable, CaseIterable, CustomStringConvertible { case All // Both -// case Basketball + case Basketball // case CrossCountry -// case IceHockey + case IceHockey case Lacrosse case Soccer // case Squash @@ -60,12 +60,12 @@ enum Sport : String, Identifiable, CaseIterable, CustomStringConvertible { switch self { case .All: return "All" -// case .Basketball: -// return "Basketball" + case .Basketball: + return "Basketball" // case .CrossCountry: // return "Cross Country" -// case .IceHockey: -// return "Ice Hockey" + case .IceHockey: + return "Ice Hockey" case .Lacrosse: return "Lacrosse" case .Soccer: diff --git a/score-ios/Networking/NetworkManager.swift b/score-ios/Networking/NetworkManager.swift index 57bace5..ea22bdc 100644 --- a/score-ios/Networking/NetworkManager.swift +++ b/score-ios/Networking/NetworkManager.swift @@ -15,7 +15,7 @@ class NetworkManager { let apolloClient = ApolloClient(url: ScoreEnvironment.baseURL) func fetchGames(limit: Int, offset: Int, completion: @escaping ([GamesQuery.Data.Game]?, Error?) -> Void) { - apolloClient.fetch(query: GamesQuery(limit: limit, offset: offset)) { result in + apolloClient.fetch(query: GamesQuery()) { result in switch result { case .success(let graphQLResult): if let gamesData = graphQLResult.data?.games?.compactMap({ $0 }) { diff --git a/score-ios/ViewModels/PastGameViewModel.swift b/score-ios/ViewModels/PastGameViewModel.swift index aeb8dcf..f0261fc 100644 --- a/score-ios/ViewModels/PastGameViewModel.swift +++ b/score-ios/ViewModels/PastGameViewModel.swift @@ -16,7 +16,7 @@ class PastGameViewModel: ObservableObject { case .Baseball: return game.timeUpdates.count > 3 ? game.timeUpdates.count - 3 : 9 // number of innings is not always 9 case .Soccer: return 2 -// case .IceHockey: return 3 + case .IceHockey: return 3 case .FieldHockey, .Football, .Lacrosse: return 4 default: return 1 } @@ -28,7 +28,7 @@ class PastGameViewModel: ObservableObject { // the last three columns are total runs, hits, and errors // if backend stores null for scoreBreakdown, display regular score box with 10 columns case .Soccer: return game.timeUpdates.count >= 3 ? game.timeUpdates.count : 3 -// case .IceHockey: return game.timeUpdates.count + case .IceHockey: return game.timeUpdates.count case .FieldHockey, .Football, .Lacrosse: return game.timeUpdates.count >= 5 ? game.timeUpdates.count : 5 default: return 1 } @@ -38,7 +38,7 @@ class PastGameViewModel: ObservableObject { switch game.sport { case .Baseball: return -1 case .Soccer: return game.timeUpdates.count - 3 -// case .IceHockey: return game.timeUpdates.count - 4 + case .IceHockey: return game.timeUpdates.count - 4 case .FieldHockey, .Football, .Lacrosse: return game.timeUpdates.count - 5 default: return -1 } diff --git a/score-ios/Views/ListViews/UpcomingGamesView.swift b/score-ios/Views/ListViews/UpcomingGamesView.swift index 2bc791f..01f3ea9 100644 --- a/score-ios/Views/ListViews/UpcomingGamesView.swift +++ b/score-ios/Views/ListViews/UpcomingGamesView.swift @@ -21,15 +21,16 @@ struct UpcomingGamesView: View { ScrollView (.vertical, showsIndicators: false) { ZStack { LazyVStack(spacing: 0, pinnedViews: [.sectionHeaders]) { - CarouselView(games: vm.topUpcomingGames, title: "Upcoming", - cardView: { game in - UpcomingGameCard(game: game) - }, - gameView: { game in - GameView(game: game, viewModel: PastGameViewModel(game: game)) - }) - .padding(.horizontal, paddingMain) - + if !vm.topUpcomingGames.isEmpty { + CarouselView(games: vm.topUpcomingGames, title: "Upcoming", + cardView: { game in + UpcomingGameCard(game: game) + }, + gameView: { game in + GameView(game: game, viewModel: PastGameViewModel(game: game)) + }) + .padding(.horizontal, paddingMain) + } Section(header: GameSectionHeaderView(headerTitle: "Game Schedule") .padding(.horizontal, paddingMain)) { From 3f83a4c145a0c497087211c5c327aabcb5b4b22b Mon Sep 17 00:00:00 2001 From: durualayli Date: Tue, 27 Jan 2026 15:07:33 -0500 Subject: [PATCH 2/4] changing the two small fixes to original --- score-ios/Models/Game.swift | 2 +- score-ios/Models/GraphQL/schema.graphqls | 2 ++ score-ios/Networking/NetworkManager.swift | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/score-ios/Models/Game.swift b/score-ios/Models/Game.swift index f125d9d..64384f9 100644 --- a/score-ios/Models/Game.swift +++ b/score-ios/Models/Game.swift @@ -55,7 +55,7 @@ struct Game : GameType, Identifiable { self.address = game.location ?? "N/A" self.timeUpdates = parseScoreBreakdown(game.scoreBreakdown) self.gameUpdates = parseBoxScore(decodeBoxScoreArray(boxScores: game.boxScore)) - //self.ticketLink = game.ticketLink + self.ticketLink = game.ticketLink } init( diff --git a/score-ios/Models/GraphQL/schema.graphqls b/score-ios/Models/GraphQL/schema.graphqls index 9bacad1..88988cb 100644 --- a/score-ios/Models/GraphQL/schema.graphqls +++ b/score-ios/Models/GraphQL/schema.graphqls @@ -74,6 +74,7 @@ Attributes: - url: The URL to the video. - published_at: The date and time the video was published. - duration: The duration of the video (optional). + - sportsType: The sport type extracted from the video title. """ type YoutubeVideoType { id: String @@ -84,6 +85,7 @@ type YoutubeVideoType { url: String! publishedAt: String! duration: String + sportsType: String } """ diff --git a/score-ios/Networking/NetworkManager.swift b/score-ios/Networking/NetworkManager.swift index ea22bdc..57bace5 100644 --- a/score-ios/Networking/NetworkManager.swift +++ b/score-ios/Networking/NetworkManager.swift @@ -15,7 +15,7 @@ class NetworkManager { let apolloClient = ApolloClient(url: ScoreEnvironment.baseURL) func fetchGames(limit: Int, offset: Int, completion: @escaping ([GamesQuery.Data.Game]?, Error?) -> Void) { - apolloClient.fetch(query: GamesQuery()) { result in + apolloClient.fetch(query: GamesQuery(limit: limit, offset: offset)) { result in switch result { case .success(let graphQLResult): if let gamesData = graphQLResult.data?.games?.compactMap({ $0 }) { From 02cebf7e38b710f18150892f367abfc658b70594 Mon Sep 17 00:00:00 2001 From: durualayli Date: Tue, 27 Jan 2026 15:46:00 -0500 Subject: [PATCH 3/4] past games --- score-ios/ViewModels/PastGameViewModel.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/score-ios/ViewModels/PastGameViewModel.swift b/score-ios/ViewModels/PastGameViewModel.swift index f0261fc..b53794c 100644 --- a/score-ios/ViewModels/PastGameViewModel.swift +++ b/score-ios/ViewModels/PastGameViewModel.swift @@ -15,6 +15,8 @@ class PastGameViewModel: ObservableObject { switch game.sport { case .Baseball: return game.timeUpdates.count > 3 ? game.timeUpdates.count - 3 : 9 // number of innings is not always 9 + case .Basketball: return game.sex == .Men ? 2 : 4 + // number of periods change between sex case .Soccer: return 2 case .IceHockey: return 3 case .FieldHockey, .Football, .Lacrosse: return 4 @@ -27,8 +29,11 @@ class PastGameViewModel: ObservableObject { case .Baseball: return game.timeUpdates.count > 3 ? game.timeUpdates.count - 2 : 10 // the last three columns are total runs, hits, and errors // if backend stores null for scoreBreakdown, display regular score box with 10 columns + case .Basketball: + let cols = game.sex == .Men ? 3 : 5 + return game.timeUpdates.count >= cols ? game.timeUpdates.count : cols case .Soccer: return game.timeUpdates.count >= 3 ? game.timeUpdates.count : 3 - case .IceHockey: return game.timeUpdates.count + case .IceHockey: return game.timeUpdates.count >= 4 ? game.timeUpdates.count : 4 case .FieldHockey, .Football, .Lacrosse: return game.timeUpdates.count >= 5 ? game.timeUpdates.count : 5 default: return 1 } @@ -37,6 +42,7 @@ class PastGameViewModel: ObservableObject { var numberOfOvertimes: Int { switch game.sport { case .Baseball: return -1 + case .Basketball: return game.sex == .Men ? game.timeUpdates.count - 3 : game.timeUpdates.count - 5 case .Soccer: return game.timeUpdates.count - 3 case .IceHockey: return game.timeUpdates.count - 4 case .FieldHockey, .Football, .Lacrosse: return game.timeUpdates.count - 5 From 9606817933be45ce1ac267a50dbdc2f2ff434a61 Mon Sep 17 00:00:00 2001 From: durualayli Date: Wed, 28 Jan 2026 18:00:08 -0500 Subject: [PATCH 4/4] Styling --- score-ios/Models/Sport.swift | 104 +++++++------------ score-ios/ViewModels/PastGameViewModel.swift | 28 +++-- 2 files changed, 52 insertions(+), 80 deletions(-) diff --git a/score-ios/Models/Sport.swift b/score-ios/Models/Sport.swift index 453e9af..128c3cc 100644 --- a/score-ios/Models/Sport.swift +++ b/score-ios/Models/Sport.swift @@ -15,32 +15,32 @@ enum Sport : String, Identifiable, CaseIterable, CustomStringConvertible { // Both case Basketball -// case CrossCountry + // case CrossCountry case IceHockey case Lacrosse case Soccer -// case Squash -// case SwimmingDiving -// case Tennis -// case TrackField + // case Squash + // case SwimmingDiving + // case Tennis + // case TrackField // Women -// case Fencing + // case Fencing case FieldHockey -// case Gymnastics -// case Rowing -// case Sailing -// case Softball -// case Volleyball + // case Gymnastics + // case Rowing + // case Sailing + // case Softball + // case Volleyball // Men case Baseball case Football -// case Golf -// case RowingHeavyweight -// case RowingLightweight -// case SprintFootball -// case Wrestling + // case Golf + // case RowingHeavyweight + // case RowingLightweight + // case SprintFootball + // case Wrestling // init from a string from backend (might include spaces) init?(normalizedValue: String) { @@ -58,54 +58,30 @@ enum Sport : String, Identifiable, CaseIterable, CustomStringConvertible { // Make a to string function var description: String { switch self { - case .All: - return "All" - case .Basketball: - return "Basketball" -// case .CrossCountry: -// return "Cross Country" - case .IceHockey: - return "Ice Hockey" - case .Lacrosse: - return "Lacrosse" - case .Soccer: - return "Soccer" -// case .Squash: -// return "Squash" -// case .SwimmingDiving: -// return "Swimming" -// case .Tennis: -// return "Tennis" -// case .TrackField: -// return "Track and Field" -// case .Fencing: -// return "Fencing" - case .FieldHockey: - return "Field Hockey" -// case .Gymnastics: -// return "Gymnastics" -// case .Rowing: -// return "Rowing" -// case .Sailing: -// return "Sailing" -// case .Softball: -// return "Softball" -// case .Volleyball: -// return "Volleyball" - case .Baseball: - return "Baseball" - case .Football: - return "Football" -// case .Golf: -// return "Golf" -// case .RowingHeavyweight: -// return "HW Rowing" -// case .RowingLightweight: -// return "LW Rowing" -// case .SprintFootball: -// return "Sprint Football" -// case .Wrestling: -// return "Wrestling" + case .All: return "All" + case .Basketball: return "Basketball" + // case .CrossCountry: return "Cross Country" + case .IceHockey: return "Ice Hockey" + case .Lacrosse: return "Lacrosse" + case .Soccer: return "Soccer" + // case .Squash: return "Squash" + // case .SwimmingDiving: return "Swimming" + // case .Tennis: return "Tennis" + // case .TrackField: return "Track and Field" + // case .Fencing: return "Fencing" + case .FieldHockey: return "Field Hockey" + // case .Gymnastics: return "Gymnastics" + // case .Rowing: return "Rowing" + // case .Sailing: return "Sailing" + // case .Softball: return "Softball" + // case .Volleyball: return "Volleyball" + case .Baseball: return "Baseball" + case .Football: return "Football" + // case .Golf: return "Golf" + // case .RowingHeavyweight: return "HW Rowing" + // case .RowingLightweight: return "LW Rowing" + // case .SprintFootball: return "Sprint Football" + // case .Wrestling: return "Wrestling" } } } diff --git a/score-ios/ViewModels/PastGameViewModel.swift b/score-ios/ViewModels/PastGameViewModel.swift index b53794c..af36f61 100644 --- a/score-ios/ViewModels/PastGameViewModel.swift +++ b/score-ios/ViewModels/PastGameViewModel.swift @@ -13,22 +13,18 @@ class PastGameViewModel: ObservableObject { var numberOfRounds: Int { switch game.sport { - case .Baseball: return game.timeUpdates.count > 3 ? game.timeUpdates.count - 3 : 9 - // number of innings is not always 9 - case .Basketball: return game.sex == .Men ? 2 : 4 - // number of periods change between sex - case .Soccer: return 2 - case .IceHockey: return 3 - case .FieldHockey, .Football, .Lacrosse: return 4 - default: return 1 + case .Baseball: game.timeUpdates.count > 3 ? game.timeUpdates.count - 3 : 9 + case .Basketball: game.sex == .Men ? 2 : 4 + case .Soccer: 2 + case .IceHockey: 3 + case .FieldHockey, .Football, .Lacrosse: 4 + default: 1 } } var numberOfColumns: Int { switch game.sport { case .Baseball: return game.timeUpdates.count > 3 ? game.timeUpdates.count - 2 : 10 - // the last three columns are total runs, hits, and errors - // if backend stores null for scoreBreakdown, display regular score box with 10 columns case .Basketball: let cols = game.sex == .Men ? 3 : 5 return game.timeUpdates.count >= cols ? game.timeUpdates.count : cols @@ -41,12 +37,12 @@ class PastGameViewModel: ObservableObject { var numberOfOvertimes: Int { switch game.sport { - case .Baseball: return -1 - case .Basketball: return game.sex == .Men ? game.timeUpdates.count - 3 : game.timeUpdates.count - 5 - case .Soccer: return game.timeUpdates.count - 3 - case .IceHockey: return game.timeUpdates.count - 4 - case .FieldHockey, .Football, .Lacrosse: return game.timeUpdates.count - 5 - default: return -1 + case .Baseball: -1 + case .Basketball: game.sex == .Men ? game.timeUpdates.count - 3 : game.timeUpdates.count - 5 + case .Soccer: game.timeUpdates.count - 3 + case .IceHockey: game.timeUpdates.count - 4 + case .FieldHockey, .Football, .Lacrosse: game.timeUpdates.count - 5 + default: -1 } }