diff --git a/src/plugins/orbit-references/orbit-references.ts b/src/plugins/orbit-references/orbit-references.ts index 907b4a555..7621eb5bf 100644 --- a/src/plugins/orbit-references/orbit-references.ts +++ b/src/plugins/orbit-references/orbit-references.ts @@ -1,6 +1,6 @@ import { KeepTrackApiEvents } from '@app/interfaces'; import { keepTrackApi } from '@app/keepTrackApi'; -import { getEl } from '@app/lib/get-el'; +import { getEl, hideEl, showEl } from '@app/lib/get-el'; import { CatalogManager } from '@app/singletons/catalog-manager'; import { StringifiedNumber } from '@app/static/sat-math'; @@ -30,9 +30,12 @@ export class OrbitReferences extends KeepTrackPlugin { cbName: this.PLUGIN_NAME, cb: (obj?: BaseObject) => { // Skip this if there is no satellite object because the menu isn't open - if (!obj) { + if (!obj?.isSatellite()) { + hideEl('orbit-references-link'); + return; } + showEl('orbit-references-link'); if (!this.doOnce) { getEl('sat-info-top-links').insertAdjacentHTML( diff --git a/src/plugins/select-sat-manager/sat-info-box.ts b/src/plugins/select-sat-manager/sat-info-box.ts index e4d07528a..74e54f438 100644 --- a/src/plugins/select-sat-manager/sat-info-box.ts +++ b/src/plugins/select-sat-manager/sat-info-box.ts @@ -903,14 +903,16 @@ export class SatInfoBox extends KeepTrackPlugin { ${getEl('search') ? SatInfoBox.createSearchLinks_() : ''} - - - - +
Identifiers
@@ -1055,6 +1057,7 @@ export class SatInfoBox extends KeepTrackPlugin { private static createSearchLinks_(): string { return keepTrackApi.html` + +
`; } static resetMenuLocation(satInfoboxDom: HTMLElement, isShow = true) { @@ -1600,7 +1604,7 @@ export class SatInfoBox extends KeepTrackPlugin { if (!el) { return; } - hideEl(el.parentElement.id); + hideEl(el.parentElement); }, ); diff --git a/src/plugins/select-sat-manager/select-sat-manager.ts b/src/plugins/select-sat-manager/select-sat-manager.ts index a0fe638a2..fb3af4492 100644 --- a/src/plugins/select-sat-manager/select-sat-manager.ts +++ b/src/plugins/select-sat-manager/select-sat-manager.ts @@ -1,6 +1,6 @@ import { GetSatType, KeepTrackApiEvents, ToastMsgType } from '@app/interfaces'; import { keepTrackApi } from '@app/keepTrackApi'; -import { getEl } from '@app/lib/get-el'; +import { getEl, hideEl, showEl } from '@app/lib/get-el'; import { CameraType } from '@app/singletons/camera'; import { MissileObject } from '@app/singletons/catalog-manager/MissileObject'; @@ -120,6 +120,8 @@ export class SelectSatManager extends KeepTrackPlugin { case SpaceObjectType.SPECIAL: case SpaceObjectType.NOTIONAL: case SpaceObjectType.UNKNOWN: + showEl('search-links'); + showEl('draw-line-links'); this.selectSatObject_(obj as DetailedSatellite); break; case SpaceObjectType.PAYLOAD_OWNER: @@ -133,6 +135,8 @@ export class SelectSatManager extends KeepTrackPlugin { case SpaceObjectType.STAR: return; // Do nothing case SpaceObjectType.BALLISTIC_MISSILE: + hideEl('search-links'); + hideEl('draw-line-links'); this.selectSatObject_(obj as MissileObject); break; default: diff --git a/src/plugins/sensor-list/sensor-list.ts b/src/plugins/sensor-list/sensor-list.ts index 36a6226a1..3fb752573 100644 --- a/src/plugins/sensor-list/sensor-list.ts +++ b/src/plugins/sensor-list/sensor-list.ts @@ -1,7 +1,7 @@ import { sensors } from '@app/catalogs/sensors'; import { KeepTrackApiEvents } from '@app/interfaces'; import { getClass } from '@app/lib/get-class'; -import { getEl } from '@app/lib/get-el'; +import { getEl, hideEl, showEl } from '@app/lib/get-el'; import { CameraType } from '@app/singletons/camera'; import { errorManagerInstance } from '@app/singletons/errorManager'; import { PersistenceManager, StorageKey } from '@app/singletons/persistence-manager'; @@ -163,10 +163,14 @@ export class SensorListPlugin extends KeepTrackPlugin { cbName: 'sensor', cb: (obj: BaseObject) => { // Skip this if there is no satellite object because the menu isn't open - if (obj === null || typeof obj === 'undefined') { + if (!obj?.isSatellite()) { + hideEl('sensors-in-fov-link'); + return; } + showEl('sensors-in-fov-link'); + if (keepTrackApi.getPlugin(SatInfoBox) !== null && !this.isSensorLinksAdded) { getEl('sat-info-top-links').insertAdjacentHTML( 'beforeend', diff --git a/src/plugins/short-term-fences/short-term-fences.ts b/src/plugins/short-term-fences/short-term-fences.ts index 6bade47e4..cdd6f9644 100644 --- a/src/plugins/short-term-fences/short-term-fences.ts +++ b/src/plugins/short-term-fences/short-term-fences.ts @@ -1,6 +1,6 @@ import { KeepTrackApiEvents } from '@app/interfaces'; import { keepTrackApi } from '@app/keepTrackApi'; -import { getEl } from '@app/lib/get-el'; +import { getEl, hideEl, showEl } from '@app/lib/get-el'; import { slideInRight, slideOutLeft } from '@app/lib/slide'; import searchPng from '@public/img/icons/search.png'; @@ -96,9 +96,12 @@ export class ShortTermFences extends KeepTrackPlugin { cbName: this.PLUGIN_NAME, cb: (obj: BaseObject) => { // Skip this if there is no satellite object because the menu isn't open - if (obj === null || typeof obj === 'undefined') { + if (!obj?.isSatellite()) { + hideEl('stf-on-object-link'); + return; } + showEl('stf-on-object-link'); if (keepTrackApi.getPlugin(SatInfoBox) && !this.isAddStfLinksOnce) { getEl('sat-info-top-links').insertAdjacentHTML( diff --git a/src/singletons/draw-manager/line-manager.ts b/src/singletons/draw-manager/line-manager.ts index b6068c1be..3ce898283 100644 --- a/src/singletons/draw-manager/line-manager.ts +++ b/src/singletons/draw-manager/line-manager.ts @@ -51,7 +51,7 @@ export class LineManager { } createSatRicFrame(sat: DetailedSatellite | MissileObject | null): void { - if (!sat || sat instanceof MissileObject) { + if (!sat || !(sat instanceof DetailedSatellite)) { return; } @@ -61,7 +61,7 @@ export class LineManager { } createSatToRef(sat: DetailedSatellite | MissileObject | null, ref: vec3, color?: vec4): void { - if (!sat || sat instanceof MissileObject) { + if (!sat || !(sat instanceof DetailedSatellite)) { return; } @@ -69,7 +69,7 @@ export class LineManager { } createSat2Sun(sat: DetailedSatellite | MissileObject | null): void { - if (!sat || sat instanceof MissileObject) { + if (!sat || !(sat instanceof DetailedSatellite)) { return; } @@ -110,7 +110,7 @@ export class LineManager { } createSensorToSat(sensor: DetailedSensor | null, sat: DetailedSatellite | MissileObject | null, color?: vec4): void { - if (!sensor || !sat || sat instanceof MissileObject) { + if (!sensor || !sat || !(sat instanceof DetailedSatellite)) { return; } @@ -136,7 +136,7 @@ export class LineManager { } createSensorToSatFovAndSelectedOnly(sensor: DetailedSensor | null, sat: DetailedSatellite | null, color?: vec4): void { - if (!sensor || !sat || sat instanceof MissileObject) { + if (!sensor || !sat || !(sat instanceof DetailedSatellite)) { return; }