diff --git a/MC1/Views/Chats/Components/MessagePathMapView.swift b/MC1/Views/Chats/Components/MessagePathMapView.swift index f857b896..e5bb8ce1 100644 --- a/MC1/Views/Chats/Components/MessagePathMapView.swift +++ b/MC1/Views/Chats/Components/MessagePathMapView.swift @@ -86,11 +86,6 @@ struct MessagePathMapView: View { ) .ignoresSafeArea() - PathDistanceBanner( - hopCount: hopCount, - totalPathDistance: totalPathDistance - ) - VStack { Spacer() HStack { @@ -116,9 +111,15 @@ struct MessagePathMapView: View { } } } - .navigationTitle(L10n.Chats.Chats.Path.map) - .navigationBarTitleDisplayMode(.inline) .toolbar { + if !locatedNodes.isEmpty { + ToolbarItem(placement: .principal) { + PathDistanceBanner( + hopCount: hopCount, + totalPathDistance: totalPathDistance + ) + } + } ToolbarItem(placement: .confirmationAction) { Button(L10n.Localizable.Common.done) { dismiss() } } diff --git a/MC1/Views/Map/PathDistanceBanner.swift b/MC1/Views/Map/PathDistanceBanner.swift index 604df2b2..cab37494 100644 --- a/MC1/Views/Map/PathDistanceBanner.swift +++ b/MC1/Views/Map/PathDistanceBanner.swift @@ -1,34 +1,27 @@ import MapKit import SwiftUI -/// Floating top-of-map capsule summarizing a path: hop count and, when at least -/// two nodes have coordinates, the drawn-path distance. +/// Path summary shown in place of the map sheet's navigation title: hop count +/// and, when at least two nodes have coordinates, the drawn-path distance. struct PathDistanceBanner: View { private static let horizontalPadding: CGFloat = 16 - private static let verticalPadding: CGFloat = 10 + private static let verticalPadding: CGFloat = 8 let hopCount: Int let totalPathDistance: CLLocationDistance? var body: some View { - VStack { - HStack { - Text(L10n.Contacts.Contacts.Trace.Map.hops(hopCount)) - if let distance = totalPathDistance { - Text("•") - Text(Measurement(value: distance, unit: UnitLength.meters), - format: .measurement(width: .abbreviated, usage: .road)) - } + HStack(spacing: 4) { + Text(L10n.Contacts.Contacts.Trace.Map.hops(hopCount)) + if let distance = totalPathDistance { + Text("•") + Text(Measurement(value: distance, unit: UnitLength.meters), + format: .measurement(width: .abbreviated, usage: .road)) } - .font(.subheadline.weight(.medium)) - .padding(.horizontal, Self.horizontalPadding) - .padding(.vertical, Self.verticalPadding) - .liquidGlass(in: .capsule) - - Spacer() } - .frame(maxWidth: .infinity) - .safeAreaPadding(.top) - .transition(.move(edge: .top).combined(with: .opacity)) + .font(.subheadline.weight(.medium)) + .padding(.horizontal, Self.horizontalPadding) + .padding(.vertical, Self.verticalPadding) + .liquidGlass(in: .capsule) } }