Allowed go back button to be disabled in modInfo

This commit is contained in:
thepaperpilot 2021-06-12 00:19:49 -05:00
parent c9858ff365
commit 7778fc0a6d
3 changed files with 16 additions and 2 deletions

View file

@ -2,7 +2,7 @@
<LayerProvider :layer="layer" :index="index"> <LayerProvider :layer="layer" :index="index">
<div class="layer-tab" :style="style" :class="{ hasSubtabs: subtabs }"> <div class="layer-tab" :style="style" :class="{ hasSubtabs: subtabs }">
<branches> <branches>
<sticky v-if="subtabs" class="subtabs" :class="{ floating, firstTab }"> <sticky v-if="subtabs" class="subtabs" :class="{ floating, firstTab: firstTab || !allowGoBack }">
<tab-button v-for="(subtab, id) in subtabs" @selectTab="selectSubtab(id)" :key="id" :activeTab="id === activeSubtab" <tab-button v-for="(subtab, id) in subtabs" @selectTab="selectSubtab(id)" :key="id" :activeTab="id === activeSubtab"
:options="subtab" :text="id" /> :options="subtab" :text="id" />
</sticky> </sticky>
@ -18,6 +18,7 @@ import { layers } from '../../store/layers';
import { player } from '../../store/proxies'; import { player } from '../../store/proxies';
import { coerceComponent } from '../../util/vue'; import { coerceComponent } from '../../util/vue';
import { isPlainObject } from '../../util/common'; import { isPlainObject } from '../../util/common';
import modInfo from '../../data/modInfo.json';
import themes from '../../data/themes'; import themes from '../../data/themes';
export default { export default {
@ -27,6 +28,9 @@ export default {
index: Number, index: Number,
forceFirstTab: Boolean forceFirstTab: Boolean
}, },
data() {
return { allowGoBack: modInfo.allowGoBack };
},
computed: { computed: {
floating() { floating() {
return themes[player.theme].floatingTabs; return themes[player.theme].floatingTabs;
@ -131,6 +135,11 @@ export default {
padding-left: 0; padding-left: 0;
} }
.subtabs:not(.floating).firstTab {
padding-left: 0;
padding-right: 0;
}
.subtabs:not(.floating):first-child { .subtabs:not(.floating):first-child {
margin-top: -50px; margin-top: -50px;
border-top: 0; border-top: 0;

View file

@ -2,7 +2,7 @@
<perfect-scrollbar class="tabs-container"> <perfect-scrollbar class="tabs-container">
<div class="tabs"> <div class="tabs">
<div v-for="(tab, index) in tabs" :key="index" class="tab"> <div v-for="(tab, index) in tabs" :key="index" class="tab">
<button v-if="index > 0" class="goBack" @click="goBack(index)"></button> <button v-if="index > 0 && allowGoBack" class="goBack" @click="goBack(index)"></button>
<perfect-scrollbar> <perfect-scrollbar>
<div class="inner-tab"> <div class="inner-tab">
<LayerProvider :layer="tab" :index="index" v-if="tab in components && components[tab]"> <LayerProvider :layer="tab" :index="index" v-if="tab in components && components[tab]">
@ -22,9 +22,13 @@
import { mapState } from 'vuex'; import { mapState } from 'vuex';
import { layers } from '../../store/layers'; import { layers } from '../../store/layers';
import { player } from '../../store/proxies'; import { player } from '../../store/proxies';
import modInfo from '../../data/modInfo.json';
export default { export default {
name: 'Tabs', name: 'Tabs',
data() {
return { allowGoBack: modInfo.allowGoBack };
},
computed: { computed: {
...mapState([ 'tabs' ]), ...mapState([ 'tabs' ]),
components() { components() {

View file

@ -8,6 +8,7 @@
"versionNumber": "0.0", "versionNumber": "0.0",
"versionTitle": "Initial Commit", "versionTitle": "Initial Commit",
"allowGoBack": false,
"allowSmall": false, "allowSmall": false,
"defaultDecimalsShown": 2, "defaultDecimalsShown": 2,
"useHeader": true, "useHeader": true,