+
{paths.map((p, index) => {
const hops = parsePathHops(p.path);
const rawPath = hops.length > 0 ? hops.join('->') : 'direct';
- return
{rawPath}
;
+ return (
+
+ Path {index + 1}:{' '}
+ {rawPath}
+
+ );
})}
+ {/* Straight-line distance (sender to receiver, same for all routes) */}
+ {resolvedPaths.length > 0 &&
+ isValidLocation(resolvedPaths[0].resolved.sender.lat, resolvedPaths[0].resolved.sender.lon) &&
+ isValidLocation(resolvedPaths[0].resolved.receiver.lat, resolvedPaths[0].resolved.receiver.lon) && (
+
+ Straight-line distance:
+
+ {formatDistance(
+ calculateDistance(
+ resolvedPaths[0].resolved.sender.lat,
+ resolvedPaths[0].resolved.sender.lon,
+ resolvedPaths[0].resolved.receiver.lat,
+ resolvedPaths[0].resolved.receiver.lon
+ )!
+ )}
+
+
+ )}
+
{resolvedPaths.map((pathData, index) => (
{!hasSinglePath && (
-
- Path {index + 1} — received {formatTime(pathData.received_at)}
+
+ Path {index + 1}{' '}
+ — received {formatTime(pathData.received_at)}
)}
))}
-
- {/* Straight-line distance shown once for multi-path (same for all routes) */}
- {!hasSinglePath &&
- resolvedPaths.length > 0 &&
- (() => {
- const first = resolvedPaths[0].resolved;
- if (
- isValidLocation(first.sender.lat, first.sender.lon) &&
- isValidLocation(first.receiver.lat, first.receiver.lon)
- ) {
- return (
-
- Straight-line distance:
-
- {formatDistance(
- calculateDistance(
- first.sender.lat,
- first.sender.lon,
- first.receiver.lat,
- first.receiver.lon
- )!
- )}
-
-
- );
- }
- return null;
- })()}
@@ -125,11 +121,9 @@ export function PathModal({ open, onClose, paths, senderInfo, contacts, config }
interface PathVisualizationProps {
resolved: ResolvedPath;
senderInfo: SenderInfo;
- /** If true, hide the straight-line distance (shown once at container level for multi-path) */
- hideStraightLine?: boolean;
}
-function PathVisualization({ resolved, senderInfo, hideStraightLine }: PathVisualizationProps) {
+function PathVisualization({ resolved, senderInfo }: PathVisualizationProps) {
// Track previous location for each hop to calculate distances
// Returns null if previous hop was ambiguous or has invalid location
const getPrevLocation = (hopIndex: number): { lat: number | null; lon: number | null } | null => {
@@ -205,30 +199,6 @@ function PathVisualization({ resolved, senderInfo, hideStraightLine }: PathVisua
)}
- {/* Straight-line distance (when both sender and receiver have coordinates) */}
- {!hideStraightLine &&
- isValidLocation(resolved.sender.lat, resolved.sender.lon) &&
- isValidLocation(resolved.receiver.lat, resolved.receiver.lon) && (
-
0
- ? 'pt-1'
- : 'pt-3 mt-3 border-t border-border'
- }
- >
- Straight-line distance:
-
- {formatDistance(
- calculateDistance(
- resolved.sender.lat,
- resolved.sender.lon,
- resolved.receiver.lat,
- resolved.receiver.lon
- )!
- )}
-
-