Adds the boards list view

This commit is contained in:
Michael Weimann
2018-12-05 04:57:01 +01:00
parent 8c94da81f1
commit 922aaf31d8
3 changed files with 144 additions and 3 deletions

View File

@@ -21,20 +21,38 @@
--> -->
<template> <template>
<div class="deck-main"> <div class="board-list">
Boards <div class="board-list-row board-list-header-row">
<div class="board-list-bullet-cell"><div class="board-list-bullet" /></div>
<div class="board-list-title-cell">Title</div>
<div class="board-list-avatars-cell">Members</div>
<div class="board-list-actions-cell" />
</div>
<BoardItem v-for="board in boards" :key="board.id" :board="board" />
</div> </div>
</template> </template>
<script> <script>
import BoardItem from './boards/BoardItem'
import { mapGetters } from 'vuex'
export default { export default {
name: 'Main', name: 'Main',
components: {
BoardItem
},
props: { props: {
navFilter: { navFilter: {
type: String, type: String,
default: '' default: ''
} }
}, },
computed: {
...mapGetters('nav', [
'boards'
])
},
watch: { watch: {
navFilter: function(value) { navFilter: function(value) {
this.$store.commit('nav/setFilter', value) this.$store.commit('nav/setFilter', value)
@@ -43,5 +61,42 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss">
.board-list {
.board-list-row {
align-items: center;
border-bottom: 1px solid #ededed;
display: flex;
}
.board-list-header-row {
color: var(--color-text-lighter);
}
.board-list-bullet-cell,
.board-list-avatars-cell {
padding: 6px 15px;
}
.board-list-avatars-cell {
flex: 0 0 50px;
}
.board-list-avatar,
.board-list-bullet {
height: 32px;
width: 32px;
}
.board-list-title-cell {
flex: 1 0 auto;
padding: 15px;
}
.board-list-actions-cell {
// placeholder
flex: 0 0 50px;
}
}
</style> </style>

View File

@@ -0,0 +1,75 @@
<!--
* @copyright Copyright (c) 2018 Michael Weimann <mail@michael-weimann.eu>
*
* @author Michael Weimann <mail@michael-weimann.eu>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
-->
<template>
<div class="board-list-row">
<div class="board-list-bullet-cell">
<div :style="{ 'background-color': board.bullet }" class="board-list-bullet" />
</div>
<div class="board-list-title-cell">{{ board.text }}</div>
<div class="board-list-avatars-cell">
<img :src="`/avatar/${board.owner.uid}/32`" class="board-list-avatar">
</div>
<div class="board-list-actions-cell" />
</div>
</template>
<script>
export default {
name: 'BoardItem',
props: {
board: {
type: Object,
default: () => { return {} }
}
}
}
</script>
<style lang="scss" scoped>
.board-list-bullet-cell {
padding: 6px 15px;
.board-list-bullet {
border-radius: 50%;
cursor: pointer;
height: 32px;
width: 32px;
}
}
.board-list-title-cell {
padding: 0 15px;
}
.board-list-avatars-cell {
padding: 6px 15px;
.board-list-avatar {
border-radius: 50%;
height: 32px;
width: 32px;
}
}
</style>

View File

@@ -36,6 +36,7 @@ const mapBoardToItem = board => {
classes: [], classes: [],
bullet: `#${board.color}`, bullet: `#${board.color}`,
text: board.title, text: board.title,
owner: board.owner,
router: { router: {
name: 'board', name: 'board',
params: { id: board.id } params: { id: board.id }
@@ -141,6 +142,16 @@ const getters = {
.concat(boards.map(mapBoardToItem)) .concat(boards.map(mapBoardToItem))
.concat([addButton]) .concat([addButton])
} }
},
boards: 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 boards.map(mapBoardToItem)
} }
} }