Skip to content

Commit

Permalink
Choose a recent location as an origin or destination
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbrethorst committed Jul 31, 2024
1 parent 007e48f commit 7c8c43b
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public struct OriginDestinationSheetView: View {
.clipShape(RoundedRectangle(cornerRadius: 12))
}

// swiftlint:disable function_body_length
private func favoritesSection() -> some View {
Section(content: {
ScrollView(.horizontal) {
Expand Down Expand Up @@ -91,7 +90,6 @@ public struct OriginDestinationSheetView: View {
})
}

// swiftlint:enable function_body_length
private func recentsSection() -> some View {
guard sheetEnvironment.recentLocations.count > 0 else {
return AnyView(EmptyView())
Expand All @@ -100,10 +98,17 @@ public struct OriginDestinationSheetView: View {
return AnyView(
Section(content: {
ForEach(Array(sheetEnvironment.recentLocations.prefix(5)), content: { location in
VStack(alignment: .leading) {
Text(location.title)
.font(.headline)
Text(location.subTitle)
Button {
locationManagerService.appendMarker(location: location)
locationManagerService.addOriginDestinationData()
dismiss()
} label: {
VStack(alignment: .leading) {
Text(location.title)
.font(.headline)
Text(location.subTitle)
}
.foregroundColor(.primary)
}
})
}, header: {
Expand Down

0 comments on commit 7c8c43b

Please sign in to comment.