Skip to content

Commit

Permalink
Merge branch 'mainsail-crew:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Bahoue authored Nov 10, 2023
2 parents 52bedd5 + 182d954 commit 15e1be4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/components/mixins/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default class GitCommitsListDayCommit extends Mixins(BaseMixin) {
commitDay.setHours(0, 0, 0, 0)
const todayDay = new Date()
todayDay.setHours(0, 0, 0, 0)
const diff = Math.floor(todayDay.getTime() - commitDay.getTime()) / (1000 * 60 * 60 * 24)
const diff = Math.floor((todayDay.getTime() - commitDay.getTime()) / (1000 * 60 * 60 * 24))
if (diff === 0) {
const diffHours = Math.floor((new Date().getTime() - this.commit.date * 1000) / (1000 * 60 * 60))
Expand Down
2 changes: 1 addition & 1 deletion src/components/settings/SettingsNavigationTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
3 changes: 2 additions & 1 deletion src/store/gui/navigation/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) {
Expand All @@ -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')
},
Expand Down
9 changes: 6 additions & 3 deletions src/store/gui/navigation/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand All @@ -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,
}
Expand Down

0 comments on commit 15e1be4

Please sign in to comment.