refactor: use multiple routes
This commit is contained in:
parent
19ee7040ac
commit
1d655da2ab
10 changed files with 219 additions and 230 deletions
|
|
@ -2,7 +2,6 @@ import Decimal from 'break_infinity.js'
|
|||
import Vue from 'vue'
|
||||
|
||||
export const state = () => ({
|
||||
activeTabIndex: 0,
|
||||
tabs: [
|
||||
{
|
||||
route: '/',
|
||||
|
|
@ -152,19 +151,11 @@ export const state = () => ({
|
|||
})
|
||||
|
||||
export const getters = {
|
||||
activeTab: (state) => {
|
||||
return state.tabs[state.activeTabIndex]
|
||||
},
|
||||
activeColorClasses: (state) => (index) => {
|
||||
const { darkColor, lightColor } = state.tabs[index]
|
||||
return `bg-${lightColor} text-${darkColor}`
|
||||
},
|
||||
inactiveColorClasses: (state) => (index) => {
|
||||
const { darkColor, lightColor } = state.tabs[index]
|
||||
return `bg-${darkColor} text-${lightColor}`
|
||||
},
|
||||
activeTabColorClasses: (state, getters) => {
|
||||
return getters.activeColorClasses(state.activeTabIndex)
|
||||
activeTab(state) {
|
||||
return state.tabs.find(
|
||||
// eslint-disable-next-line no-undef
|
||||
(tab) => tab.route === $nuxt.$route.path
|
||||
)
|
||||
},
|
||||
canTimeTravel: (state) => {
|
||||
if (state.playerAge.year < state.playerAgeMax.year) return true
|
||||
|
|
|
|||
Reference in a new issue