Skip to content

Commit 5e4cd63

Browse files
committed
fix(gantt): set viewMode per board
Signed-off-by: grnd-alt <git@belakkaf.net>
1 parent c8d2ca7 commit 5e4cd63

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

src/components/Controls.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,14 +347,14 @@ export default {
347347
...mapGetters([
348348
'canEdit',
349349
'canManage',
350+
'viewMode',
350351
]),
351352
...mapState({
352353
isFullApp: state => state.isFullApp,
353354
compactMode: state => state.compactMode,
354355
showCardCover: state => state.showCardCover,
355356
searchQuery: state => state.searchQuery,
356357
showArchived: state => state.showArchived,
357-
viewMode: state => state.viewMode,
358358
}),
359359
detailsRoute() {
360360
return {

src/components/board/Board.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ export default {
140140
isFullApp: state => state.isFullApp,
141141
board: state => state.currentBoard,
142142
showArchived: state => state.showArchived,
143-
viewMode: state => state.viewMode,
144143
}),
145144
...mapGetters([
146145
'canEdit',
147146
'canManage',
147+
'viewMode',
148148
]),
149149
stacksByBoard() {
150150
return this.board?.id ? this.$store.getters.stacksByBoard(this.board.id) : []

src/components/board/GanttView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ export default {
197197
],
198198
}
199199
},
200-
computed: {
201-
...mapGetters(['cardsByStack', 'canEdit']),
200+
computed: {
201+
...mapGetters(['cardsByStack', 'canEdit']),
202202
partitionedCards() {
203203
const undatedCards = []
204204
const ganttTasks = []

src/store/main.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default function storeFactory() {
6262
activityLoadMore: true,
6363
filter: { tags: [], users: [], due: '', unassigned: false, completed: 'both' },
6464
shortcutLock: false,
65-
viewMode: localStorage.getItem('deck.viewMode') || 'kanban',
65+
viewModeByBoard: {},
6666
},
6767
getters: {
6868
config: state => (key) => {
@@ -75,6 +75,15 @@ export default function storeFactory() {
7575
getSearchQuery: state => {
7676
return state.searchQuery
7777
},
78+
viewMode: state => {
79+
if (!state.currentBoard) return "kanban"
80+
if (state.viewModeByBoard[state.currentBoard.id] !== undefined) {
81+
return state.viewModeByBoard[state.currentBoard.id]
82+
}
83+
84+
const stored = localStorage.getItem(`deck.viewMode.${state.currentBoard.id}`)
85+
return stored !== null ? stored : "kanban"
86+
},
7887
getFilter: state => {
7988
return state.filter
8089
},
@@ -304,8 +313,9 @@ export default function storeFactory() {
304313
state.shortcutLock = lock
305314
},
306315
setViewMode(state, mode) {
307-
state.viewMode = mode
308-
localStorage.setItem('deck.viewMode', mode)
316+
if (!state.currentBoard) return
317+
Vue.set(state.viewModeByBoard, state.currentBoard.id, mode)
318+
localStorage.setItem(`deck.viewMode.${state.currentBoard.id}`, mode)
309319
},
310320
},
311321
actions: {

0 commit comments

Comments
 (0)