mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
UiRail takes `collapsible`: while no panel on its side is open, each item shows its icon and label as a pill, and once one opens the labels fold away to the icon rail, making room for the panel. The tip is not shown while the label is on screen; the button keeps its accessible name and the visible label is hidden from assistive technology. The side panel rails turn it on. Each rail is now placed by its screen-side edge, at the rail clearance, so a rail that widens grows toward the middle of the screen; collapsed, it sits 6px outside its stack as before.
49 lines
1.2 KiB
Vue
49 lines
1.2 KiB
Vue
<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"
|
|
collapsible
|
|
@select="onSelect"
|
|
/>
|
|
</template>
|