From 1d655da2abb0ea1916b8d94d1d268c2051458ee8 Mon Sep 17 00:00:00 2001 From: pskfyi Date: Sun, 9 Jan 2022 19:28:09 -0800 Subject: [PATCH] refactor: use multiple routes --- components/FirstTabContent.vue | 36 ---- components/GameTab.vue | 14 +- layouts/default.vue | 158 +++++++++++++++ .../Apprentices.vue | 16 +- .../ThirdTabContent.vue => pages/Missions.vue | 0 pages/TimeMachine.vue | 9 + pages/TimeMagic.vue | 9 + .../SixthTabContent.vue => pages/Wisdom.vue | 6 - pages/index.vue | 182 +++--------------- store/index.js | 19 +- 10 files changed, 219 insertions(+), 230 deletions(-) delete mode 100644 components/FirstTabContent.vue create mode 100644 layouts/default.vue rename components/SecondTabContent.vue => pages/Apprentices.vue (67%) rename components/ThirdTabContent.vue => pages/Missions.vue (100%) create mode 100644 pages/TimeMachine.vue create mode 100644 pages/TimeMagic.vue rename components/SixthTabContent.vue => pages/Wisdom.vue (95%) diff --git a/components/FirstTabContent.vue b/components/FirstTabContent.vue deleted file mode 100644 index 57c3635..0000000 --- a/components/FirstTabContent.vue +++ /dev/null @@ -1,36 +0,0 @@ - - - - - diff --git a/components/GameTab.vue b/components/GameTab.vue index fad4b98..d99d956 100644 --- a/components/GameTab.vue +++ b/components/GameTab.vue @@ -1,8 +1,8 @@ - - diff --git a/pages/TimeMagic.vue b/pages/TimeMagic.vue new file mode 100644 index 0000000..894566d --- /dev/null +++ b/pages/TimeMagic.vue @@ -0,0 +1,9 @@ + + + + + diff --git a/components/SixthTabContent.vue b/pages/Wisdom.vue similarity index 95% rename from components/SixthTabContent.vue rename to pages/Wisdom.vue index b599621..75a940e 100644 --- a/components/SixthTabContent.vue +++ b/pages/Wisdom.vue @@ -38,9 +38,3 @@ - - - - diff --git a/pages/index.vue b/pages/index.vue index ef63feb..57c3635 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,170 +1,36 @@ - - diff --git a/store/index.js b/store/index.js index 186898a..65486e6 100644 --- a/store/index.js +++ b/store/index.js @@ -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