- 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>
44 lines
1.2 KiB
Swift
44 lines
1.2 KiB
Swift
//
|
|
// TipsSection.swift
|
|
// SportsTime
|
|
//
|
|
// Shared component for displaying planning tips across all home content variants.
|
|
// Uses Theme colors to adapt to light/dark mode and various design styles.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct TipsSection: View {
|
|
let tips: [PlanningTip]
|
|
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
|
|
var body: some View {
|
|
if !tips.isEmpty {
|
|
VStack(alignment: .leading, spacing: Theme.Spacing.sm) {
|
|
Text("Planning Tips")
|
|
.font(.headline)
|
|
.foregroundStyle(Theme.textPrimary(colorScheme))
|
|
|
|
VStack(spacing: Theme.Spacing.xs) {
|
|
ForEach(tips) { tip in
|
|
TipRow(icon: tip.icon, title: tip.title, subtitle: tip.subtitle)
|
|
}
|
|
}
|
|
.padding(Theme.Spacing.md)
|
|
.background(Theme.cardBackground(colorScheme))
|
|
.clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.medium))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#Preview {
|
|
let tips = PlanningTips.random(3)
|
|
VStack {
|
|
TipsSection(tips: tips)
|
|
.padding()
|
|
}
|
|
.background(Color.gray.opacity(0.1))
|
|
}
|