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:
@@ -1154,12 +1154,29 @@ struct GameRowCompact: View {
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
|
||||
// Game time (prominently displayed)
|
||||
Text(formattedTime)
|
||||
.font(.title3)
|
||||
.fontWeight(.medium)
|
||||
.foregroundStyle(Theme.warmOrange)
|
||||
|
||||
// Map button to open stadium location
|
||||
Button {
|
||||
AppleMapsLauncher.openLocation(
|
||||
coordinate: richGame.stadium.coordinate,
|
||||
name: richGame.stadium.name
|
||||
)
|
||||
} label: {
|
||||
Image(systemName: "map")
|
||||
.font(.body)
|
||||
.foregroundStyle(Theme.warmOrange)
|
||||
.padding(8)
|
||||
.background(Theme.warmOrange.opacity(0.15))
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityLabel("Open \(richGame.stadium.name) in Maps")
|
||||
}
|
||||
.padding(Theme.Spacing.md)
|
||||
.background(Theme.cardBackgroundElevated(colorScheme))
|
||||
@@ -1217,8 +1234,30 @@ struct TravelRowView: View {
|
||||
.fontWeight(.medium)
|
||||
.foregroundStyle(Theme.textPrimary(colorScheme))
|
||||
}
|
||||
|
||||
|
||||
Spacer()
|
||||
|
||||
// Map button to open driving directions
|
||||
if let fromCoord = segment.fromLocation.coordinate,
|
||||
let toCoord = segment.toLocation.coordinate {
|
||||
Button {
|
||||
AppleMapsLauncher.openDirections(
|
||||
from: fromCoord,
|
||||
fromName: segment.fromLocation.name,
|
||||
to: toCoord,
|
||||
toName: segment.toLocation.name
|
||||
)
|
||||
} label: {
|
||||
Image(systemName: "map")
|
||||
.font(.body)
|
||||
.foregroundStyle(Theme.warmOrange)
|
||||
.padding(8)
|
||||
.background(Theme.warmOrange.opacity(0.15))
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityLabel("Get directions from \(segment.fromLocation.name) to \(segment.toLocation.name)")
|
||||
}
|
||||
}
|
||||
.padding(Theme.Spacing.md)
|
||||
.background(Theme.cardBackground(colorScheme))
|
||||
@@ -1281,7 +1320,26 @@ struct CustomItemRowView: View {
|
||||
}
|
||||
|
||||
Spacer()
|
||||
|
||||
|
||||
// Map button for items with GPS coordinates
|
||||
if let info = customInfo, let coordinate = info.coordinate {
|
||||
Button {
|
||||
AppleMapsLauncher.openLocation(
|
||||
coordinate: coordinate,
|
||||
name: info.title
|
||||
)
|
||||
} label: {
|
||||
Image(systemName: "map")
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(Theme.warmOrange)
|
||||
.padding(6)
|
||||
.background(Theme.warmOrange.opacity(0.15))
|
||||
.clipShape(Circle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.accessibilityLabel("Open \(info.title) in Maps")
|
||||
}
|
||||
|
||||
// Chevron indicates this is tappable
|
||||
Image(systemName: "chevron.right")
|
||||
.foregroundStyle(.tertiary)
|
||||
|
||||
Reference in New Issue
Block a user