mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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.
This commit is contained in:
1 parent
eed7657516
commit
3d5d3ef014
29 files changed
+627
-32
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import { t } from '../i18n/index.js';
|
||||
import UiRail from './kit/UiRail.vue';
|
||||
import {
|
||||
PANEL_RAIL_FALLBACK_ICON,
|
||||
PANEL_RAIL_ITEMS,
|
||||
} from './panelRailCatalog.js';
|
||||
import { usePanelStore } from './stores/panels.js';
|
||||
|
||||
const props = defineProps({
|
||||
/** `left` or `right`. */
|
||||
side: { type: String, required: true },
|
||||
/** Open or close a panel; receives the panel id. */
|
||||
onSelect: { type: Function, required: true },
|
||||
});
|
||||
|
||||
const panels = usePanelStore();
|
||||
const items = computed(() =>
|
||||
panels.sides[props.side]
|
||||
.filter((panel) => panel.available)
|
||||
.map((panel) => {
|
||||
const item = PANEL_RAIL_ITEMS[panel.id];
|
||||
return {
|
||||
id: panel.id,
|
||||
icon: item?.icon ?? PANEL_RAIL_FALLBACK_ICON,
|
||||
// Static markup is translated at boot, so a host's title already is.
|
||||
label: item ? t(item.label) : panel.title,
|
||||
};
|
||||
}),
|
||||
);
|
||||
const active = computed(() => panels.openPanelId(props.side));
|
||||
const label = computed(() =>
|
||||
props.side === 'left' ? t('Left panels') : t('Right panels'),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UiRail
|
||||
:items="items"
|
||||
:active="active"
|
||||
:side="side"
|
||||
:label="label"
|
||||
:panel-open="active !== null"
|
||||
@select="onSelect"
|
||||
/>
|
||||
</template>
|
||||
Reference in new issue
Block a user