From 112a52c12e9fd3cdf958047657717ae7cbac5c51 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Sun, 25 Jul 2021 22:46:53 -0500 Subject: [PATCH 1/4] feat: improve riven data and synthesis displays --- src/assets/json/platforms.json | 6 +- src/assets/less/coloration.less | 21 ++ src/assets/less/common.less | 12 + src/assets/less/night.less | 2 +- src/components/modalDialogs/Platforms.vue | 1 + src/lang/en.json | 2 +- src/main.js | 6 + src/store.js | 58 ++-- src/views/OpenWorld/Deimos/Fish.vue | 10 +- src/views/RivenData.vue | 311 ++++++++++++++-------- src/views/Synthesis.vue | 54 +++- 11 files changed, 321 insertions(+), 162 deletions(-) diff --git a/src/assets/json/platforms.json b/src/assets/json/platforms.json index dedf38c9..ba172eb3 100644 --- a/src/assets/json/platforms.json +++ b/src/assets/json/platforms.json @@ -5,17 +5,17 @@ "icon": "fab fa-windows" }, "ps4": { - "display": "PS4", + "display": "Playstation Network", "key": "ps4", "icon": "fab fa-playstation" }, "xb1": { - "display": "XB1", + "display": "XBox Live", "key": "xb1", "icon": "fab fa-xbox" }, "swi": { - "display": "Switch", + "display": "Nintendo Switch", "key": "swi", "icon": "fab fa-nintendo-switch" } diff --git a/src/assets/less/coloration.less b/src/assets/less/coloration.less index 2dafd340..cc337b22 100644 --- a/src/assets/less/coloration.less +++ b/src/assets/less/coloration.less @@ -163,6 +163,27 @@ li.nav-item.b-nav-dropdown:has(.active) { background-color: @check-color; } + +/******** Forms... ish *******/ +.pagination { + & .page-item.active .page-link { + background-color: @check-color; + border-color: @check-color; + color: @badge-color; + } + & .page-item .page-link { + background-color: @secondary-bg; + border-color: @secondary-bg; + color: @badge-color; + } +} + +.form-control { + border-color: @secondary-bg-border; + background-color: @secondary-bg; + color: @text-color; +} + /******** Modal Dialogs *******/ .modal-content, .modal-header { background-color: @bg-darker; diff --git a/src/assets/less/common.less b/src/assets/less/common.less index 089c4a55..7147be30 100644 --- a/src/assets/less/common.less +++ b/src/assets/less/common.less @@ -76,7 +76,19 @@ img { border-style: solid; } +.dropdown-menu { + .form-group { + padding-left: 10px; + } +} + +.custom-control-label { + &::before, &::after { + top: 0; + } + font-size: 12px; +} @media only screen and (min-width: 700px) { .navbar.fixed-top { diff --git a/src/assets/less/night.less b/src/assets/less/night.less index 5ee0965e..1cf267aa 100644 --- a/src/assets/less/night.less +++ b/src/assets/less/night.less @@ -8,7 +8,7 @@ @border-color: #444; @modal-border: @border-color; @dh-color: #888; - @dm-color: #212529; + @dm-color: #eee; @active-page: rgb(0, 188, 140); /* Bootstrap theme colors */ diff --git a/src/components/modalDialogs/Platforms.vue b/src/components/modalDialogs/Platforms.vue index d7353fab..9e811a90 100644 --- a/src/components/modalDialogs/Platforms.vue +++ b/src/components/modalDialogs/Platforms.vue @@ -38,6 +38,7 @@ export default { savePlatform(platform) { this.$store.commit('commitPlatform', platform); this.$store.dispatch('updateWorldstate'); + this.$store.dispatch('updateRivens'); }, }, }; diff --git a/src/lang/en.json b/src/lang/en.json index 3789794c..f7c41926 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -34,7 +34,7 @@ "docs": "API Docs", "old": "Old Hub", "status": "Status", - "riven": "Riven Data (Alpha)", + "riven": "Riven Data (Beta)", "synth": "Synthesis Targets", "map": "Map", "fish": "Fishing Data", diff --git a/src/main.js b/src/main.js index 3fe7402e..4813e69e 100644 --- a/src/main.js +++ b/src/main.js @@ -118,6 +118,8 @@ const i18n = new VueI18n({ // Kick off worldstate refresh store.dispatch('updateWorldstate'); +store.dispatch('updateRivens'); +store.dispatch('updateSynthData'); new Vue({ router, @@ -130,3 +132,7 @@ const interval = process.env.VUE_APP_INTERVAL === undefined ? 30000 : Number(pro setInterval(() => { store.dispatch('updateWorldstate'); }, interval); +setInterval(() => { + store.dispatch('updateRivens'); + store.dispatch('updateSynthData'); +}, 3600000); diff --git a/src/store.js b/src/store.js index 97a2ceb4..70f7f27e 100644 --- a/src/store.js +++ b/src/store.js @@ -56,11 +56,32 @@ const state = { }, locale: 'en', bountyToggles: {}, + rivens: { + pc: [], + ps4: [], + xb1: [], + switch: [], + }, + synthData: [], }; const mutations = { commitWs: (state, [platform, worldstate]) => { state.worldstates[platform] = worldstate; }, + commitRivens: (state, [platform, rivens]) => { + if (!state.rivens || Array.isArray(state.rivens)) { + state.rivens = { + pc: [], + ps4: [], + xb1: [], + switch: [], + }; + } + state.rivens[platform] = rivens; + }, + commitSynthData: (state, [synthData]) => { + state.synthData = synthData; + }, commitLocale: (state, locale) => { state.locale = locale; }, @@ -171,6 +192,15 @@ const actions = { .concat([ws.sentientOutposts.id]); commit('notifiedIds', [newIds]); }, + async updateRivens({ commit, getters }) { + const res = await fetch(`https://n9e5v4d8.ssl.hwcdn.net/repos/weeklyRivens${getters.platform.toUpperCase()}.json`); + const rivens = JSON.parse((await res.text()).replace(/NaN/g, 0).replace(/WARNING:.*\n/, '')); + commit('commitRivens', [getters.platform, rivens]); + }, + async updateSynthData({ commit }) { + const res = await fetch('https://api.warframestat.us/synthTargets').then((res) => res.json()); + commit('commitSynthData', [res]); + }, }; const getters = { worldstate: (state) => state.worldstates[state.platform], @@ -198,28 +228,18 @@ const getters = { poeMapToggles: (state) => state.poeMapToggles, vallisMapToggles: (state) => state.vallisMapToggles, bountyToggles: (state) => state.bountyToggles, + rivens: (state) => state.rivens[state.platform], + synthData: (state) => state.synthData, }; Vue.use(Vuex); const shouldPersist = (process.env.VUE_APP_PERSIST === undefined ? 'true' : process.env.VUE_APP_PERSIST) === 'true'; -let tStore; -if (shouldPersist) { - tStore = new Vuex.Store({ - state, - mutations, - actions, - getters, - plugins: [createPersistedState()], - }); -} else { - tStore = new Vuex.Store({ - state, - mutations, - actions, - getters, - plugins: [], - }); -} -const store = tStore; +const store = new Vuex.Store({ + state, + mutations, + actions, + getters, + plugins: [shouldPersist ? createPersistedState() : null].filter((p) => p), +}); export default store; diff --git a/src/views/OpenWorld/Deimos/Fish.vue b/src/views/OpenWorld/Deimos/Fish.vue index 7d2f22fd..9d0ba4dc 100644 --- a/src/views/OpenWorld/Deimos/Fish.vue +++ b/src/views/OpenWorld/Deimos/Fish.vue @@ -55,10 +55,9 @@