Wire satellite capture handoff

This commit is contained in:
James Smith
2026-03-19 15:59:58 +00:00
parent 30960e6d6f
commit afc8c2e84f
3 changed files with 48 additions and 6 deletions
+3 -2
View File
@@ -280,7 +280,7 @@ body {
.primary-layout { .primary-layout {
display: grid; display: grid;
grid-template-columns: 300px minmax(0, 1.6fr) 360px; grid-template-columns: 300px minmax(0, 1.6fr) 360px;
gap: 12px; gap: 10px;
min-height: 520px; min-height: 520px;
min-width: 0; min-width: 0;
} }
@@ -295,9 +295,10 @@ body {
.command-rail { .command-rail {
display: grid; display: grid;
grid-template-rows: auto auto auto minmax(260px, 340px); grid-template-rows: auto auto auto minmax(260px, 340px);
gap: 12px; gap: 6px;
min-width: 0; min-width: 0;
align-items: start; align-items: start;
align-content: start;
} }
.data-grid { .data-grid {
+34 -4
View File
@@ -16401,11 +16401,11 @@
if (typeof KeyboardShortcuts !== 'undefined') KeyboardShortcuts.init(); if (typeof KeyboardShortcuts !== 'undefined') KeyboardShortcuts.init();
}); });
// ── Weather-satellite handoff from the satellite dashboard iframe ───────── // ── Weather-satellite handoff from the satellite dashboard iframe/tab ─────
window.addEventListener('message', (event) => { function processWeatherSatHandoff(payload) {
if (!event.data || event.data.type !== 'weather-sat-handoff') return; if (!payload || payload.type !== 'weather-sat-handoff') return;
const { satellite, aosTime, tcaEl, duration } = event.data; const { satellite, aosTime, tcaEl, duration } = payload;
if (!satellite) return; if (!satellite) return;
// Determine how far away the pass is // Determine how far away the pass is
@@ -16426,6 +16426,32 @@
} }
} }
}); });
}
function consumePendingWeatherSatHandoff() {
let raw = null;
try {
raw = window.sessionStorage?.getItem('intercept.pendingWeatherSatHandoff')
|| window.localStorage?.getItem('intercept.pendingWeatherSatHandoff');
} catch (_) {
raw = null;
}
if (!raw) return;
try {
window.sessionStorage?.removeItem('intercept.pendingWeatherSatHandoff');
window.localStorage?.removeItem('intercept.pendingWeatherSatHandoff');
} catch (_) {}
try {
processWeatherSatHandoff(JSON.parse(raw));
} catch (err) {
console.warn('Failed to consume weather-satellite handoff payload:', err);
}
}
window.addEventListener('message', (event) => {
processWeatherSatHandoff(event.data);
}); });
function showHandoffBanner(satellite, minsAway, tcaEl, duration) { function showHandoffBanner(satellite, minsAway, tcaEl, duration) {
@@ -16463,6 +16489,10 @@
// Auto-dismiss after 2 minutes // Auto-dismiss after 2 minutes
setTimeout(() => { if (banner.parentNode) banner.remove(); }, 120000); setTimeout(() => { if (banner.parentNode) banner.remove(); }, 120000);
} }
window.addEventListener('DOMContentLoaded', () => {
setTimeout(consumePendingWeatherSatHandoff, 250);
});
</script> </script>
</body> </body>
+11
View File
@@ -2041,7 +2041,18 @@
const target = window.parent !== window ? window.parent : window.opener; const target = window.parent !== window ? window.parent : window.opener;
if (target) { if (target) {
target.postMessage(msg, '*'); target.postMessage(msg, '*');
return;
} }
try {
if (window.sessionStorage) {
window.sessionStorage.setItem('intercept.pendingWeatherSatHandoff', JSON.stringify(msg));
} else if (window.localStorage) {
window.localStorage.setItem('intercept.pendingWeatherSatHandoff', JSON.stringify(msg));
}
} catch (_) {}
window.location.assign('/?mode=weathersat');
} }
function selectPass(idx) { function selectPass(idx) {