mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-05 09:22:04 +02:00
Ditch garbage data ingest for lat/lon and extend map. Closes #63
This commit is contained in:
@@ -225,7 +225,7 @@ export function RepeaterDashboard({
|
||||
) : (
|
||||
<div className="space-y-4">
|
||||
{/* Top row: Telemetry + Radio Settings | Node Info + Neighbors */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div className="grid grid-cols-1 gap-4 md:grid-cols-2 md:items-stretch">
|
||||
<div className="flex flex-col gap-4">
|
||||
<NodeInfoPane
|
||||
data={paneData.nodeInfo}
|
||||
@@ -255,7 +255,7 @@ export function RepeaterDashboard({
|
||||
disabled={anyLoading}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col gap-4">
|
||||
<div className="flex min-h-0 flex-col gap-4">
|
||||
<NeighborsPane
|
||||
data={paneData.neighbors}
|
||||
state={paneStates.neighbors}
|
||||
|
||||
@@ -99,16 +99,16 @@ export function NeighborsPane({
|
||||
state={state}
|
||||
onRefresh={onRefresh}
|
||||
disabled={disabled}
|
||||
className="flex flex-col"
|
||||
contentClassName="flex-1 flex flex-col"
|
||||
className="flex min-h-0 flex-1 flex-col"
|
||||
contentClassName="flex min-h-0 flex-1 flex-col"
|
||||
>
|
||||
{!data ? (
|
||||
<NotFetched />
|
||||
) : sorted.length === 0 ? (
|
||||
<p className="text-sm text-muted-foreground">No neighbors reported</p>
|
||||
) : (
|
||||
<div className="flex-1 flex flex-col gap-2">
|
||||
<div className="overflow-x-auto">
|
||||
<div className="flex min-h-0 flex-1 flex-col gap-2">
|
||||
<div className="shrink-0 overflow-x-auto">
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="text-left text-muted-foreground text-xs">
|
||||
@@ -145,7 +145,7 @@ export function NeighborsPane({
|
||||
{hasValidRepeaterGps && (neighborsWithCoords.length > 0 || hasValidRepeaterGps) ? (
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="h-48 flex items-center justify-center text-xs text-muted-foreground">
|
||||
<div className="flex min-h-48 flex-1 items-center justify-center text-xs text-muted-foreground">
|
||||
Loading map...
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
formatRouteLabel,
|
||||
formatRoutingOverrideInput,
|
||||
getEffectiveContactRoute,
|
||||
isValidLocation,
|
||||
resolvePath,
|
||||
formatDistance,
|
||||
formatHopCounts,
|
||||
@@ -665,6 +666,24 @@ describe('resolvePath', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isValidLocation', () => {
|
||||
it('rejects null and unset coordinates', () => {
|
||||
expect(isValidLocation(null, -122.3)).toBe(false);
|
||||
expect(isValidLocation(47.6, null)).toBe(false);
|
||||
expect(isValidLocation(0, 0)).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects out-of-range coordinates', () => {
|
||||
expect(isValidLocation(-593.497573, -1659.939204)).toBe(false);
|
||||
expect(isValidLocation(91, 0)).toBe(false);
|
||||
expect(isValidLocation(0, 181)).toBe(false);
|
||||
});
|
||||
|
||||
it('accepts sane coordinates', () => {
|
||||
expect(isValidLocation(47.6062, -122.3321)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatDistance', () => {
|
||||
it('formats distances under 1km in meters', () => {
|
||||
expect(formatDistance(0.5)).toBe('500m');
|
||||
|
||||
@@ -273,6 +273,9 @@ export function isValidLocation(lat: number | null, lon: number | null): boolean
|
||||
if (lat === null || lon === null) {
|
||||
return false;
|
||||
}
|
||||
if (lat < -90 || lat > 90 || lon < -180 || lon > 180) {
|
||||
return false;
|
||||
}
|
||||
// (0, 0) is in the Atlantic Ocean - treat as unset
|
||||
if (lat === 0 && lon === 0) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user