- Add VoiceOver labels, hints, and element grouping across all 60+ views - Add Reduce Motion support (Theme.Animation.prefersReducedMotion) to all animations - Replace fixed font sizes with semantic Dynamic Type styles - Hide decorative elements from VoiceOver with .accessibilityHidden(true) - Add .minimumHitTarget() modifier ensuring 44pt touch targets - Add AccessibilityAnnouncer utility for VoiceOver announcements - Improve color contrast values in Theme.swift for WCAG AA compliance - Extract CloudKitContainerConfig for explicit container identity - Remove PostHog debug console log from AnalyticsManager Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
109 lines
3.6 KiB
Swift
109 lines
3.6 KiB
Swift
//
|
|
// RepeatCitiesStep.swift
|
|
// SportsTime
|
|
//
|
|
// Step 6 of the trip wizard - allow repeat city visits.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct RepeatCitiesStep: View {
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
@Binding var allowRepeatCities: Bool
|
|
@Binding var hasSetRepeatCities: Bool
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: Theme.Spacing.md) {
|
|
StepHeader(
|
|
title: "Visit cities more than once?",
|
|
subtitle: "Some trips work better with return visits"
|
|
)
|
|
|
|
HStack(spacing: Theme.Spacing.md) {
|
|
OptionButton(
|
|
title: "No, unique cities only",
|
|
icon: "arrow.right",
|
|
isSelected: hasSetRepeatCities && !allowRepeatCities,
|
|
onTap: {
|
|
allowRepeatCities = false
|
|
hasSetRepeatCities = true
|
|
}
|
|
)
|
|
|
|
OptionButton(
|
|
title: "Yes, allow repeats",
|
|
icon: "arrow.triangle.2.circlepath",
|
|
isSelected: hasSetRepeatCities && allowRepeatCities,
|
|
onTap: {
|
|
allowRepeatCities = true
|
|
hasSetRepeatCities = true
|
|
}
|
|
)
|
|
}
|
|
}
|
|
.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)
|
|
}
|
|
.onAppear {
|
|
// Auto-select the default if not already set (enables button with defaults)
|
|
if !hasSetRepeatCities {
|
|
hasSetRepeatCities = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - Option Button
|
|
|
|
private struct OptionButton: View {
|
|
@Environment(\.colorScheme) private var colorScheme
|
|
let title: String
|
|
let icon: String
|
|
let isSelected: Bool
|
|
let onTap: () -> Void
|
|
|
|
var body: some View {
|
|
Button(action: onTap) {
|
|
VStack(spacing: Theme.Spacing.sm) {
|
|
Image(systemName: icon)
|
|
.font(.title2)
|
|
.foregroundStyle(isSelected ? Theme.warmOrange : Theme.textSecondary(colorScheme))
|
|
.accessibilityHidden(true)
|
|
|
|
Text(title)
|
|
.font(.caption)
|
|
.fontWeight(.medium)
|
|
.foregroundStyle(isSelected ? Theme.warmOrange : Theme.textPrimary(colorScheme))
|
|
.multilineTextAlignment(.center)
|
|
}
|
|
.frame(maxWidth: .infinity)
|
|
.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)
|
|
.accessibilityValue(isSelected ? "Selected" : "Not selected")
|
|
.accessibilityAddTraits(isSelected ? .isSelected : [])
|
|
}
|
|
}
|
|
|
|
// MARK: - Preview
|
|
|
|
#Preview {
|
|
RepeatCitiesStep(
|
|
allowRepeatCities: .constant(false),
|
|
hasSetRepeatCities: .constant(true)
|
|
)
|
|
.padding()
|
|
.themedBackground()
|
|
}
|