Wire satellite capture handoff

This commit is contained in:
James Smith
2026-03-19 15:59:58 +00:00
parent 2eeea3b74d
commit b62b97ab57
3 changed files with 48 additions and 6 deletions

View File

@@ -280,7 +280,7 @@ body {
.primary-layout {
display: grid;
grid-template-columns: 300px minmax(0, 1.6fr) 360px;
gap: 12px;
gap: 10px;
min-height: 520px;
min-width: 0;
}
@@ -295,9 +295,10 @@ body {
.command-rail {
display: grid;
grid-template-rows: auto auto auto minmax(260px, 340px);
gap: 12px;
gap: 6px;
min-width: 0;
align-items: start;
align-content: start;
}
.data-grid {

View File

@@ -16401,11 +16401,11 @@
if (typeof KeyboardShortcuts !== 'undefined') KeyboardShortcuts.init();
});
// ── Weather-satellite handoff from the satellite dashboard iframe ─────────
window.addEventListener('message', (event) => {
if (!event.data || event.data.type !== 'weather-sat-handoff') return;
// ── Weather-satellite handoff from the satellite dashboard iframe/tab ─────
function processWeatherSatHandoff(payload) {
if (!payload || payload.type !== 'weather-sat-handoff') return;
const { satellite, aosTime, tcaEl, duration } = event.data;
const { satellite, aosTime, tcaEl, duration } = payload;
if (!satellite) return;
// 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) {
@@ -16463,6 +16489,10 @@
// Auto-dismiss after 2 minutes
setTimeout(() => { if (banner.parentNode) banner.remove(); }, 120000);
}
window.addEventListener('DOMContentLoaded', () => {
setTimeout(consumePendingWeatherSatHandoff, 250);
});
</script>
</body>

View File

@@ -2041,7 +2041,18 @@
const target = window.parent !== window ? window.parent : window.opener;
if (target) {
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) {