WIP: map route updates and custom item drag/drop fixes (broken)

- Fixed map header not updating in ItineraryTableViewWrapper using Coordinator pattern
- Added routeVersion UUID to force Map re-render when routes change
- Fixed determineAnchor to scan backwards for correct anchor context
- Added location support to CustomItineraryItem (lat/lng/address)
- Added MapKit place search to AddItemSheet
- Added extensive debug logging for route waypoint calculation

Known issues:
- Custom items still not routing correctly after drag/drop
- Anchor type determination may still have bugs

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-01-17 00:00:57 -06:00
parent 43501b6ac1
commit 8df33a5614
7 changed files with 605 additions and 57 deletions

View File

@@ -4,6 +4,7 @@
//
import Foundation
import CoreLocation
struct CustomItineraryItem: Identifiable, Codable, Hashable {
let id: UUID
@@ -17,6 +18,22 @@ struct CustomItineraryItem: Identifiable, Codable, Hashable {
let createdAt: Date
var modifiedAt: Date
// Optional location for mappable items (from MapKit search)
var latitude: Double?
var longitude: Double?
var address: String?
/// Whether this item has a location and can be shown on the map
var isMappable: Bool {
latitude != nil && longitude != nil
}
/// Get coordinate if mappable
var coordinate: CLLocationCoordinate2D? {
guard let lat = latitude, let lon = longitude else { return nil }
return CLLocationCoordinate2D(latitude: lat, longitude: lon)
}
init(
id: UUID = UUID(),
tripId: UUID,
@@ -27,7 +44,10 @@ struct CustomItineraryItem: Identifiable, Codable, Hashable {
anchorDay: Int,
sortOrder: Int = 0,
createdAt: Date = Date(),
modifiedAt: Date = Date()
modifiedAt: Date = Date(),
latitude: Double? = nil,
longitude: Double? = nil,
address: String? = nil
) {
self.id = id
self.tripId = tripId
@@ -39,6 +59,9 @@ struct CustomItineraryItem: Identifiable, Codable, Hashable {
self.sortOrder = sortOrder
self.createdAt = createdAt
self.modifiedAt = modifiedAt
self.latitude = latitude
self.longitude = longitude
self.address = address
}
enum ItemCategory: String, Codable, CaseIterable {