From d2b34a481ff3f87d6fc84dbebc88b57366351103 Mon Sep 17 00:00:00 2001 From: Joachim von Eichborn Date: Sat, 17 Sep 2022 22:25:11 +0200 Subject: [PATCH 01/10] Three column layout Signed-off-by: Joachim von Eichborn --- src/App.vue | 55 ++---- ...nCategoriesItem.vue => CategoriesList.vue} | 53 ++---- src/components/EditorEasyMDE.vue | 1 + src/components/NavigationNoteItem.vue | 168 ------------------ src/components/NoteItem.vue | 83 +++++++++ src/components/NotesCaption.vue | 33 ++++ src/components/NotesList.vue | 34 ++++ .../{NavigationList.vue => NotesView.vue} | 168 +++++++++++------- src/components/Sidebar.vue | 47 ++++- src/router.js | 4 +- src/store/notes.js | 47 +++++ 11 files changed, 376 insertions(+), 317 deletions(-) rename src/components/{NavigationCategoriesItem.vue => CategoriesList.vue} (65%) delete mode 100644 src/components/NavigationNoteItem.vue create mode 100644 src/components/NoteItem.vue create mode 100644 src/components/NotesCaption.vue create mode 100644 src/components/NotesList.vue rename src/components/{NavigationList.vue => NotesView.vue} (54%) diff --git a/src/App.vue b/src/App.vue index d3bfc9490..ef16cf08a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,11 +11,8 @@ @@ -39,7 +36,7 @@

{{ t('notes', 'Please see Nextcloud server log for details.') }}

- + @@ -61,8 +58,8 @@ import PlusIcon from 'vue-material-design-icons/Plus.vue' import CogIcon from 'vue-material-design-icons/Cog.vue' import AppSettings from './components/AppSettings.vue' -import NavigationList from './components/NavigationList.vue' import EditorHint from './components/Modal/EditorHint.vue' +import CategoriesList from './components/CategoriesList.vue' import { config } from './config.js' import { fetchNotes, noteExists, createNote, undoDeleteNote } from './NotesService.js' @@ -74,7 +71,6 @@ export default { components: { AppSettings, EditorHint, - NavigationList, NcAppContent, NcAppNavigation, NcAppNavigationNew, @@ -82,6 +78,7 @@ export default { NcContent, CogIcon, PlusIcon, + CategoriesList, }, data() { @@ -104,37 +101,16 @@ export default { }, computed: { + numNotes() { + return store.getters.numNotes() + }, + notes() { return store.state.notes.notes }, filteredNotes() { - const notes = this.notes.filter(note => { - if (this.filter.category !== null - && this.filter.category !== note.category - && !note.category.startsWith(this.filter.category + '/')) { - return false - } - return true - }) - - function cmpRecent(a, b) { - if (a.favorite && !b.favorite) return -1 - if (!a.favorite && b.favorite) return 1 - return b.modified - a.modified - } - - function cmpCategory(a, b) { - const cmpCat = a.category.localeCompare(b.category) - if (cmpCat !== 0) return cmpCat - if (a.favorite && !b.favorite) return -1 - if (!a.favorite && b.favorite) return 1 - return a.title.localeCompare(b.title) - } - - notes.sort(this.filter.category === null ? cmpRecent : cmpCategory) - - return notes + return store.getters.getFilteredNotes() }, }, @@ -255,7 +231,7 @@ export default { return } this.loading.create = true - createNote(this.filter.category) + createNote(store.getters.getSelectedCategory()) .then(note => { this.routeToNote(note.id, { new: null }) }) @@ -266,15 +242,6 @@ export default { }) }, - onSelectCategory(category) { - this.filter.category = category - - const appNavigation = document.querySelector('#app-navigation > ul') - if (appNavigation) { - appNavigation.scrollTop = 0 - } - }, - onNoteDeleted(note) { this.deletedNotes.push(note) this.clearUndoTimer() diff --git a/src/components/NavigationCategoriesItem.vue b/src/components/CategoriesList.vue similarity index 65% rename from src/components/NavigationCategoriesItem.vue rename to src/components/CategoriesList.vue index ab324a6a1..831fa5e7f 100644 --- a/src/components/NavigationCategoriesItem.vue +++ b/src/components/CategoriesList.vue @@ -1,15 +1,9 @@ - diff --git a/src/components/EditorEasyMDE.vue b/src/components/EditorEasyMDE.vue index e1dc35690..bb3b55f49 100644 --- a/src/components/EditorEasyMDE.vue +++ b/src/components/EditorEasyMDE.vue @@ -374,5 +374,6 @@ export default { z-index: 10; height: 40px; margin-right: 5px; + top: 65px; } diff --git a/src/components/NavigationNoteItem.vue b/src/components/NavigationNoteItem.vue deleted file mode 100644 index e222d64cc..000000000 --- a/src/components/NavigationNoteItem.vue +++ /dev/null @@ -1,168 +0,0 @@ - - - diff --git a/src/components/NoteItem.vue b/src/components/NoteItem.vue new file mode 100644 index 000000000..45c144884 --- /dev/null +++ b/src/components/NoteItem.vue @@ -0,0 +1,83 @@ + + + diff --git a/src/components/NotesCaption.vue b/src/components/NotesCaption.vue new file mode 100644 index 000000000..85dd3d5b8 --- /dev/null +++ b/src/components/NotesCaption.vue @@ -0,0 +1,33 @@ + + + + + diff --git a/src/components/NotesList.vue b/src/components/NotesList.vue new file mode 100644 index 000000000..5b7124b5f --- /dev/null +++ b/src/components/NotesList.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/components/NavigationList.vue b/src/components/NotesView.vue similarity index 54% rename from src/components/NavigationList.vue rename to src/components/NotesView.vue index 9862aa984..edbe8fad8 100644 --- a/src/components/NavigationList.vue +++ b/src/components/NotesView.vue @@ -1,62 +1,68 @@ + + diff --git a/src/components/NotesView.vue b/src/components/NotesView.vue index edbe8fad8..4daa9ce98 100644 --- a/src/components/NotesView.vue +++ b/src/components/NotesView.vue @@ -1,7 +1,7 @@