Skip to content

Commit c9e478e

Browse files
authored
Merge pull request #1021 from nextcloud/three-column-layout-rebased
2 parents 391dae2 + 6e03368 commit c9e478e

15 files changed

+564
-318
lines changed

src/App.vue

Lines changed: 12 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111
</NcAppNavigationNew>
1212

1313
<template #list>
14-
<NavigationList v-show="!loading.notes"
15-
:filtered-notes="filteredNotes"
16-
:category="filter.category"
17-
@category-selected="onSelectCategory"
18-
@note-deleted="onNoteDeleted"
14+
<CategoriesList v-show="!loading.notes"
15+
v-if="numNotes"
1916
/>
2017
</template>
2118

@@ -39,7 +36,7 @@
3936
<p>{{ t('notes', 'Please see Nextcloud server log for details.') }}</p>
4037
</div>
4138
</NcAppContent>
42-
<router-view v-else />
39+
<router-view v-else @note-deleted="onNoteDeleted" />
4340

4441
<router-view name="sidebar" />
4542
</NcContent>
@@ -61,7 +58,7 @@ import PlusIcon from 'vue-material-design-icons/Plus.vue'
6158
import CogIcon from 'vue-material-design-icons/Cog.vue'
6259
6360
import AppSettings from './components/AppSettings.vue'
64-
import NavigationList from './components/NavigationList.vue'
61+
import CategoriesList from './components/CategoriesList.vue'
6562
import EditorHint from './components/Modal/EditorHint.vue'
6663
6764
import { config } from './config.js'
@@ -73,14 +70,14 @@ export default {
7370
7471
components: {
7572
AppSettings,
73+
CategoriesList,
74+
CogIcon,
7675
EditorHint,
77-
NavigationList,
7876
NcAppContent,
7977
NcAppNavigation,
8078
NcAppNavigationNew,
8179
NcAppNavigationItem,
8280
NcContent,
83-
CogIcon,
8481
PlusIcon,
8582
},
8683
@@ -104,37 +101,16 @@ export default {
104101
},
105102
106103
computed: {
104+
numNotes() {
105+
return store.getters.numNotes()
106+
},
107+
107108
notes() {
108109
return store.state.notes.notes
109110
},
110111
111112
filteredNotes() {
112-
const notes = this.notes.filter(note => {
113-
if (this.filter.category !== null
114-
&& this.filter.category !== note.category
115-
&& !note.category.startsWith(this.filter.category + '/')) {
116-
return false
117-
}
118-
return true
119-
})
120-
121-
function cmpRecent(a, b) {
122-
if (a.favorite && !b.favorite) return -1
123-
if (!a.favorite && b.favorite) return 1
124-
return b.modified - a.modified
125-
}
126-
127-
function cmpCategory(a, b) {
128-
const cmpCat = a.category.localeCompare(b.category)
129-
if (cmpCat !== 0) return cmpCat
130-
if (a.favorite && !b.favorite) return -1
131-
if (!a.favorite && b.favorite) return 1
132-
return a.title.localeCompare(b.title)
133-
}
134-
135-
notes.sort(this.filter.category === null ? cmpRecent : cmpCategory)
136-
137-
return notes
113+
return store.getters.getFilteredNotes()
138114
},
139115
},
140116
@@ -255,7 +231,7 @@ export default {
255231
return
256232
}
257233
this.loading.create = true
258-
createNote(this.filter.category)
234+
createNote(store.getters.getSelectedCategory())
259235
.then(note => {
260236
this.routeToNote(note.id, { new: null })
261237
})
@@ -266,15 +242,6 @@ export default {
266242
})
267243
},
268244
269-
onSelectCategory(category) {
270-
this.filter.category = category
271-
272-
const appNavigation = document.querySelector('#app-navigation > ul')
273-
if (appNavigation) {
274-
appNavigation.scrollTop = 0
275-
}
276-
},
277-
278245
onNoteDeleted(note) {
279246
this.deletedNotes.push(note)
280247
this.clearUndoTimer()
Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
<template>
2-
<NcAppNavigationItem
3-
:title="title"
4-
class="app-navigation-noclose separator-below"
5-
:class="{ 'category-header': selectedCategory !== null }"
6-
:open.sync="open"
7-
:allow-collapse="true"
8-
@click.prevent.stop="onToggleCategories"
9-
>
10-
<FolderIcon slot="icon" :size="20" />
2+
<Fragment>
113
<NcAppNavigationItem
124
:title="t('notes', 'All notes')"
5+
:class="{ active: selectedCategory === null }"
136
@click.prevent.stop="onSelectCategory(null)"
147
>
158
<HistoryIcon slot="icon" :size="20" />
@@ -18,9 +11,13 @@
1811
</NcAppNavigationCounter>
1912
</NcAppNavigationItem>
2013

14+
<NcAppNavigationCaption :title="t('notes', 'Categories')" />
15+
2116
<NcAppNavigationItem v-for="category in categories"
2217
:key="category.name"
2318
:title="categoryTitle(category.name)"
19+
:icon="category.name === '' ? 'icon-emptyfolder' : 'icon-files'"
20+
:class="{ active: category.name === selectedCategory }"
2421
@click.prevent.stop="onSelectCategory(category.name)"
2522
>
2623
<FolderOutlineIcon v-if="category.name === ''" slot="icon" :size="20" />
@@ -29,14 +26,16 @@
2926
{{ category.count }}
3027
</NcAppNavigationCounter>
3128
</NcAppNavigationItem>
32-
</NcAppNavigationItem>
29+
</Fragment>
3330
</template>
3431

3532
<script>
3633
import {
3734
NcAppNavigationItem,
35+
NcAppNavigationCaption,
3836
NcAppNavigationCounter,
3937
} from '@nextcloud/vue'
38+
import { Fragment } from 'vue-fragment'
4039
4140
import FolderIcon from 'vue-material-design-icons/Folder.vue'
4241
import FolderOutlineIcon from 'vue-material-design-icons/FolderOutline.vue'
@@ -47,27 +46,16 @@ import { categoryLabel } from '../Util.js'
4746
import store from '../store.js'
4847
4948
export default {
50-
name: 'NavigationCategoriesItem',
49+
name: 'CategoriesList',
5150
5251
components: {
52+
Fragment,
53+
NcAppNavigationItem,
54+
NcAppNavigationCaption,
55+
NcAppNavigationCounter,
5356
FolderIcon,
5457
FolderOutlineIcon,
5558
HistoryIcon,
56-
NcAppNavigationItem,
57-
NcAppNavigationCounter,
58-
},
59-
60-
props: {
61-
selectedCategory: {
62-
type: String,
63-
default: null,
64-
},
65-
},
66-
67-
data() {
68-
return {
69-
open: false,
70-
}
7159
},
7260
7361
computed: {
@@ -79,8 +67,8 @@ export default {
7967
return getCategories(1, true)
8068
},
8169
82-
title() {
83-
return this.selectedCategory === null ? this.t('notes', 'Categories') : categoryLabel(this.selectedCategory)
70+
selectedCategory() {
71+
return store.getters.getSelectedCategory()
8472
},
8573
},
8674
@@ -89,19 +77,14 @@ export default {
8977
return categoryLabel(category)
9078
},
9179
92-
onToggleCategories() {
93-
this.open = !this.open
94-
},
95-
9680
onSelectCategory(category) {
97-
this.open = false
98-
this.$emit('category-selected', category)
81+
store.commit('setSelectedCategory', category)
9982
},
10083
},
10184
}
10285
</script>
10386
<style scoped>
104-
.separator-below {
105-
border-bottom: 1px solid var(--color-border);
87+
.app-navigation-entry-wrapper.active:deep(.app-navigation-entry) {
88+
background-color: var(--color-primary-light) !important;
10689
}
10790
</style>

src/components/EditorEasyMDE.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,5 +374,6 @@ export default {
374374
z-index: 10;
375375
height: 40px;
376376
margin-right: 5px;
377+
top: 65px;
377378
}
378379
</style>

src/components/HelpMobile.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
{{ t('notes', 'Install the app for your mobile phone in order to access your notes from everywhere.') }}
55
</div>
66
<div class="badge-wrapper">
7-
<a target="_blank" href="https://github.com/stefan-niedermann/nextcloud-notes">
8-
{{ t('notes', 'Android app: {notes} by {company}', {notes: 'Nextcloud Notes', company: 'Niedermann IT-Dienstleistungen'}) }}
7+
<a target="_blank" href="https://github.com/nextcloud/nextcloud-notes">
8+
{{ t('notes', 'Android app: {notes}', {notes: 'Nextcloud Notes'}) }}
99
</a>
1010
<div>
1111
<div class="badge">
@@ -22,11 +22,11 @@
2222
</div>
2323
<div class="badge-wrapper">
2424
<a target="_blank" href="https://github.com/phedlund/CloudNotes">
25-
{{ t('notes', 'iOS app: {notes} by {company}', {notes: 'CloudNotes - Nextcloud Notes', company: 'Peter Hedlund'}) }}
25+
{{ t('notes', 'iOS app: {notes}', {notes: 'Nextcloud Notes'}) }}
2626
</a>
2727
<div>
2828
<div class="badge">
29-
<a target="_blank" href="https://apps.apple.com/app/cloudnotes-owncloud-notes/id813973264">
29+
<a target="_blank" href="https://apps.apple.com/app/nextcloud-notes/id813973264">
3030
<img :src="getRoute('badge_applestore.svg')" class="appstore-badge badge-playstore-fix">
3131
</a>
3232
</div>

0 commit comments

Comments
 (0)