diff --git a/src/components/Main.vue b/src/components/Boards.vue
similarity index 84%
rename from src/components/Main.vue
rename to src/components/Boards.vue
index a50d96fe2..68f8fe9c9 100644
--- a/src/components/Main.vue
+++ b/src/components/Boards.vue
@@ -22,13 +22,24 @@
- Main
+ Boards
diff --git a/src/router.js b/src/router.js
index 0b0847a20..811e02f90 100644
--- a/src/router.js
+++ b/src/router.js
@@ -23,8 +23,9 @@
import Vue from 'vue'
import Router from 'vue-router'
import { generateUrl } from 'nextcloud-server/dist/router'
+import { BOARD_FILTERS } from './store/modules/nav'
-const Main = () => import('./components/Main')
+const Boards = () => import('./components/Boards')
Vue.use(Router)
@@ -35,17 +36,31 @@ export default new Router({
{
path: '/',
name: 'main',
- component: Main
+ component: Boards
},
{
path: '/boards',
name: 'boards',
- component: Main
+ component: Boards,
+ props: {
+ navFilter: BOARD_FILTERS.ALL
+ }
},
{
path: '/boards/archived',
name: 'boards.archived',
- component: Main
+ component: Boards,
+ props: {
+ navFilter: BOARD_FILTERS.ARCHIVED
+ }
+ },
+ {
+ path: '/boards/shared',
+ name: 'boards.shared',
+ component: Boards,
+ props: {
+ navFilter: BOARD_FILTERS.SHARED
+ }
}
]
})
diff --git a/src/store/modules/nav.js b/src/store/modules/nav.js
index e86b1790e..723e99216 100644
--- a/src/store/modules/nav.js
+++ b/src/store/modules/nav.js
@@ -20,6 +20,8 @@
*
*/
+// eslint
+
import { translate as t } from 'nextcloud-server/dist/l10n'
import axios from 'nextcloud-axios'
@@ -112,16 +114,31 @@ const addButton = {
const state = {
hidden: false,
boards: [],
- loading: false
+ loading: false,
+ filter: ''
+}
+
+export const BOARD_FILTERS = {
+ ALL: '',
+ ARCHIVED: 'archived',
+ SHARED: 'shared'
}
// getters
const getters = {
menu: state => {
+
+ // filters the boards depending on the active filter
+ const boards = state.boards.filter(board => {
+ return state.filter === BOARD_FILTERS.ALL
+ || (state.filter === BOARD_FILTERS.ARCHIVED && board.archived === true)
+ || (state.filter === BOARD_FILTERS.SHARED && board.shared === 1)
+ })
+
return {
loading: state.loading,
items: defaultCategories
- .concat(state.boards.map(mapBoardToItem))
+ .concat(boards.map(mapBoardToItem))
.concat([addButton])
}
}
@@ -147,6 +164,9 @@ const mutations = {
},
setBoards(state, boards) {
state.boards = boards
+ },
+ setFilter(state, filter) {
+ state.filter = filter
}
}