2022-01-13 22:25:47 -06:00
|
|
|
<template>
|
|
|
|
<div class="tabs-container">
|
|
|
|
<div v-for="(tab, index) in tabs" :key="index" class="tab" :ref="`tab-${index}`">
|
|
|
|
<Nav v-if="index === 0 && !useHeader" />
|
|
|
|
<div class="inner-tab">
|
|
|
|
<Layer
|
|
|
|
v-if="layerKeys.includes(tab)"
|
2022-02-27 13:49:34 -06:00
|
|
|
v-bind="gatherLayerProps(layers[tab]!)"
|
2022-01-13 22:25:47 -06:00
|
|
|
:index="index"
|
2022-01-24 22:25:34 -06:00
|
|
|
:tab="() => (($refs[`tab-${index}`] as HTMLElement[] | undefined)?.[0])"
|
2022-01-13 22:25:47 -06:00
|
|
|
/>
|
|
|
|
<component :is="tab" :index="index" v-else />
|
|
|
|
</div>
|
|
|
|
<div class="separator" v-if="index !== tabs.length - 1"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2022-03-02 20:12:56 -06:00
|
|
|
import projInfo from "@/data/projInfo.json";
|
2022-02-27 13:49:34 -06:00
|
|
|
import { GenericLayer, layers } from "@/game/layers";
|
2022-01-13 22:25:47 -06:00
|
|
|
import player from "@/game/player";
|
|
|
|
import { computed, toRef } from "vue";
|
|
|
|
import Layer from "./Layer.vue";
|
|
|
|
import Nav from "./Nav.vue";
|
|
|
|
|
|
|
|
const tabs = toRef(player, "tabs");
|
|
|
|
const layerKeys = computed(() => Object.keys(layers));
|
2022-03-02 20:12:56 -06:00
|
|
|
const useHeader = projInfo.useHeader;
|
2022-02-27 13:49:34 -06:00
|
|
|
|
|
|
|
function gatherLayerProps(layer: GenericLayer) {
|
|
|
|
const { display, minimized, minWidth, name, color, style, classes, links, minimizable } = layer;
|
|
|
|
return { display, minimized, minWidth, name, color, style, classes, links, minimizable };
|
|
|
|
}
|
2022-01-13 22:25:47 -06:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.tabs-container {
|
|
|
|
width: 100vw;
|
|
|
|
flex-grow: 1;
|
|
|
|
overflow-x: auto;
|
|
|
|
overflow-y: hidden;
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tab {
|
|
|
|
position: relative;
|
|
|
|
height: 100%;
|
|
|
|
flex-grow: 1;
|
|
|
|
transition-duration: 0s;
|
|
|
|
overflow-y: auto;
|
|
|
|
overflow-x: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
.inner-tab {
|
|
|
|
padding: 50px 10px;
|
|
|
|
min-height: calc(100% - 100px);
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
margin: 0;
|
|
|
|
flex-grow: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.separator {
|
|
|
|
position: absolute;
|
2022-02-27 13:49:34 -06:00
|
|
|
right: -4px;
|
2022-01-13 22:25:47 -06:00
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
2022-02-27 13:49:34 -06:00
|
|
|
width: 8px;
|
2022-01-13 22:25:47 -06:00
|
|
|
background: var(--outline);
|
|
|
|
z-index: 1;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.tab hr {
|
|
|
|
height: 4px;
|
|
|
|
border: none;
|
|
|
|
background: var(--outline);
|
2022-02-27 13:49:34 -06:00
|
|
|
margin: var(--feature-margin) -10px;
|
2022-01-13 22:25:47 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
.tab .modal-body hr {
|
|
|
|
margin: 7px 0;
|
|
|
|
}
|
|
|
|
</style>
|