Files
gods-eye-view/src/ui/panelRailCatalog.js
T
Sameh Khamis 3d5d3ef014 feat(ui): add a desktop panel rail to each sidebar
Each side stack hosts a Vue rail listing its panels; selecting one opens it
through PanelChrome. The shell owns one Vue runtime and Pinia instance, and a
panel store mirrors each side's panels from the DOM. The rail hides with its
stack, in Cockpit, clean view and recording, and on phones. Panels without a
catalog entry get a generic item, and Data Layers leaves the rail while the
f shortcut hides it.
2026-10-30 16:41:29 -07:00

42 lines
1.5 KiB
JavaScript

import { msg } from '../i18n/index.js';
/** Class of the element each side stack hosts its rail in. */
export const PANEL_RAIL_HOST_CLASS = 'gev-panel-rail';
/** Glyph for a panel without a catalog entry, such as one a host adds. */
export const PANEL_RAIL_FALLBACK_ICON = 'more_horiz';
/**
* How each side panel appears on its rail. Labels are the panels' own titles.
* `shownBy` names a class the panel needs to be shown at all (`f` toggles
* Data Layers' `active`).
*/
export const PANEL_RAIL_ITEMS = Object.freeze({
'data-panel': {
icon: 'layers',
label: msg('DATA LAYERS'),
shownBy: 'active',
},
'scene-panel': { icon: 'movie', label: msg('AUTHORING') },
'pp-toggles': { icon: 'tune', label: msg('DISPLAY') },
'cctv-panel': { icon: 'videocam', label: msg('CCTV') },
'weather-panel': { icon: 'partly_cloudy_day', label: msg('WEATHER') },
'recent-imagery-panel': {
icon: 'satellite_alt',
label: msg('RECENT IMAGERY'),
},
'street-level-panel': { icon: 'streetview', label: msg('STREET LEVEL') },
'global-context-panel': { icon: 'radar', label: msg('CONTEXT') },
});
/**
* Whether a mutation happened inside a panel rail, which no stack layout or
* panel state depends on.
* @param {MutationRecord} record Observed mutation.
*/
export function isPanelRailMutation(record) {
const target =
record.target.nodeType === 1 ? record.target : record.target.parentElement;
return Boolean(target?.closest?.(`.${PANEL_RAIL_HOST_CLASS}`));
}