feat(progress): add progress tracking enhancements

- Enable zoom/pan on progress map with reset button
- Add visit count badges to stadium chips
- Create GamesHistoryView with year grouping and sport filters
- Create StadiumVisitHistoryView for viewing all visits to a stadium
- Add VisitListCard and GamesHistoryRow components
- Add "See All" navigation from Recent Visits to Games History
- Add tests for map interactions, visit lists, and games history

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-12 21:34:33 -06:00
parent ed526cabeb
commit 89167c01d7
11 changed files with 979 additions and 16 deletions

View File

@@ -0,0 +1,54 @@
import SwiftUI
import MapKit
@MainActor
@Observable
final class MapInteractionViewModel {
// Default region: Continental US
static let defaultRegion = MKCoordinateRegion(
center: CLLocationCoordinate2D(latitude: 39.8283, longitude: -98.5795),
span: MKCoordinateSpan(latitudeDelta: 35, longitudeDelta: 55)
)
// City-level zoom span
static let stadiumZoomSpan = MKCoordinateSpan(latitudeDelta: 0.01, longitudeDelta: 0.01)
var region: MKCoordinateRegion = MapInteractionViewModel.defaultRegion
var hasUserInteracted: Bool = false
var selectedStadiumId: String?
var shouldShowResetButton: Bool {
hasUserInteracted
}
func userDidInteract() {
hasUserInteracted = true
}
func resetToDefault() {
withAnimation(.easeInOut(duration: 0.5)) {
region = MapInteractionViewModel.defaultRegion
}
hasUserInteracted = false
selectedStadiumId = nil
}
func zoomToStadium(at coordinate: CLLocationCoordinate2D) {
withAnimation(.easeInOut(duration: 0.3)) {
region = MKCoordinateRegion(
center: coordinate,
span: MapInteractionViewModel.stadiumZoomSpan
)
}
hasUserInteracted = true
}
func selectStadium(id: String, coordinate: CLLocationCoordinate2D) {
selectedStadiumId = id
zoomToStadium(at: coordinate)
}
func deselectStadium() {
selectedStadiumId = nil
}
}