Skip to content

Commit fde676c

Browse files
committed
feat: Toggle notes list sidebar
Signed-off-by: Enjeck C <[email protected]>
1 parent 3f9aa15 commit fde676c

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/components/CategoriesList.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
<template>
77
<Fragment>
8+
<NcButton @click="onToggleNotesList">
9+
{{ t('notes', 'Toggle Notes List') }}
10+
</NcButton>
811
<NcAppNavigationItem
912
:name="t('notes', 'All notes')"
1013
:class="{ active: selectedCategory === null }"
@@ -47,6 +50,7 @@ import {
4750
NcAppNavigationItem,
4851
NcAppNavigationCaption,
4952
NcCounterBubble,
53+
NcButton,
5054
} from '@nextcloud/vue'
5155
import { Fragment } from 'vue-frag'
5256
@@ -65,6 +69,7 @@ export default {
6569
Fragment,
6670
NcAppNavigationItem,
6771
NcAppNavigationCaption,
72+
NcButton,
6873
NcCounterBubble,
6974
FolderIcon,
7075
FolderOutlineIcon,
@@ -83,9 +88,16 @@ export default {
8388
selectedCategory() {
8489
return store.getters.getSelectedCategory()
8590
},
91+
toggleNotesList() {
92+
return store.getters.getToggleNotesList()
93+
},
8694
},
8795
8896
methods: {
97+
onToggleNotesList() {
98+
store.commit('setToggleNotesList', !this.toggleNotesList)
99+
},
100+
89101
categoryTitle(category) {
90102
return categoryLabel(category)
91103
},

src/components/NotesView.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<template>
77
<NcAppContent pane-config-key="note" :show-details="showNote" @update:showDetails="hideNote">
88
<template slot="list">
9-
<NcAppContentList class="content-list">
9+
<NcAppContentList v-if="!showNotesList" class="content-list">
1010
<div class="content-list__search">
1111
<NcTextField
1212
:value.sync="searchText"
@@ -59,7 +59,6 @@
5959
</template>
6060

6161
<script>
62-
6362
import {
6463
NcAppContent,
6564
NcAppContentList,
@@ -131,6 +130,9 @@ export default {
131130
return this.filteredNotes
132131
}
133132
},
133+
showNotesList() {
134+
return store.state.app.toggleNotesList
135+
},
134136
135137
// group notes by time ("All notes") or by category (if category chosen)
136138
groupedNotes() {

src/store/app.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ const state = {
1111
isManualSave: false,
1212
documentTitle: null,
1313
searchText: '',
14+
toggleNotesList: false,
1415
}
1516

1617
const getters = {
18+
getToggleNotesList: (state) => () => {
19+
return state.toggleNotesList
20+
},
1721
}
1822

1923
const mutations = {
@@ -40,6 +44,10 @@ const mutations = {
4044
updateSearchText(state, searchText) {
4145
state.searchText = searchText
4246
},
47+
48+
setToggleNotesList(state, value) {
49+
state.toggleNotesList = value
50+
},
4351
}
4452

4553
const actions = {

0 commit comments

Comments
 (0)