From abad327b3fb7f1fd6a5f7b8b0455eee31d57b970 Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Tue, 12 Aug 2025 17:24:55 +0300 Subject: [PATCH] draw unknown locations somewhere near ancient Atlantis Signed-off-by: Uncle Fatso --- package.json | 2 +- src/components/Map/Location.tsx | 11 ++++++----- src/components/Map/Map.tsx | 16 ++++++++++++---- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 4f5a6bf..c5fa746 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghost-telemetry-frontend", - "version": "0.1.10", + "version": "0.1.11", "author": "Uncle f4tso ", "license": "GPL-3.0", "description": "Ghost Telemetry frontend", diff --git a/src/components/Map/Location.tsx b/src/components/Map/Location.tsx index de7450b..0da63f2 100644 --- a/src/components/Map/Location.tsx +++ b/src/components/Map/Location.tsx @@ -21,6 +21,11 @@ import './Location.css'; export type LocationQuarter = 0 | 1 | 2 | 3; +export interface RandomLatLon { + lat: number; + lon: number; +} + export interface LocationOffsets { leftOffset: number; topOffset: number; @@ -50,10 +55,6 @@ export class Location extends React.Component { const { left, top, quarter } = position; const { height, propagationTime, city } = node; - if (!city) { - return null; - } - let className = `Location Location-quarter${quarter}`; if (focused) { @@ -118,7 +119,7 @@ export class Location extends React.Component { - {city} + {city ? city : "Somewhere on Earth"} diff --git a/src/components/Map/Map.tsx b/src/components/Map/Map.tsx index 6f55279..da513c6 100644 --- a/src/components/Map/Map.tsx +++ b/src/components/Map/Map.tsx @@ -4,7 +4,7 @@ import ReactGA from "react-ga4"; import { Types, Maybe } from '../../common'; import { Filter } from '../'; import { State as AppState, Node } from '../../state'; -import { Location, LocationQuarter, LocationPosition, LocationOffsets } from './'; +import { Location, LocationQuarter, LocationPosition, LocationOffsets, RandomLatLon } from './'; import { viewport } from '../../utils'; const MAP_RATIO = 800 / 350; @@ -34,6 +34,7 @@ export class WorldMap extends React.Component { left: 0, }; + public unknowns: Map = new Map(); public offsets: Map = new Map(); public usedLeftPositions: Set = new Set(); @@ -59,13 +60,20 @@ export class WorldMap extends React.Component {
{nodes.map(node => { - const { lat, lon } = node; - + let { lat, lon } = node; const focused = filter == null || filter(node); if (lat == null || lon == null) { // Skip nodes with unknown location - return null; + const unknown = this.unknowns.get(node.name); + if (unknown) { + lat = unknown.lat as Types.Latitude; + lon = unknown.lon as Types.Longitude; + } else { + lat = parseFloat((Math.random() * 22.0315 + 27.2936).toFixed(4)) as Types.Latitude; + lon = parseFloat((Math.random() * 21.2696 - 55.9863).toFixed(4)) as Types.Longitude; + this.unknowns.set(node.name, { lat, lon }); + } } const position = this.pixelPosition(node.networkId, lat, lon);