fix: fix hide/show navi points in different languages (#1638)
This commit is contained in:
1 parent
3a651c99a1
commit
182d9541f1
4 files changed
+11
-5
No files matched your search
@@ -9,6 +9,7 @@ import { GuiNavigationStateEntry } from '@/store/gui/navigation/types'
|
||||
export interface NaviPoint {
|
||||
type: 'link' | 'route'
|
||||
title: string
|
||||
orgTitle?: string
|
||||
to?: string
|
||||
href?: string
|
||||
target?: string
|
||||
@@ -53,6 +54,7 @@ export default class NavigationMixin extends Mixins(BaseMixin) {
|
||||
points.push({
|
||||
type: 'route',
|
||||
title: this.$t(`Router.${element.title}`),
|
||||
orgTitle: element.title,
|
||||
icon: element.icon,
|
||||
to: element.path,
|
||||
position,
|
||||
|
||||
@@ -34,7 +34,7 @@ export default class SettingsNavigationTab extends Mixins(NavigationMixin, BaseM
|
||||
newVal.forEach((naviPoint, index) => {
|
||||
this.$store.dispatch('gui/navigation/updatePos', {
|
||||
type: naviPoint.type,
|
||||
title: naviPoint.title,
|
||||
title: naviPoint.orgTitle ?? naviPoint.title,
|
||||
visible: naviPoint.visible,
|
||||
position: index + 1,
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@ import { ActionTree } from 'vuex'
|
||||
import { RootState } from '@/store/types'
|
||||
import Vue from 'vue'
|
||||
import { GuiNavigationState, GuiNavigationStateEntry } from '@/store/gui/navigation/types'
|
||||
import { NaviPoint } from '@/components/mixins/navigation'
|
||||
|
||||
export const actions: ActionTree<GuiNavigationState, RootState> = {
|
||||
reset({ commit }) {
|
||||
@@ -20,7 +21,7 @@ export const actions: ActionTree<GuiNavigationState, RootState> = {
|
||||
commit('updatePos', payload)
|
||||
},
|
||||
|
||||
changeVisibility({ commit, dispatch }, payload: GuiNavigationStateEntry) {
|
||||
changeVisibility({ commit, dispatch }, payload: NaviPoint) {
|
||||
commit('changeVisibility', payload)
|
||||
dispatch('upload')
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ import { getDefaultState } from './index'
|
||||
import { MutationTree } from 'vuex'
|
||||
import { GuiNavigationState, GuiNavigationStateEntry } from './types'
|
||||
import Vue from 'vue'
|
||||
import { NaviPoint } from '@/components/mixins/navigation'
|
||||
|
||||
export const mutations: MutationTree<GuiNavigationState> = {
|
||||
reset(state) {
|
||||
@@ -34,9 +35,11 @@ export const mutations: MutationTree<GuiNavigationState> = {
|
||||
Vue.set(state, 'entries', entries)
|
||||
},
|
||||
|
||||
changeVisibility(state, payload: GuiNavigationStateEntry) {
|
||||
changeVisibility(state, payload: NaviPoint) {
|
||||
const title = payload.orgTitle ?? payload.title
|
||||
|
||||
const index = state.entries.findIndex((entry) => {
|
||||
return entry.type === payload.type && entry.title === payload.title
|
||||
return entry.type === payload.type && entry.title === title
|
||||
})
|
||||
|
||||
// update existing entry
|
||||
@@ -48,7 +51,7 @@ export const mutations: MutationTree<GuiNavigationState> = {
|
||||
// create new entry
|
||||
const newEntry: GuiNavigationStateEntry = {
|
||||
type: payload.type,
|
||||
title: payload.title,
|
||||
title,
|
||||
visible: !payload.visible,
|
||||
position: payload.position,
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user