Commit Graph

72 Commits

Author SHA1 Message Date
Trey t
0524284ab8 feat: add planning tips and grouped trip options sorting
- Add PlanningTips data model with 105 tips across 7 categories
- Wire random tips into HomeView (3 tips per session)
- Add TripOptionsGrouper for grouping by city/game count and mileage
- Update TripOptionsView with sectioned display when sorting
- Recommended and Best Efficiency remain flat lists

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 21:49:04 -06:00
Trey t
89167c01d7 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>
2026-01-12 21:34:33 -06:00
Trey t
ed526cabeb refactor(wizard): show all steps at once with validation gating
- Replace progressive reveal with single fade-in of all steps
- Add canPlanTrip validation requiring all fields before planning
- Disable Plan Trip button until all selections are made
- Simplify ViewModel by removing step-by-step visibility logic
- Update tests for new validation-based approach

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 21:19:35 -06:00
Trey t
94bb68d431 fix(wizard): improve UX with step reordering and UI polish
- Reorder wizard steps: dates before sports (enables availability check)
- Add contentShape(Rectangle()) for full tap targets on all cards
- Fix route preference showing preselected value
- Fix sport cards having inconsistent heights
- Speed up step reveal animation (0.3s → 0.15s)
- Add debounced scroll delay to avoid interrupting selection

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 21:13:45 -06:00
Trey t
8a958a0f7e feat: replace TripCreationView with TripWizardView in HomeView
Remove classic trip creation form and use new wizard flow directly.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:52:29 -06:00
Trey t
d2b530b06f feat(wizard): add TripWizardView container with progressive reveal
- Auto-scroll to newly revealed sections
- Integration with TripPlanningEngine
- Navigation to TripOptionsView on success
- Error handling with alerts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:49:28 -06:00
Trey t
bddbebee32 feat(wizard): add all wizard step components
- DatesStep: date range selection with duration indicator
- RegionsStep: geographic region selection
- RoutePreferenceStep: direct/scenic/balanced preference
- RepeatCitiesStep: unique vs repeat city visits
- MustStopsStep: optional must-stop locations
- ReviewStep: summary and plan button

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:48:27 -06:00
Trey t
002dfbd872 feat(wizard): add SportsStep with availability graying
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:47:11 -06:00
Trey t
4371c1cc0c feat(wizard): add PlanningModeStep component
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:46:44 -06:00
Trey t
abdf11e62e feat(wizard): add TripWizardViewModel with reveal state logic
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:45:52 -06:00
Trey t
d39e8cff30 fix: use dynamic team lookup in scraper for stadium renames
Replace hardcoded stadiumTeamMap with AppDataProvider lookup so
stadium renames (e.g., AT&T Center → Frost Bank Center) work
automatically via CloudKit sync without code changes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:36:36 -06:00
Trey t
393bb8d6f8 feat: enhance game picker row with location and broadcast info
Add city/state location and broadcast channel to GameCalendarRow
in the "By Games" trip building flow. Users now see:
- Clock icon with game time
- Building icon with stadium name
- Location pin with city, state
- TV icon with broadcast channel (when available)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:29:10 -06:00
Trey t
37a1347ce3 perf: lazy hierarchical loading for game picker
Replace upfront loading of all games with lazy Sport → Team → Game
hierarchy. Games are now fetched per-team when expanded and cached
to prevent re-fetching. Also removes pagination workaround and
pre-computes groupings in ScheduleViewModel to avoid per-render work.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 20:19:46 -06:00
Trey t
1ef3b0335e perf: add pagination to game selection view
Fixes lag and color inconsistency in trip creation game selection.
- Add pagination with 50 games per page to TripCreationViewModel
- Add displayedAvailableGames, loadInitialAvailableGames, loadMoreAvailableGames
- Update GamePickerSheet to use paginated data with infinite scroll trigger
- Show "Load more games" button with progress indicator and count

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:16:42 -06:00
Trey t
746b56bc77 perf: add pagination to schedule list
Loads 50 games at a time to fix lag with large datasets.

- Add pagination state (displayedGames, currentPage, allFilteredGames)
- Add loadInitialGames() and loadMoreGames() methods
- Update gamesBySport to use displayedGames
- Add infinite scroll trigger via onAppear on last game
- Add ProgressView indicator when more games available
- Reset pagination when search text changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 19:07:54 -06:00
Trey t
64c64093c4 feat: add timezone support for stadium-local game times
Adds timeZoneIdentifier to Stadium model and localGameTime/localGameTimeShort
computed properties to RichGame. Game times can now display in venue local
timezone. Also adds timezone field to Python StadiumInfo dataclass with
example entries for Pacific, Central, Mountain, and Toronto timezones.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:58:35 -06:00
Trey t
402a8877f3 fix: remove redundant My Trips title from tab view
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:52:18 -06:00
Trey t
1ffd6122c9 fix: pace capsule animation glitch in trip options view
Adds contentTransition(.identity) to pace filter icon and text to prevent
SwiftUI's default text morphing animation when changing pace filter
(All/Packed/Moderate/Relaxed). Also adds animation(nil, value:) to
disable animations on the capsule container.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:48:16 -06:00
Trey t
cf939c4ba3 fix: disable animation on Reset button in game picker
Wrap selectedIds.removeAll() in withTransaction with disablesAnimations
to prevent animation glitches when clearing all selections at once.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:45:08 -06:00
Trey t
d255e28dcc fix: remove weird animation on game selection
Disables implicit animation when toggling game selection to prevent
visual glitches/morphing effect. Uses both withTransaction to disable
animations on the state change and .animation(nil, value:) on the
selection indicator and row background.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:41:40 -06:00
Trey t
7946161945 feat: show location info in schedule view
Adds stadium name and city to game rows in the schedule list.
The GameRowView now has a showLocation parameter that displays
a location row with mappin icon when enabled.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:38:17 -06:00
Trey t
b14f72a0fb perf: move trip generation off main actor
Fixes launch freeze by running TripPlanningEngine in background task.
UI now responsive immediately while trips generate.

- Move heavy computation to Task.detached with .userInitiated priority
- Change all helper methods to nonisolated static functions
- Create local TripPlanningEngine in background task instead of instance property

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 18:27:49 -06:00
Trey t
e70b9faab8 fix: show all team games (home and away) when browsing by team
Previously, browsing by team (e.g., Houston Astros) only showed home games.
Now games are associated with both home AND away teams, so selecting a team
shows all their games regardless of whether they're playing at home or away.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 11:09:50 -06:00
Trey t
3978429716 feat: complete delta sync implementation - add allGames, update callers
- Add allRichGames method to DataProvider
- Update TripCreationViewModel.loadGamesForBrowsing to use allGames (removes 90-day limit)
- Update MockCloudKitService sync methods to use new delta sync signatures
- Update MockAppDataProvider with renamed methods and new allGames/allRichGames
- Fix all callers: ScheduleViewModel, TripCreationViewModel, SuggestedTripsGenerator, GameMatcher
- Update CLAUDE.md documentation with new method names

This completes the delta sync implementation:
- CloudKit sync now uses modificationDate for proper delta sync
- First sync fetches ALL data, subsequent syncs only fetch modified records
- "By Games" mode now shows all available games (not just 90 days)
- All data types (stadiums, teams, games) use consistent delta sync pattern

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 11:04:52 -06:00
Trey t
b3ad386d2b refactor: rename fetch methods to filter, add allGames
- fetchGames → filterGames (clarifies local SwiftData query)
- fetchRichGames → filterRichGames
- Add allGames(for:) method for unfiltered game access

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 10:51:26 -06:00
Trey t
b89c0d58e2 feat(sync): update CanonicalSyncService to use delta sync
- syncStadiums now passes lastSync to CloudKit fetch
- syncTeams simplified to single CloudKit call (not per-sport loop)
- syncGames removes 6-month date range, uses modificationDate delta

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 10:49:53 -06:00
Trey t
3bb903ab09 feat(sync): update CloudKit sync methods to use modificationDate delta
- fetchStadiumsForSync now accepts since: Date? parameter
- fetchTeamsForSync changed from per-sport to all teams with delta sync
- fetchGamesForSync uses modificationDate instead of game dateTime

When lastSync is nil, fetches all records (first sync).
When lastSync has value, fetches only modified records (delta sync).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 10:48:34 -06:00
Trey t
1703ca5b0f refactor: change domain model IDs from UUID to String canonical IDs
This refactor fixes the achievement system by using stable canonical string
IDs (e.g., "stadium_mlb_fenway_park") instead of random UUIDs. This ensures
stadium mappings for achievements are consistent across app launches and
CloudKit sync operations.

Changes:
- Stadium, Team, Game: id property changed from UUID to String
- Trip, TripStop, TripPreferences: updated to use String IDs for games/stadiums
- CKModels: removed UUID parsing, use canonical IDs directly
- AchievementEngine: now matches against canonical stadium IDs
- All test files updated to use String IDs instead of UUID()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 09:24:33 -06:00
Trey t
5c13650742 fix: resolve specificStadium achievement ID mismatch
The Green Monster (Fenway) and Ivy League (Wrigley) achievements
weren't working because:
1. Symbolic IDs use lowercase sport (stadium_mlb_bos)
2. Sport enum uses uppercase raw values (MLB)
3. Visits store stadium UUIDs, not symbolic IDs

Added resolveSymbolicStadiumId() helper that:
- Uppercases the sport string before Sport(rawValue:)
- Looks up team by abbreviation and sport
- Returns the team's stadiumId as UUID string

Also fixed:
- getStadiumIdsForLeague returns UUID strings (not symbolic IDs)
- AchievementProgress.isEarned computed from progress OR stored record
- getStadiumIdsForDivision queries CanonicalTeam properly

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 22:22:29 -06:00
Trey t
dcd5edb229 feat: add sliding window trip generation for By Games mode
Adds a trip duration stepper (2-21 days) to the By Games planning mode.
When users select specific games, the planner now generates ALL possible
N-day windows containing those games (e.g., 7-day trips starting on
different days), finding additional games in each window to maximize
route options.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 19:19:46 -06:00
Trey t
3f80a16201 fix: preserve LocationSearchSheet coordinates in By Route mode
The resolveLocations() function was overwriting valid LocationInput
objects (with coordinates) from LocationSearchSheet. Now it only
resolves locations that don't already have coordinates.

Added debug logging to trace scenario selection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:59:44 -06:00
Trey t
1967eecd52 fix: use LocationSearchSheet for Start/End Location fields
Replaces inline text fields with buttons that open LocationSearchSheet,
matching the must-stop location picker UI for consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:50:19 -06:00
Trey t
81095a8170 fix: resolve 4 UI/planning bugs from issue tracker
- Lock all maps to North America (no pan/zoom) in ProgressMapView and TripDetailView
- Sort saved trips by most cities (stops count)
- Filter cross-country trips to top 2 by stops on home screen
- Use LocationSearchSheet for Follow Team home location (consistent with must-stop)
- Initialize DateRangePicker to show selected dates on appear

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 18:46:40 -06:00
Trey t
b4ac1f7c24 refactor: redesign planning mode picker as 2x2 card grid
Replace crowded segmented control with clean card-based grid.
Each card shows icon and label with selected state highlight.
Fixes text truncation issue with "Follow Team" option.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:48:58 -06:00
Trey t
f7faec01b1 feat: add Follow Team Mode (Scenario D) for road trip planning
Adds a new planning mode that lets users follow a team's schedule
(home + away games) and builds multi-city routes accordingly.

Key changes:
- New ScenarioDPlanner with team filtering and route generation
- Team picker UI with sport grouping and search
- Fix TravelEstimator 5-day limit (was 2-day) for cross-country routes
- Fix DateInterval end boundary to include games on last day
- Comprehensive test suite covering edge cases:
  - Multi-city routes with adequate/insufficient time
  - Optimal game selection per city for feasibility
  - 5-day driving segment limits
  - Multiple driver scenarios

Enables trips like Houston → Chicago → Anaheim following the Astros.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 12:42:43 -06:00
Trey t
5d1e9a3f48 feat: add privacy policy and terms of service
- Add HTML files for hosting at 88oakapps.com/privacy and /terms
- Update SettingsView links to use 88oakapps.com domain
- Plain English, minimal legal documents for freemium app

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 11:00:03 -06:00
Trey t
475f444288 refactor: extract reusable SportSelectorGrid component
Create unified sport selector grid used across Home (Quick Start),
Trip Creation, and Progress views. Removes duplicate button implementations
and ensures consistent grid layout with centered bottom row.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 10:38:10 -06:00
Trey t
a292b5c20c fix: center Quick Start bottom row with consistent button sizing
Use GeometryReader to calculate button width as 1/4 of available space,
ensuring all buttons have the same size. Bottom row (MLS, WNBA, NWSL)
is now centered with WNBA in the middle.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 10:29:14 -06:00
Trey t
2d48f1411a feat: implement Dynamic Type with Apple text styles
Replace all custom Theme.FontSize values and hardcoded font sizes with
Apple's built-in text styles (.largeTitle, .title2, .headline, .body,
.subheadline, .caption, .caption2) to support accessibility scaling.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 10:23:16 -06:00
Trey t
c9e5bd9909 chore: remove college basketball (CBB) from iOS app
Remove CBB (~5,000+ games per season) to reduce complexity.

Changes:
- Remove .cbb enum case from Sport
- Remove CBB theme color (cbbMint)
- Update documentation to reflect 7 supported leagues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 01:44:35 -06:00
Trey t
55c6d6e5e8 feat(planning): add trip filtering and fix departure date logic
- Add Trip.status property for status tracking
- Add RouteFilters trip list methods (filterBySport, filterByDateRange, filterByStatus, applyFilters)
- Add TravelEstimator max driving hours validation
- Fix ScenarioA/B departureDate to use last game day (not day after)
- Update GameDAGRouter comments for buffer logic

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-11 01:18:52 -06:00
Trey t
284a10d9e1 feat(ui): add interactive MapKit region picker
Replace abstract colored rectangles with actual North America map
using MapKit. Regions now follow state borders with tappable
overlays for West/Central/East selection.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 18:18:10 -06:00
Trey t
12a219d826 fix(trip): remove buffer days from trip planner
Buffer days added no value to trip planning. Itineraries now show
only game days and necessary travel days without extra padding.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:47:34 -06:00
Trey t
e8e47e0e2e fix(theme): remove blue hue from monochrome dark mode
Replace Tailwind CSS gray palette colors (which have blue tint) with
pure grayscale values (R=G=B) for the monochrome theme.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:44:33 -06:00
Trey t
5ed4e309bd feat(schedule): group games by sport instead of date
Games in schedule view now display in sport sections (MLB, NBA, etc.)
with games sorted by date within each section. Each game row shows its
date since the section header now shows sport instead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:36:22 -06:00
Trey t
6db0bdefcd fix(trip): redesign By Games mode with hierarchical calendar picker
Replace navigation-based team→games flow with expandable Sport→Team→Date
hierarchy. Games now grouped by date under each team with inline selection.
Also fixed game loading to always fetch 90-day browsing window.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 17:31:16 -06:00
Trey t
fd4c4b6e2a feat(09-03): exclude stadiums beyond end point in corridor filtering
Enhanced findDirectionalStadiums() to prevent including games at
stadiums that are beyond the destination city.

Previous behavior: Included stadiums like Seattle when planning
LA→Portland trips because Seattle was "making progress toward Portland"
(closer to Portland than LA is).

New behavior: Excludes stadiums where distance from start exceeds
the direct start→end distance (with 15% tolerance).

Example: LA→Portland trip now correctly excludes Seattle games
(Seattle is 1000mi from LA, Portland is 850mi from LA).

Fixes test: corridor_MultipleGamesMixed_FiltersCorrectly()

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-10 15:28:29 -06:00
Trey t
6e4a54e6dd feat(09-01): add dynamic time buffers for same-day game transitions
Implements conditional time buffer logic in canTransition():
- Same-day games (doubleheaders): 2hr post-game, 0.5hr pre-game
- Multi-day games: 3hr post-game, 1hr pre-game

Enables feasible same-day combinations (LA→SD) while preventing
infeasible distant pairings (LA→SF same day).

Makes tests pass:
- plan_SameDayGamesCloseCities_BothIncluded
- plan_ThreeSameDayGames_PicksFeasibleCombinations
2026-01-10 12:57:33 -06:00
Trey t
c6adbc6f6d fix(08-02): tune early termination for consistent 1K performance
Adjusted early termination threshold to be more aggressive for smaller
datasets (<5K games) to hit tight performance targets consistently.

- <5K games: terminate at 2x beam width (was 3x)
- ≥5K games: terminate at 3x beam width (unchanged)

This ensures 1K games test passes consistently at <2s even when run
with full test suite overhead.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-10 12:24:14 -06:00
Trey t
e195944297 feat(08-02): optimize GameDAGRouter performance for large datasets
Implemented dynamic beam width scaling and early termination to handle
5K-10K game datasets efficiently. All performance tests now pass.

Optimizations:
- Dynamic beam width: 800+ games use width 50, 2K+ use 30, 5K+ use 25
- Early termination: stop expanding when beam reaches 3x target size
- Prevents exponential blowup during day-by-day expansion

Performance results:
- 1K games: 2s (was 2s baseline) ✓
- 5K games: 1s (was 13s) - 13x faster ✓
- 10K games: 1-2s (was 34s) - 17x faster ✓

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-10 12:16:58 -06:00