- 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>
117 lines
3.5 KiB
Swift
117 lines
3.5 KiB
Swift
//
|
|
// PlanningModeStep.swift
|
|
// SportsTime
|
|
//
|
|
// Step 1 of the trip wizard - select planning mode.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct PlanningModeStep: View {
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
@Binding var selection: PlanningMode?
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: Theme.Spacing.md) {
|
|
StepHeader(
|
|
title: "How do you want to plan?",
|
|
subtitle: "Choose your starting point"
|
|
)
|
|
|
|
VStack(spacing: Theme.Spacing.sm) {
|
|
ForEach(PlanningMode.allCases) { mode in
|
|
WizardModeCard(
|
|
mode: mode,
|
|
isSelected: selection == mode,
|
|
onTap: { selection = mode }
|
|
)
|
|
}
|
|
}
|
|
}
|
|
.padding(Theme.Spacing.lg)
|
|
.background(Theme.cardBackground(colorScheme))
|
|
.clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.large))
|
|
.overlay {
|
|
RoundedRectangle(cornerRadius: Theme.CornerRadius.large)
|
|
.stroke(Theme.surfaceGlow(colorScheme), lineWidth: 1)
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - Wizard Mode Card
|
|
|
|
private struct WizardModeCard: View {
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
let mode: PlanningMode
|
|
let isSelected: Bool
|
|
let onTap: () -> Void
|
|
|
|
var body: some View {
|
|
Button(action: onTap) {
|
|
HStack(spacing: Theme.Spacing.md) {
|
|
Image(systemName: mode.iconName)
|
|
.font(.title2)
|
|
.foregroundStyle(isSelected ? Theme.warmOrange : Theme.textSecondary(colorScheme))
|
|
.frame(width: 32)
|
|
|
|
VStack(alignment: .leading, spacing: 2) {
|
|
Text(mode.displayName)
|
|
.font(.headline)
|
|
.foregroundStyle(Theme.textPrimary(colorScheme))
|
|
|
|
Text(mode.description)
|
|
.font(.caption)
|
|
.foregroundStyle(Theme.textMuted(colorScheme))
|
|
}
|
|
|
|
Spacer()
|
|
|
|
if isSelected {
|
|
Image(systemName: "checkmark.circle.fill")
|
|
.foregroundStyle(Theme.warmOrange)
|
|
}
|
|
}
|
|
.padding(Theme.Spacing.md)
|
|
.background(isSelected ? Theme.warmOrange.opacity(0.1) : Color.clear)
|
|
.clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.medium))
|
|
.contentShape(Rectangle())
|
|
.overlay(
|
|
RoundedRectangle(cornerRadius: Theme.CornerRadius.medium)
|
|
.stroke(isSelected ? Theme.warmOrange : Theme.textMuted(colorScheme).opacity(0.3), lineWidth: isSelected ? 2 : 1)
|
|
)
|
|
}
|
|
.buttonStyle(.plain)
|
|
}
|
|
}
|
|
|
|
// MARK: - Step Header (Reusable)
|
|
|
|
struct StepHeader: View {
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
let title: String
|
|
var subtitle: String? = nil
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 4) {
|
|
Text(title)
|
|
.font(.title3)
|
|
.fontWeight(.semibold)
|
|
.foregroundStyle(Theme.textPrimary(colorScheme))
|
|
|
|
if let subtitle {
|
|
Text(subtitle)
|
|
.font(.subheadline)
|
|
.foregroundStyle(Theme.textSecondary(colorScheme))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - Preview
|
|
|
|
#Preview {
|
|
PlanningModeStep(selection: .constant(.dateRange))
|
|
.padding()
|
|
.themedBackground()
|
|
}
|