Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { loadFromStorage, parseMapUrlState, saveToStorage, isMobileDevice } from
import type { ParsedMapUrlState } from '@/utils';
import { SignalModal, IntelligenceGapBadge, BreakingNewsBanner } from '@/components';
import { initBreakingNewsAlerts, destroyBreakingNewsAlerts } from '@/services/breaking-news-alerts';
import { normalizeMonitors } from '@/services/monitors';
import type { ServiceStatusPanel } from '@/components/ServiceStatusPanel';
import type { StablecoinPanel } from '@/components/StablecoinPanel';
import type { ETFFlowsPanel } from '@/components/ETFFlowsPanel';
Expand Down Expand Up @@ -330,7 +331,7 @@ export class App {

const isMobile = isMobileDevice();
const isDesktopApp = isDesktopRuntime();
const monitors = loadFromStorage<Monitor[]>(STORAGE_KEYS.monitors, []);
const monitors = normalizeMonitors(loadFromStorage<Monitor[]>(STORAGE_KEYS.monitors, []));

// Use mobile-specific defaults on first load (no saved layers)
const defaultLayers = isMobile ? MOBILE_DEFAULT_MAP_LAYERS : DEFAULT_MAP_LAYERS;
Expand Down
2 changes: 2 additions & 0 deletions src/app/app-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { IranEvent } from '@/generated/client/worldmonitor/conflict/v1/serv
import type { SanctionsPressureResult } from '@/services/sanctions-pressure';
import type { RadiationWatchResult } from '@/services/radiation';
import type { SecurityAdvisory } from '@/services/security-advisories';
import type { ListCrossSourceSignalsResponse } from '@/services/cross-source-signals';
import type { Earthquake } from '@/services/earthquakes';

export type { CountryBriefSignals } from '@/types';
Expand All @@ -20,6 +21,7 @@ export interface IntelligenceCache {
iranEvents?: IranEvent[];
orefAlerts?: { alertCount: number; historyCount24h: number };
advisories?: SecurityAdvisory[];
crossSourceSignals?: ListCrossSourceSignalsResponse;
sanctions?: SanctionsPressureResult;
radiation?: RadiationWatchResult;
imageryScenes?: Array<{ id: string; satellite: string; datetime: string; resolutionM: number; mode: string; geometryGeojson: string; previewUrl: string; assetUrl: string }>;
Expand Down
24 changes: 23 additions & 1 deletion src/app/data-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import { fetchConflictEvents, fetchUcdpClassifications, fetchHapiSummary, fetchU
import { fetchUnhcrPopulation } from '@/services/displacement';
import { fetchClimateAnomalies } from '@/services/climate';
import { fetchSecurityAdvisories } from '@/services/security-advisories';
import { applyMonitorHighlightsToNews, hasMonitorProAccess } from '@/services/monitors';
import { fetchThermalEscalations } from '@/services/thermal-escalation';
import { fetchCrossSourceSignals } from '@/services/cross-source-signals';
import { fetchTelegramFeed } from '@/services/telegram-intel';
Expand Down Expand Up @@ -2532,7 +2533,27 @@ export class DataLoaderManager implements AppModule {

updateMonitorResults(): void {
const monitorPanel = this.ctx.panels['monitors'] as MonitorPanel | undefined;
monitorPanel?.renderResults(this.ctx.allNews);
const highlightedAllNews = applyMonitorHighlightsToNews(
this.ctx.monitors,
this.ctx.allNews,
{ proAccess: hasMonitorProAccess() },
);
this.ctx.allNews = highlightedAllNews;

Object.entries(this.ctx.newsByCategory).forEach(([category, items]) => {
const highlightedItems = applyMonitorHighlightsToNews(
this.ctx.monitors,
items,
{ proAccess: hasMonitorProAccess() },
);
this.renderNewsForCategory(category, highlightedItems);
});

monitorPanel?.renderResults({
news: highlightedAllNews,
advisories: this.ctx.intelligenceCache.advisories ?? [],
crossSourceSignals: this.ctx.intelligenceCache.crossSourceSignals?.signals ?? [],
});
}

async runCorrelationAnalysis(): Promise<void> {
Expand Down Expand Up @@ -2894,6 +2915,7 @@ export class DataLoaderManager implements AppModule {
async loadCrossSourceSignals(): Promise<void> {
try {
const result = await fetchCrossSourceSignals();
this.ctx.intelligenceCache.crossSourceSignals = result;
this.callPanel('cross-source-signals', 'setData', result);
dataFreshness.recordUpdate('cross-source-signals' as DataSourceId, result.signals?.length ?? 0);
} catch (error) {
Expand Down
Loading
Loading