mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 07:42:23 +00:00
The Cyber accordion now applies to both sidebars and every HUD layout: opening a side panel collapses its peers, the layout normalizes restored state to one owner, and collapsed panels are hidden on desktop. Phones keep showing several panels per sheet.
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
const GLOBAL_CONTEXT_EXPLICIT_ACTIONS = new Set([
|
|
'contacts',
|
|
'space-missions',
|
|
'cockpit',
|
|
]);
|
|
|
|
/**
|
|
* Decide whether a completed action should reveal the Global Context panel.
|
|
* Expansion belongs only to an explicit, successful owner action. Restoring a
|
|
* session or replaying saved state must preserve the saved collapsed state,
|
|
* and a failed transition must leave the prior panel state untouched.
|
|
*
|
|
* Whether an aircraft is already selected is deliberately irrelevant: an
|
|
* explicit Cockpit action still reveals the context that supports that track.
|
|
*
|
|
* @param {object} input Action outcome and coordination state.
|
|
* @param {'contacts'|'space-missions'|'cockpit'|string} input.action Completed action.
|
|
* @param {boolean} input.explicitUserAction Whether the user directly requested it.
|
|
* @param {boolean} input.succeeded Whether the requested transition completed.
|
|
* @param {boolean} [input.restoring=false] Whether saved/session state is being restored.
|
|
* @returns {boolean} Whether Global Context should be expanded.
|
|
*/
|
|
export function shouldExpandGlobalContextPanel({
|
|
action,
|
|
explicitUserAction,
|
|
succeeded,
|
|
restoring = false,
|
|
}) {
|
|
return Boolean(
|
|
GLOBAL_CONTEXT_EXPLICIT_ACTIONS.has(action) &&
|
|
explicitUserAction &&
|
|
succeeded &&
|
|
!restoring,
|
|
);
|
|
}
|