- PaywallView: remove unnecessary nil coalescing for currencyCode - GameDAGRouter: change var to let for immutable compositeKeys - GamesHistoryRow/View: add missing wnba and nwsl switch cases - VisitDetailView: fix unused variable in preview - AchievementEngine: use convenience init to avoid default parameter warning - ProgressCardGenerator: use method overload instead of default parameter - StadiumProximityMatcher: extract constants to ProximityConstants enum Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
67 lines
1.9 KiB
Swift
67 lines
1.9 KiB
Swift
import SwiftUI
|
|
|
|
struct GamesHistoryRow: View {
|
|
let visit: StadiumVisit
|
|
let stadium: Stadium?
|
|
|
|
var body: some View {
|
|
HStack(spacing: 12) {
|
|
// Sport icon
|
|
if let stadium {
|
|
Image(systemName: sportIcon(for: stadium.sport))
|
|
.font(.title3)
|
|
.foregroundStyle(stadium.sport.themeColor)
|
|
.frame(width: 32)
|
|
}
|
|
|
|
// Visit info
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
// Date
|
|
Text(visit.visitDate.formatted(date: .abbreviated, time: .omitted))
|
|
.font(.subheadline.bold())
|
|
|
|
// Teams (if game)
|
|
if let matchup = visit.matchupDescription {
|
|
Text(matchup)
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
} else {
|
|
Text(visit.stadiumNameAtVisit)
|
|
.font(.caption)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
|
|
Spacer()
|
|
|
|
// Chevron
|
|
Image(systemName: "chevron.right")
|
|
.font(.caption)
|
|
.foregroundStyle(.tertiary)
|
|
}
|
|
.padding()
|
|
.background(Color(.systemBackground))
|
|
.clipShape(RoundedRectangle(cornerRadius: 10))
|
|
}
|
|
|
|
private func sportIcon(for sport: Sport) -> String {
|
|
switch sport {
|
|
case .mlb: return "baseball"
|
|
case .nba: return "basketball"
|
|
case .nhl: return "hockey.puck"
|
|
case .nfl: return "football"
|
|
case .mls: return "soccerball"
|
|
case .wnba: return "basketball"
|
|
case .nwsl: return "soccerball"
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
VStack {
|
|
Text("GamesHistoryRow Preview")
|
|
}
|
|
.padding()
|
|
.background(Color(.systemGroupedBackground))
|
|
}
|