easter egg implemented, discover a hidden surprise on the map

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2025-08-20 21:04:26 +03:00
parent abad327b3f
commit 26aa5fa679
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB
2 changed files with 105 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "ghost-telemetry-frontend", "name": "ghost-telemetry-frontend",
"version": "0.1.11", "version": "0.1.12",
"author": "Uncle f4tso <f4ts0@ghostchain.io>", "author": "Uncle f4tso <f4ts0@ghostchain.io>",
"license": "GPL-3.0", "license": "GPL-3.0",
"description": "Ghost Telemetry frontend", "description": "Ghost Telemetry frontend",

View File

@ -25,6 +25,88 @@ interface MapState {
left: number; left: number;
} }
const funnyLocations = [
[-68.7700, 38.0100],
[-66.7700, 38.0100],
[-64.7700, 38.0100],
[-62.7700, 38.0100],
[-60.7700, 38.0100],
[-68.7700, 36.0100],
[-68.7700, 34.0100],
[-68.7700, 32.0100],
[-68.7700, 30.0100],
[-66.7700, 30.0100],
[-64.7700, 30.0100],
[-62.7700, 30.0100],
[-60.7700, 30.0100],
[-60.7700, 34.0100],
[-60.7700, 36.0100],
[-60.7700, 38.0100],
[-54.7700, 38.0100],
[-54.7700, 36.0100],
[-54.7700, 34.0100],
[-54.7700, 32.0100],
[-54.7700, 30.0100],
[-50.7700, 38.0100],
[-50.7700, 36.0100],
[-50.7700, 34.0100],
[-50.7700, 32.0100],
[-50.7700, 30.0100],
[-54.7700, 34.0100],
[-53.7700, 34.0100],
[-52.7700, 34.0100],
[-51.7700, 34.0100],
[-50.7700, 34.0100],
[-44.7700, 38.0100],
[-42.7700, 38.0100],
[-40.7700, 38.0100],
[-38.7700, 38.0100],
[-36.7700, 38.0100],
[-44.7700, 36.0100],
[-36.7700, 36.0100],
[-44.7700, 34.0100],
[-36.7700, 34.0100],
[-44.7700, 32.0100],
[-36.7700, 32.0100],
[-44.7700, 30.0100],
[-36.7700, 30.0100],
[-44.7700, 30.0100],
[-42.7700, 30.0100],
[-40.7700, 30.0100],
[-38.7700, 30.0100],
[-36.7700, 30.0100],
[-30.7700, 38.0100],
[-28.7700, 38.0100],
[-26.7700, 38.0100],
[-24.7700, 38.0100],
[-22.7700, 38.0100],
[-30.7700, 36.0100],
[-30.7700, 34.0100],
[-28.7700, 34.0100],
[-26.7700, 34.0100],
[-24.7700, 34.0100],
[-22.7700, 34.0100],
[-22.7700, 32.0100],
[-22.7700, 30.0100],
[-24.7700, 30.0100],
[-26.7700, 30.0100],
[-28.7700, 30.0100],
[-30.7700, 30.0100],
[-18.7700, 38.0100],
[-16.7700, 38.0100],
[-14.7700, 38.0100],
[-12.7700, 38.0100],
[-10.7700, 38.0100],
[-14.7700, 36.0100],
[-14.7700, 34.0100],
[-14.7700, 32.0100],
[-14.7700, 30.0100],
]
export class WorldMap extends React.Component<MapProps, MapState> { export class WorldMap extends React.Component<MapProps, MapState> {
public state: MapState = { public state: MapState = {
filter: null, filter: null,
@ -36,6 +118,7 @@ export class WorldMap extends React.Component<MapProps, MapState> {
public unknowns: Map<Types.NodeName, RandomLatLon> = new Map<Types.NodeName, RandomLatLon>(); public unknowns: Map<Types.NodeName, RandomLatLon> = new Map<Types.NodeName, RandomLatLon>();
public offsets: Map<Types.NetworkId, LocationOffsets> = new Map<Types.NetworkId, LocationOffsets>(); public offsets: Map<Types.NetworkId, LocationOffsets> = new Map<Types.NetworkId, LocationOffsets>();
public usedFunnyIndexes: Set<number> = new Set<number>;
public usedLeftPositions: Set<number> = new Set<number>(); public usedLeftPositions: Set<number> = new Set<number>();
public usedTopPositions: Set<number> = new Set<number>(); public usedTopPositions: Set<number> = new Set<number>();
@ -60,23 +143,36 @@ export class WorldMap extends React.Component<MapProps, MapState> {
<div className="Map-container"> <div className="Map-container">
<div className="Map"> <div className="Map">
{nodes.map(node => { {nodes.map(node => {
let isRealPoint = true;
let { lat, lon } = node; let { lat, lon } = node;
const focused = filter == null || filter(node); const focused = filter == null || filter(node);
if (lat == null || lon == null) { if (lat == null || lon == null) {
// Skip nodes with unknown location // Skip nodes with unknown location
isRealPoint = false;
const unknown = this.unknowns.get(node.name); const unknown = this.unknowns.get(node.name);
if (unknown) { if (unknown) {
lat = unknown.lat as Types.Latitude; lat = unknown.lat as Types.Latitude;
lon = unknown.lon as Types.Longitude; lon = unknown.lon as Types.Longitude;
} else { } else {
lat = parseFloat((Math.random() * 22.0315 + 27.2936).toFixed(4)) as Types.Latitude; if (this.usedFunnyIndexes.size >= funnyLocations.length) {
lon = parseFloat((Math.random() * 21.2696 - 55.9863).toFixed(4)) as Types.Longitude; lat = parseFloat((Math.random() * 31.4630 - 37.4840).toFixed(4)) as Types.Latitude;
lon = parseFloat((Math.random() * 49.2187 - 40.3147).toFixed(4)) as Types.Longitude;
} else {
let index = 0;
while (this.usedFunnyIndexes.has(index)) {
index = Math.floor(Math.random() * funnyLocations.length)
}
const point = funnyLocations[index];
lat = point.at(1) as Types.Latitude;
lon = point.at(0) as Types.Longitude;
this.usedFunnyIndexes.add(index);
}
this.unknowns.set(node.name, { lat, lon }); this.unknowns.set(node.name, { lat, lon });
} }
} }
const position = this.pixelPosition(node.networkId, lat, lon); const position = this.pixelPosition(node.networkId, lat, lon, isRealPoint);
return ( return (
<Location <Location
@ -97,6 +193,7 @@ export class WorldMap extends React.Component<MapProps, MapState> {
id: Maybe<Types.NetworkId>, id: Maybe<Types.NetworkId>,
lat: Types.Latitude, lat: Types.Latitude,
lon: Types.Longitude, lon: Types.Longitude,
isRealPoint: boolean,
): LocationPosition { ): LocationPosition {
const { state, offsets, usedLeftPositions, usedTopPositions } = this; const { state, offsets, usedLeftPositions, usedTopPositions } = this;
@ -130,8 +227,10 @@ export class WorldMap extends React.Component<MapProps, MapState> {
leftOffset = Math.floor(Math.random() * 12) - 6; leftOffset = Math.floor(Math.random() * 12) - 6;
} }
left += leftOffset; if (isRealPoint) {
top += topOffset; left += leftOffset;
top += topOffset;
}
offsets.set(id, { leftOffset, topOffset }); offsets.set(id, { leftOffset, topOffset });
usedLeftPositions.add(left); usedLeftPositions.add(left);