mirror of
https://github.com/BigBodyCobain/Shadowbroker.git
synced 2026-09-18 07:02:20 +02:00
Tracked-flight and tracked-yacht HTML labels are rendered from the raw store arrays, while their icons come from the worker GeoJSON that already has the operator's data filters applied. Filtering Tracked Aircraft to a category therefore removed the icons but left every other aircraft's name on the map. Derive the label subjects from the ids in the filtered feature collection so a label is only drawn where an icon is. The id rule lives in one shared helper used by both the worker builders and the label selector; rows with no identifier keep the worker's positional fallback and draw no label. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
19 lines
655 B
TypeScript
19 lines
655 B
TypeScript
import type { Ship } from '@/types/dashboard';
|
|
|
|
/**
|
|
* Feature ids shared by the worker that builds map icons and the main-thread
|
|
* code that picks label subjects, so both sides agree on which record a
|
|
* feature represents. Records with no identifier get the worker's positional
|
|
* fallback, which cannot be matched from outside and so draw no label.
|
|
*/
|
|
export function trackedFlightFeatureId(
|
|
f: { icao24?: string; callsign?: string },
|
|
fallback = '',
|
|
): string {
|
|
return f.icao24 || f.callsign || fallback;
|
|
}
|
|
|
|
export function shipFeatureId(s: Pick<Ship, 'mmsi' | 'name'>, fallback = ''): string {
|
|
return String(s.mmsi || s.name || fallback);
|
|
}
|