feat(wizard): add all wizard step components
- DatesStep: date range selection with duration indicator - RegionsStep: geographic region selection - RoutePreferenceStep: direct/scenic/balanced preference - RepeatCitiesStep: unique vs repeat city visits - MustStopsStep: optional must-stop locations - ReviewStep: summary and plan button Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
120
SportsTime/Features/Trip/Views/Wizard/Steps/ReviewStep.swift
Normal file
120
SportsTime/Features/Trip/Views/Wizard/Steps/ReviewStep.swift
Normal file
@@ -0,0 +1,120 @@
|
||||
//
|
||||
// ReviewStep.swift
|
||||
// SportsTime
|
||||
//
|
||||
// Step 8 of the trip wizard - review and submit.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ReviewStep: View {
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
let planningMode: PlanningMode
|
||||
let selectedSports: Set<Sport>
|
||||
let startDate: Date
|
||||
let endDate: Date
|
||||
let selectedRegions: Set<Region>
|
||||
let routePreference: RoutePreference
|
||||
let allowRepeatCities: Bool
|
||||
let mustStopLocations: [LocationInput]
|
||||
let isPlanning: Bool
|
||||
let onPlan: () -> Void
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: Theme.Spacing.md) {
|
||||
StepHeader(
|
||||
title: "Ready to plan your trip!",
|
||||
subtitle: "Review your selections"
|
||||
)
|
||||
|
||||
VStack(alignment: .leading, spacing: Theme.Spacing.sm) {
|
||||
ReviewRow(label: "Mode", value: planningMode.displayName)
|
||||
ReviewRow(label: "Sports", value: selectedSports.map(\.rawValue).sorted().joined(separator: ", "))
|
||||
ReviewRow(label: "Dates", value: dateRangeText)
|
||||
ReviewRow(label: "Regions", value: selectedRegions.map(\.shortName).sorted().joined(separator: ", "))
|
||||
ReviewRow(label: "Route", value: routePreference.displayName)
|
||||
ReviewRow(label: "Repeat cities", value: allowRepeatCities ? "Yes" : "No")
|
||||
|
||||
if !mustStopLocations.isEmpty {
|
||||
ReviewRow(label: "Must-stops", value: mustStopLocations.map(\.name).joined(separator: ", "))
|
||||
}
|
||||
}
|
||||
.padding(Theme.Spacing.sm)
|
||||
.background(Theme.cardBackgroundElevated(colorScheme))
|
||||
.clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.medium))
|
||||
|
||||
Button(action: onPlan) {
|
||||
HStack {
|
||||
if isPlanning {
|
||||
ProgressView()
|
||||
.scaleEffect(0.8)
|
||||
.tint(.white)
|
||||
}
|
||||
Text(isPlanning ? "Planning..." : "Plan My Trip")
|
||||
.fontWeight(.semibold)
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(Theme.Spacing.md)
|
||||
.background(Theme.warmOrange)
|
||||
.foregroundStyle(.white)
|
||||
.clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.large))
|
||||
}
|
||||
.disabled(isPlanning)
|
||||
}
|
||||
.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)
|
||||
}
|
||||
}
|
||||
|
||||
private var dateRangeText: String {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = .medium
|
||||
return "\(formatter.string(from: startDate)) - \(formatter.string(from: endDate))"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Review Row
|
||||
|
||||
private struct ReviewRow: View {
|
||||
@Environment(\.colorScheme) private var colorScheme
|
||||
let label: String
|
||||
let value: String
|
||||
|
||||
var body: some View {
|
||||
HStack(alignment: .top) {
|
||||
Text(label)
|
||||
.font(.caption)
|
||||
.foregroundStyle(Theme.textMuted(colorScheme))
|
||||
.frame(width: 80, alignment: .leading)
|
||||
|
||||
Text(value)
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(Theme.textPrimary(colorScheme))
|
||||
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Preview
|
||||
|
||||
#Preview {
|
||||
ReviewStep(
|
||||
planningMode: .dateRange,
|
||||
selectedSports: [.mlb, .nba],
|
||||
startDate: Date(),
|
||||
endDate: Date().addingTimeInterval(86400 * 7),
|
||||
selectedRegions: [.east, .central],
|
||||
routePreference: .balanced,
|
||||
allowRepeatCities: false,
|
||||
mustStopLocations: [],
|
||||
isPlanning: false,
|
||||
onPlan: {}
|
||||
)
|
||||
.padding()
|
||||
.themedBackground()
|
||||
}
|
||||
Reference in New Issue
Block a user