Implemented displaying tabs

This commit is contained in:
thepaperpilot 2021-05-20 00:11:03 -05:00
parent 5e4ec334a7
commit 82adac7317
7 changed files with 85 additions and 13 deletions

View file

@ -1,12 +1,14 @@
<template> <template>
<div id="app" @mousemove="updateMouse" :style="theme"> <div id="app" @mousemove="updateMouse" :style="theme">
<Nav /> <Nav />
<TPS v-if="showTPS || true" /> <Tabs />
<TPS v-if="showTPS" />
</div> </div>
</template> </template>
<script> <script>
import Nav from './components/system/Nav.vue'; import Nav from './components/system/Nav.vue';
import Tabs from './components/system/Tabs.vue';
import TPS from './components/system/TPS.vue'; import TPS from './components/system/TPS.vue';
import themes from './data/themes.js'; import themes from './data/themes.js';
import { mapState } from 'vuex'; import { mapState } from 'vuex';
@ -14,7 +16,7 @@ import { mapState } from 'vuex';
export default { export default {
name: 'App', name: 'App',
components: { components: {
Nav, TPS Nav, Tabs, TPS
}, },
computed: { computed: {
...mapState([ 'showTPS' ]), ...mapState([ 'showTPS' ]),
@ -23,8 +25,8 @@ export default {
} }
}, },
methods: { methods: {
updateMouse(event) { updateMouse(/* event */) {
console.log("TODO updateMouse", event) // TODO use event to update mouse position for particles
} }
} }
}; };
@ -85,5 +87,7 @@ ul {
#app { #app {
background-color: var(--background); background-color: var(--background);
color: var(--color); color: var(--color);
display: flex;
flex-flow: column;
} }
</style> </style>

View file

@ -61,6 +61,7 @@ export default {
}, },
showTab(tab) { showTab(tab) {
console.log("TODO show tab", tab); console.log("TODO show tab", tab);
// tabs.splice(1, tabs.length, tab);
} }
} }
}; };
@ -75,6 +76,7 @@ export default {
top: 0; top: 0;
height: 50px; height: 50px;
z-index: 9999999; z-index: 9999999;
width: 100%;
} }
.title { .title {

View file

@ -0,0 +1,59 @@
<template>
<div class="tabs">
<div v-for="(tab, index) in tabs" class="tab" :key="index">
<button v-if="index > 0" class="goBack" @click="goBack(index)"></button>
{{ tab }}
<div class="separator" v-if="index !== tabs.length - 1"></div>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex';
export default {
name: 'Tabs',
computed: mapState([ 'tabs' ]),
methods: {
goBack(/* index */) {
// TODO tabs.splice(index)
}
}
};
</script>
<style scoped>
.tabs {
display: flex;
flex-grow: 1;
width: 100%;
}
.tab {
position: relative;
height: 100%;
width: 100%;
padding: 0 10px;
}
.separator {
position: absolute;
right: -3px;
top: 0;
bottom: 0;
width: 6px;
background: var(--separator);
}
.goBack {
position: absolute;
top: 0;
left: 20px;
background-color: transparent;
border: 1px solid transparent;
color: var(--color);
font-size: 40px;
cursor: pointer;
line-height: 40px;
}
</style>

View file

@ -5,6 +5,7 @@ import Decimal, * as numberUtils from '../util/break_eternity.js';
export default { export default {
// General Info // General Info
title: "The Modding Tree X", title: "The Modding Tree X",
banner: null,
id: "tmt-x", id: "tmt-x",
author: "thepaperpilot", author: "thepaperpilot",
discordName: "TMT-X Server", discordName: "TMT-X Server",

View file

@ -5,7 +5,8 @@ const defaultTheme = {
"--color": "#dfdfdf", "--color": "#dfdfdf",
"--points": "#ffffff", "--points": "#ffffff",
"--locked": "#bf8f8f", "--locked": "#bf8f8f",
"--link": "#02f2f2" "--link": "#02f2f2",
"--separator": "#dfdfdf"
}; };
export default { export default {
@ -13,7 +14,8 @@ export default {
paper: { paper: {
...defaultTheme, ...defaultTheme,
"--background": "#2a323d", "--background": "#2a323d",
"--background_nav": "#333c4a" "--background_nav": "#333c4a",
"--separator": "#333c4a"
}, },
aquad: { aquad: {
...defaultTheme, ...defaultTheme,
@ -22,6 +24,7 @@ export default {
"--background_nav": "#001f3f", "--background_nav": "#001f3f",
"--color": "#bfdfff", "--color": "#bfdfff",
"--points": "#dfefff", "--points": "#dfefff",
"--locked": "#c4a7b3" "--locked": "#c4a7b3",
"--separator": "#bfdfff"
} }
}; };

View file

@ -1,10 +1,12 @@
import Vue from 'vue' import Vue from 'vue';
import App from './App.vue' import App from './App.vue';
import store from './store' import store from './store';
Vue.config.productionTip = false Vue.config.productionTip = false;
window.player = store.state;
new Vue({ new Vue({
store, store,
render: h => h(App) render: h => h(App)
}).$mount('#app') }).$mount('#app');

View file

@ -2,7 +2,7 @@ import modInfo from '../data/mod.js';
export function getInitialStore() { export function getInitialStore() {
return { return {
tabs: ["tree-tab"], tabs: ["tree-tab", "info-tab", "dummy"],
time: Date.now(), time: Date.now(),
autosave: true, autosave: true,
offlineProd: true, offlineProd: true,
@ -10,6 +10,7 @@ export function getInitialStore() {
keepGoing: false, keepGoing: false,
hasNaN: false, hasNaN: false,
lastTenTicks: [], lastTenTicks: [],
showTPS: true,
...modInfo.getStartingData() ...modInfo.getStartingData()
} }
} }