fix: resolve 4 UI/planning bugs from issue tracker
- Lock all maps to North America (no pan/zoom) in ProgressMapView and TripDetailView - Sort saved trips by most cities (stops count) - Filter cross-country trips to top 2 by stops on home screen - Use LocationSearchSheet for Follow Team home location (consistent with must-stop) - Initialize DateRangePicker to show selected dates on appear Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,7 @@ struct TripCreationView: View {
|
||||
enum CityInputType {
|
||||
case mustStop
|
||||
case preferred
|
||||
case homeLocation
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
@@ -121,6 +122,9 @@ struct TripCreationView: View {
|
||||
viewModel.addMustStopLocation(location)
|
||||
case .preferred:
|
||||
viewModel.addPreferredCity(location.name)
|
||||
case .homeLocation:
|
||||
viewModel.startLocationText = location.name
|
||||
viewModel.startLocation = location
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -595,38 +599,50 @@ struct TripCreationView: View {
|
||||
)
|
||||
|
||||
if viewModel.useHomeLocation {
|
||||
// Show home location input with suggestions
|
||||
VStack(alignment: .leading, spacing: 0) {
|
||||
ThemedTextField(
|
||||
label: "Home Location",
|
||||
placeholder: "Enter your city",
|
||||
text: $viewModel.startLocationText,
|
||||
icon: "house.fill"
|
||||
)
|
||||
.onChange(of: viewModel.startLocationText) { _, newValue in
|
||||
searchLocation(query: newValue, isStart: true)
|
||||
}
|
||||
// Show button to open location search sheet (same as must-stop)
|
||||
Button {
|
||||
cityInputType = .homeLocation
|
||||
showCityInput = true
|
||||
} label: {
|
||||
HStack(spacing: Theme.Spacing.md) {
|
||||
ZStack {
|
||||
Circle()
|
||||
.fill(Theme.warmOrange.opacity(0.15))
|
||||
.frame(width: 40, height: 40)
|
||||
Image(systemName: "house.fill")
|
||||
.foregroundStyle(Theme.warmOrange)
|
||||
}
|
||||
|
||||
// Suggestions for home location
|
||||
if !startLocationSuggestions.isEmpty {
|
||||
locationSuggestionsList(
|
||||
suggestions: startLocationSuggestions,
|
||||
isLoading: isSearchingStart
|
||||
) { result in
|
||||
viewModel.startLocationText = result.name
|
||||
viewModel.startLocation = result.toLocationInput()
|
||||
startLocationSuggestions = []
|
||||
VStack(alignment: .leading, spacing: 2) {
|
||||
if let location = viewModel.startLocation {
|
||||
Text(location.name)
|
||||
.font(.body)
|
||||
.foregroundStyle(Theme.textPrimary(colorScheme))
|
||||
if let address = location.address, !address.isEmpty {
|
||||
Text(address)
|
||||
.font(.caption)
|
||||
.foregroundStyle(Theme.textSecondary(colorScheme))
|
||||
}
|
||||
} else {
|
||||
Text("Choose home location")
|
||||
.font(.body)
|
||||
.foregroundStyle(Theme.textPrimary(colorScheme))
|
||||
Text("Tap to search cities")
|
||||
.font(.caption)
|
||||
.foregroundStyle(Theme.textMuted(colorScheme))
|
||||
}
|
||||
}
|
||||
} else if isSearchingStart {
|
||||
HStack {
|
||||
ThemedSpinnerCompact(size: 14)
|
||||
Text("Searching...")
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(Theme.textMuted(colorScheme))
|
||||
}
|
||||
.padding(.top, Theme.Spacing.xs)
|
||||
|
||||
Spacer()
|
||||
|
||||
Image(systemName: "chevron.right")
|
||||
.foregroundStyle(Theme.textMuted(colorScheme))
|
||||
}
|
||||
.padding(Theme.Spacing.md)
|
||||
.background(Theme.cardBackgroundElevated(colorScheme))
|
||||
.clipShape(RoundedRectangle(cornerRadius: Theme.CornerRadius.medium))
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
} else {
|
||||
Text("Trip will start at first game and end at last game (fly-in/fly-out)")
|
||||
.font(.caption)
|
||||
@@ -2099,6 +2115,14 @@ struct DateRangePicker: View {
|
||||
// Trip duration
|
||||
tripDurationBadge
|
||||
}
|
||||
.onAppear {
|
||||
// Initialize displayed month to show the start date's month
|
||||
displayedMonth = calendar.startOfDay(for: startDate)
|
||||
// If dates are already selected (endDate > startDate), show complete state
|
||||
if endDate > startDate {
|
||||
selectionState = .complete
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var selectedRangeSummary: some View {
|
||||
|
||||
@@ -157,7 +157,7 @@ struct TripDetailView: View {
|
||||
|
||||
private var heroMapSection: some View {
|
||||
ZStack(alignment: .bottom) {
|
||||
Map(position: $mapCameraPosition) {
|
||||
Map(position: $mapCameraPosition, interactionModes: []) {
|
||||
ForEach(stopCoordinates.indices, id: \.self) { index in
|
||||
let stop = stopCoordinates[index]
|
||||
Annotation(stop.name, coordinate: stop.coordinate) {
|
||||
|
||||
Reference in New Issue
Block a user