Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions score-ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
1C87865D2D8CD76900EBDF74 /* TrailingFadeGradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C87865C2D8CD76900EBDF74 /* TrailingFadeGradient.swift */; };
1C87865F2D8CDADC00EBDF74 /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1C87865E2D8CDADC00EBDF74 /* String+Extension.swift */; };
CE335CD32C922E8D0037F572 /* PrimaryColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD22C922E8D0037F572 /* PrimaryColors.swift */; };
CE335CD52C922ECB0037F572 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD42C922ECB0037F572 /* Constants.swift */; };
CE335CD72C922F390037F572 /* Dates.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE335CD62C922F390037F572 /* Dates.swift */; };
Expand Down Expand Up @@ -96,6 +98,8 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
1C87865C2D8CD76900EBDF74 /* TrailingFadeGradient.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrailingFadeGradient.swift; sourceTree = "<group>"; };
1C87865E2D8CDADC00EBDF74 /* String+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extension.swift"; sourceTree = "<group>"; };
CE335CD22C922E8D0037F572 /* PrimaryColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimaryColors.swift; sourceTree = "<group>"; };
CE335CD42C922ECB0037F572 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
CE335CD62C922F390037F572 /* Dates.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dates.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -198,6 +202,21 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
1C87865B2D8CD73C00EBDF74 /* ViewModifiers */ = {
isa = PBXGroup;
children = (
1C87865C2D8CD76900EBDF74 /* TrailingFadeGradient.swift */,
);
path = ViewModifiers;
sourceTree = "<group>";
};
CE335CCA2C9226EB0037F572 /* Configs */ = {
isa = PBXGroup;
children = (
);
path = Configs;
sourceTree = "<group>";
};
CE335CCC2C9226F90037F572 /* Models */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -226,11 +245,13 @@
CE335CCE2C9227050037F572 /* Utils */ = {
isa = PBXGroup;
children = (
1C87865B2D8CD73C00EBDF74 /* ViewModifiers */,
CE335CD22C922E8D0037F572 /* PrimaryColors.swift */,
CE335CD42C922ECB0037F572 /* Constants.swift */,
CE335CD62C922F390037F572 /* Dates.swift */,
CE528FA32C9653C200C238B5 /* Error.swift */,
CE3C9C422D011A23008BFB4C /* OrdinalSuffix.swift */,
1C87865E2D8CDADC00EBDF74 /* String+Extension.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -650,6 +671,7 @@
D86347AF2CDBD2F4003DD8F6 /* PastGameCard.swift in Sources */,
CE8ED5122D6C3FCB00A274DE /* CarouselView.swift in Sources */,
CE528FF72C979DA000C238B5 /* GameView.swift in Sources */,
1C87865D2D8CD76900EBDF74 /* TrailingFadeGradient.swift in Sources */,
CE8ED4F82D6BF42B00A274DE /* Sport.swift in Sources */,
D87882282CC060FC00421F67 /* GameDetailedScoreView.swift in Sources */,
D83EE8862CC9917C008B693C /* ScoreSummaryTile.swift in Sources */,
Expand All @@ -671,6 +693,7 @@
CE8ED5142D6C42D400A274DE /* GameSectionHeaderView.swift in Sources */,
D86347B12CDBFF7C003DD8F6 /* UpcomingGamesView.swift in Sources */,
D86347DF2CE98B3C003DD8F6 /* MainTabView.swift in Sources */,
1C87865F2D8CDADC00EBDF74 /* String+Extension.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions score-ios/Utils/String+Extension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// String+Extension.swift
// score-ios
//
// Created by Jay Zheng on 3/20/25.
//

import SwiftUI

extension String {
/// remove "University of " and replay it with "U", eg. University of Miama -> UMiami
func removingUniversityPrefix() -> String {
return self.localizedCaseInsensitiveContains("University of ")
? self.replacingOccurrences(of: "University of ", with: "U ", options: .caseInsensitive)
: self
}
}
41 changes: 41 additions & 0 deletions score-ios/Utils/ViewModifiers/TrailingFadeGradient.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// TrailingFadeGradient.swift
// score-ios
//
// Created by Jay Zheng on 3/20/25.
//

import SwiftUI

/// A view modifier that adds a trailing fade gradient to indicate scrollable content
struct TrailingFadeGradient: ViewModifier {
var width: CGFloat
var backgroundColor: Color

init(width: CGFloat = 30, backgroundColor: Color = .white) {
self.width = width
self.backgroundColor = backgroundColor
}

func body(content: Content) -> some View {
content
.overlay(
LinearGradient(
gradient: Gradient(colors: [.clear, backgroundColor]),
startPoint: .leading,
endPoint: .trailing
)
.frame(width: width)
.allowsHitTesting(false),
alignment: .trailing
)
}
}
// Add this as a view extension
extension View {
/// Adds a trailing fade gradient to indicate scrollable content
func withTrailingFadeGradient(width: CGFloat = 30, backgroundColor: Color = .white) -> some View {
self.modifier(TrailingFadeGradient(width: width, backgroundColor: backgroundColor))
}
}

2 changes: 1 addition & 1 deletion score-ios/ViewModels/GamesViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import SwiftUI

class GamesViewModel: ObservableObject
class GamesViewModel: ObservableObject
{
@Published var errorMessage: String?
@Published var games: [Game] = [] // List of all games
Expand Down
13 changes: 8 additions & 5 deletions score-ios/Views/DetailedViews/DynamicScoreBox.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,14 @@ extension DynamicScoreBox {

private func thirdRow(columnWidth: CGFloat) -> some View {
HStack(spacing: 0) {
Text(game.opponent.name)
.lineLimit(1)
.font(Constants.Fonts.gameText)
.frame(width: 55, alignment: .leading)
.padding(.leading, 5)
ScrollView(.horizontal, showsIndicators: false){
Text(game.opponent.name.removingUniversityPrefix())
.lineLimit(1)
.font(Constants.Fonts.gameText)
.frame(alignment: .leading)
.padding(.leading, 5)
}
.withTrailingFadeGradient()

ForEach(0..<numberOfRounds, id: \..self) { index in
Text(game.timeUpdates.indices.contains(index) ? "\(game.timeUpdates[index].opponentScore)" : "-")
Expand Down
21 changes: 14 additions & 7 deletions score-ios/Views/DetailedViews/GameDetailedScoreView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ extension GameDetailedScoreView {
VStack(alignment: .leading, spacing: 4) {
Text("Men's Football")
.font(Constants.Fonts.medium14)
Text("Cornell vs. " + game.opponent.name)
.font(Constants.Fonts.semibold24)

ScrollView(.horizontal, showsIndicators: false){
Text("Cornell vs. " + game.opponent.name.removingUniversityPrefix())
.font(Constants.Fonts.semibold24)
}
.withTrailingFadeGradient()

HStack() {
Image("Location-g")
.resizable()
Expand Down Expand Up @@ -244,10 +247,14 @@ extension GameDetailedScoreView {

private var thirdRow: some View {
HStack {
Text(game.opponent.name)
.font(Constants.Fonts.gameText)
.foregroundStyle(.gray)
.frame(width: 60, alignment: .leading)
ScrollView(.horizontal, showsIndicators: false){
Text(game.opponent.name.removingUniversityPrefix())
.font(Constants.Fonts.gameText)
.foregroundStyle(.gray)
.frame(width: 60, alignment: .leading)
}
.withTrailingFadeGradient()

Text("-")
.font(Constants.Fonts.gameText)
.foregroundStyle(.gray)
Expand Down
9 changes: 6 additions & 3 deletions score-ios/Views/DetailedViews/GameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,12 @@ extension GameView {
VStack(alignment: .leading, spacing: 4) {
Text("\(game.sex.description) \(game.sport.description)")
.font(Constants.Fonts.subheader)
Text("Cornell vs. " + game.opponent.name)
.font(Constants.Fonts.header)

ScrollView(.horizontal, showsIndicators: false){
Text("Cornell vs. " + game.opponent.name.removingUniversityPrefix())
.font(Constants.Fonts.header)
}
.withTrailingFadeGradient()

HStack(spacing: 10) {
HStack {
Image("Location-g")
Expand Down
2 changes: 1 addition & 1 deletion score-ios/Views/DetailedViews/PastGameCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extension PastGameCard {
Constants.Colors.gray_icons
}
.frame(width: 25, height: 27)
Text(game.opponent.name)
Text(game.opponent.name.removingUniversityPrefix())
.font(Constants.Fonts.gameTitle)
.foregroundStyle(Color.black)
Spacer()
Expand Down
3 changes: 2 additions & 1 deletion score-ios/Views/DetailedViews/UpcomingCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ extension UpcomingGameCard {
}
.frame(width: 24, height: 24)

Text(game.opponent.name)
Text(game.opponent.name.removingUniversityPrefix())
.font(Constants.Fonts.gameTitle)
.foregroundStyle(Color.black)


Spacer()

Image(game.sport.rawValue + "-g")
Expand Down
11 changes: 7 additions & 4 deletions score-ios/Views/ListViews/PastGameTile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,13 @@ struct PastGameTile: View {
}
.frame(width: 20, height: 20)

Text(game.opponent.name)
.font(Constants.Fonts.gameTitle)
.lineLimit(1)

ScrollView(.horizontal, showsIndicators: false){
Text(game.opponent.name.removingUniversityPrefix())
.font(Constants.Fonts.gameTitle)
.lineLimit(1)
}
.withTrailingFadeGradient()

Spacer()

// Opponent Score with Arrow
Expand Down
11 changes: 7 additions & 4 deletions score-ios/Views/ListViews/UpcomingGameTile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,13 @@ struct UpcomingGameTile: View {
Constants.Colors.gray_icons
}
.frame(width: 20, height: 20)

Text(game.opponent.name)
.font(Constants.Fonts.gameTitle)
.lineLimit(1)

ScrollView(.horizontal, showsIndicators: false){
Text(game.opponent.name.removingUniversityPrefix())
.font(Constants.Fonts.gameTitle)
.lineLimit(1)
}
.withTrailingFadeGradient()
}
.padding(.leading, 20)

Expand Down