fixed about tab merge issues

This commit is contained in:
Roberto Tonino 2020-09-15 18:11:29 +02:00
parent 7ea276992a
commit 82e45633f5
6 changed files with 62 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -3,8 +3,8 @@
<h2 class="page_heading">{{ $t('sidebar.about') }}</h2> <h2 class="page_heading">{{ $t('sidebar.about') }}</h2>
<ul> <ul>
<li> <li>
{{ $t('about.updates.currentVersion') }}: <span v-if="current">{{ current }}</span {{ $t('about.updates.currentVersion') }}:
><span v-else>{{ $t('about.updates.versionNotAvailable') }}</span> <span>{{ current || $t('about.updates.versionNotAvailable') }}</span>
</li> </li>
<li>{{ $t('about.updates.deemixVersion') }}: {{ deemixVersion }}</li> <li>{{ $t('about.updates.deemixVersion') }}: {{ deemixVersion }}</li>
<li v-if="updateAvailable && latest">{{ $t('about.updates.updateAvailable', { version: latest }) }}</li> <li v-if="updateAvailable && latest">{{ $t('about.updates.updateAvailable', { version: latest }) }}</li>
@ -203,6 +203,7 @@ ul {
import { socket } from '@/utils/socket' import { socket } from '@/utils/socket'
import paypal from '@/assets/paypal.svg' import paypal from '@/assets/paypal.svg'
import ethereum from '@/assets/ethereum.svg' import ethereum from '@/assets/ethereum.svg'
import { mapGetters } from 'vuex'
export default { export default {
data: () => ({ data: () => ({
@ -213,6 +214,9 @@ export default {
updateAvailable: false, updateAvailable: false,
deemixVersion: null deemixVersion: null
}), }),
computed: {
...mapGetters(['getAboutInfo'])
},
methods: { methods: {
initUpdate(data) { initUpdate(data) {
const { currentCommit, latestCommit, updateAvailable, deemixVersion } = data const { currentCommit, latestCommit, updateAvailable, deemixVersion } = data
@ -223,7 +227,7 @@ export default {
} }
}, },
mounted() { mounted() {
socket.on('init_update', this.initUpdate) this.initUpdate(this.getAboutInfo)
} }
} }
</script> </script>

View File

@ -1,5 +1,5 @@
<template> <template>
<aside id="sidebar" role="navigation" @click="handleSidebarClick"> <aside id="sidebar" role="navigation">
<router-link <router-link
tag="span" tag="span"
id="main_home_tablink" id="main_home_tablink"

View File

@ -7,6 +7,7 @@ import defaultSettings from '@/store/modules/defaultSettings'
import spotifyCredentials from '@/store/modules/spotifyCredentials' import spotifyCredentials from '@/store/modules/spotifyCredentials'
import charts from '@/store/modules/charts' import charts from '@/store/modules/charts'
import favorites from '@/store/modules/favorites' import favorites from '@/store/modules/favorites'
import about from '@/store/modules/about'
// Load Vuex // Load Vuex
Vue.use(Vuex) Vue.use(Vuex)
@ -19,7 +20,8 @@ export default new Vuex.Store({
defaultSettings, defaultSettings,
spotifyCredentials, spotifyCredentials,
charts, charts,
favorites favorites,
about
}, },
strict: process.env.NODE_ENV !== 'production' strict: process.env.NODE_ENV !== 'production'
}) })

View File

@ -0,0 +1,41 @@
const state = {
currentCommit: null,
latestCommit: null,
updateAvailable: false,
deemixVersion: null
}
const actions = {
setAboutInfo({ commit }, payload) {
commit('SET_CURRENT_COMMIT', payload.currentCommit)
commit('SET_LATEST_COMMIT', payload.latestCommit)
commit('SET_UPDATE_AVAILABLE', payload.updateAvailable)
commit('SET_DEEMIX_VERSION', payload.deemixVersion)
}
}
const getters = {
getAboutInfo: state => state
}
const mutations = {
SET_CURRENT_COMMIT: (state, payload) => {
state.currentCommit = payload
},
SET_LATEST_COMMIT: (state, payload) => {
state.latestCommit = payload
},
SET_UPDATE_AVAILABLE: (state, payload) => {
state.updateAvailable = payload
},
SET_DEEMIX_VERSION: (state, payload) => {
state.deemixVersion = payload
}
}
export default {
state,
getters,
actions,
mutations
}

View File

@ -23,3 +23,7 @@ socket.on('init_settings', (settings, credentials, defaults) => {
socket.on('init_home', data => { socket.on('init_home', data => {
store.dispatch('cacheHomeData', data) store.dispatch('cacheHomeData', data)
}) })
socket.on('init_update', data => {
store.dispatch('setAboutInfo', data)
})