feat(home): restore planning tips and add map buttons to itinerary rows
- Create shared TipsSection component for displaying planning tips - Add TipsSection to all 22 home content variants - Fix displayedTips population with onAppear in HomeView - Add map buttons to GameRowCompact (opens stadium in Apple Maps) - Add map buttons to TravelRowView (opens driving directions) - Add map buttons to CustomItemRowView (opens location when GPS available) - Add AppleMapsLauncher.openLocation() and openDirections() methods Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -85,6 +85,42 @@ struct AppleMapsLauncher {
|
||||
open(chunks[index])
|
||||
}
|
||||
|
||||
/// Opens a single location in Apple Maps
|
||||
/// - Parameters:
|
||||
/// - coordinate: Location to display
|
||||
/// - name: Display name for the pin
|
||||
static func openLocation(coordinate: CLLocationCoordinate2D, name: String) {
|
||||
let placemark = MKPlacemark(coordinate: coordinate)
|
||||
let mapItem = MKMapItem(placemark: placemark)
|
||||
mapItem.name = name
|
||||
mapItem.openInMaps(launchOptions: nil)
|
||||
}
|
||||
|
||||
/// Opens driving directions between two points in Apple Maps
|
||||
/// - Parameters:
|
||||
/// - from: Starting location
|
||||
/// - fromName: Display name for origin
|
||||
/// - to: Destination location
|
||||
/// - toName: Display name for destination
|
||||
static func openDirections(
|
||||
from: CLLocationCoordinate2D,
|
||||
fromName: String,
|
||||
to: CLLocationCoordinate2D,
|
||||
toName: String
|
||||
) {
|
||||
let fromPlacemark = MKPlacemark(coordinate: from)
|
||||
let fromItem = MKMapItem(placemark: fromPlacemark)
|
||||
fromItem.name = fromName
|
||||
|
||||
let toPlacemark = MKPlacemark(coordinate: to)
|
||||
let toItem = MKMapItem(placemark: toPlacemark)
|
||||
toItem.name = toName
|
||||
|
||||
MKMapItem.openMaps(with: [fromItem, toItem], launchOptions: [
|
||||
MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving
|
||||
])
|
||||
}
|
||||
|
||||
// MARK: - Private Helpers
|
||||
|
||||
private static func collectWaypoints(
|
||||
|
||||
Reference in New Issue
Block a user