2121 */
2222
2323import { SunStatus } from '@app/app/analysis/sat-math' ;
24- import { PluginRegistry } from '@app/engine/core/plugin-registry ' ;
24+ import { MenuMode } from '@app/engine/core/interfaces ' ;
2525import { ServiceLocator } from '@app/engine/core/service-locator' ;
2626import { EventBus } from '@app/engine/events/event-bus' ;
2727import { EventBusEvent } from '@app/engine/events/event-bus-events' ;
28- import { MenuMode } from '@app/engine/core/interfaces' ;
2928import { html } from '@app/engine/utils/development/formatter' ;
3029import { getEl } from '@app/engine/utils/get-el' ;
3130import { BaseObject , DetailedSatellite , Milliseconds } from '@ootk/src/main' ;
3231import dayNightPng from '@public/img/icons/day-night.png' ;
3332import { KeepTrackPlugin } from '../../engine/plugins/base-plugin' ;
3433import { SelectSatManager } from '../select-sat-manager/select-sat-manager' ;
3534import { EclipseCalculations } from './eclipse-calculations' ;
36- import { EclipseEventType , EclipsePeriod , EclipsePredictionConfig } from './eclipse-types' ;
35+ import { EclipseEvent , EclipseEventType , EclipsePeriod , EclipsePredictionConfig } from './eclipse-types' ;
3736
3837export class EclipseSolarAnalysis extends KeepTrackPlugin {
3938 readonly id = 'EclipseSolarAnalysis' ;
4039 dependencies_ : string [ ] = [ SelectSatManager . name ] ;
41- private readonly selectSatManager_ : SelectSatManager ;
4240
4341 isRequireSatelliteSelected = true ;
4442 isIconDisabled = true ;
@@ -151,14 +149,9 @@ export class EclipseSolarAnalysis extends KeepTrackPlugin {
151149 private currentSatellite_ : DetailedSatellite | null = null ;
152150 private currentEclipsePeriods_ : EclipsePeriod [ ] = [ ] ;
153151 private updateInterval_ : NodeJS . Timeout | null = null ;
154- private stateStartTime_ : Date | null = null ;
152+ private stateStartTime_ : number | null = null ;
155153 private currentStatus_ : SunStatus = SunStatus . UNKNOWN ;
156154
157- constructor ( ) {
158- super ( ) ;
159- this . selectSatManager_ = PluginRegistry . getPlugin ( SelectSatManager ) as unknown as SelectSatManager ;
160- }
161-
162155 bottomIconCallback = ( ) => {
163156 if ( this . isMenuButtonActive ) {
164157 // Menu opened - start updates
@@ -188,7 +181,7 @@ export class EclipseSolarAnalysis extends KeepTrackPlugin {
188181 } ) ;
189182
190183 // Listen for time changes
191- EventBus . getInstance ( ) . on ( EventBusEvent . timeManagerTick , ( ) => {
184+ EventBus . getInstance ( ) . on ( EventBusEvent . update , ( ) => {
192185 if ( this . isMenuButtonActive && this . currentSatellite_ ) {
193186 this . updateRealTimeStatus_ ( ) ;
194187 }
@@ -251,12 +244,12 @@ export class EclipseSolarAnalysis extends KeepTrackPlugin {
251244 break ;
252245 case SunStatus . PENUMBRAL :
253246 statusText = 'Penumbral Shadow' ;
254- statusColor = '#888' ;
255247 break ;
256248 case SunStatus . UMBRAL :
257249 statusText = 'Umbral Shadow (Full Eclipse)' ;
258250 statusColor = '#444' ;
259251 break ;
252+ default :
260253 }
261254
262255 ( < HTMLInputElement > statusEl ) . value = statusText ;
@@ -266,13 +259,13 @@ export class EclipseSolarAnalysis extends KeepTrackPlugin {
266259
267260 // Track state changes to calculate time in current state
268261 if ( status !== this . currentStatus_ ) {
269- this . stateStartTime_ = currentTime ;
262+ this . stateStartTime_ = currentTime . getTime ( ) ;
270263 this . currentStatus_ = status ;
271264 }
272265
273266 // Update time in current state
274267 if ( this . stateStartTime_ ) {
275- const timeInState = currentTime . getTime ( ) - this . stateStartTime_ . getTime ( ) ;
268+ const timeInState = currentTime . getTime ( ) - this . stateStartTime_ ;
276269 const hours = Math . floor ( timeInState / 3600000 ) ;
277270 const minutes = Math . floor ( ( timeInState % 3600000 ) / 60000 ) ;
278271 const seconds = Math . floor ( ( timeInState % 60000 ) / 1000 ) ;
@@ -344,7 +337,7 @@ export class EclipseSolarAnalysis extends KeepTrackPlugin {
344337
345338 // Display results
346339 this . displayEclipseEvents_ ( events ) ;
347- this . displayEclipseStatistics_ ( periods , config . predictionDurationHours * 3600 * 1000 ) ;
340+ this . displayEclipseStatistics_ ( periods , config . predictionDurationHours * 3600 * 1000 as Milliseconds ) ;
348341
349342 // Enable export button
350343 const exportBtn = getEl ( 'export-eclipse-data-btn' ) ;
@@ -357,7 +350,7 @@ export class EclipseSolarAnalysis extends KeepTrackPlugin {
357350 /**
358351 * Display eclipse events in the UI
359352 */
360- private displayEclipseEvents_ ( events : any [ ] ) : void {
353+ private displayEclipseEvents_ ( events : EclipseEvent [ ] ) : void {
361354 const container = getEl ( 'eclipse-events-container' ) ;
362355
363356 if ( ! container ) {
@@ -392,6 +385,8 @@ export class EclipseSolarAnalysis extends KeepTrackPlugin {
392385 case EclipseEventType . EXIT_PENUMBRA :
393386 eventStr = '← Exit Penumbra' ;
394387 break ;
388+ default :
389+ eventStr = 'Unknown Event' ;
395390 }
396391
397392 html += `<tr><td>${ timeStr } </td><td>${ eventStr } </td><td>${ event . orbitNumber } </td></tr>` ;
0 commit comments