From b2dc6e5218c49f50615bc051854ab795a2ecddd3 Mon Sep 17 00:00:00 2001 From: Max G Date: Tue, 30 Jul 2019 20:27:26 +0000 Subject: [PATCH] Big Refactor of all SQL calls to comply with database changes Added tag suggestions when entering tag field Cleaned up animations to make them REAL smooth --- client/src/components/NoteInputPanel.vue | 8 +-- client/src/components/NoteTagEdit.vue | 22 ++++++- .../src/components/NoteTitleDisplayCard.vue | 31 ++++----- client/src/pages/NotesPage.vue | 2 +- server/models/Note.js | 65 ++++++++----------- server/models/Tag.js | 48 ++++++++++---- server/models/User.js | 6 +- server/routes/tagController.js | 6 ++ 8 files changed, 111 insertions(+), 77 deletions(-) diff --git a/client/src/components/NoteInputPanel.vue b/client/src/components/NoteInputPanel.vue index 21a0066..1c1ce50 100644 --- a/client/src/components/NoteInputPanel.vue +++ b/client/src/components/NoteInputPanel.vue @@ -232,7 +232,7 @@ setTimeout(() => { resolve(true) return - }, 500) + }, 300) } const postData = { @@ -256,7 +256,7 @@ vm.lastNoteHash = vm.hashString(vm.noteText) resolve(true) }) - }, 500) + }, 300) }) }, @@ -335,7 +335,7 @@ } .size-down { - animation: size-down 0.5s linear both; + animation: size-down 0.5s ease; } @keyframes size-down { @@ -345,7 +345,7 @@ } 100% { opacity: 0; - top: 405vh; + top: 30vh; } } diff --git a/client/src/components/NoteTagEdit.vue b/client/src/components/NoteTagEdit.vue index f2a7742..8a0506f 100644 --- a/client/src/components/NoteTagEdit.vue +++ b/client/src/components/NoteTagEdit.vue @@ -4,10 +4,13 @@ {{ucWords(tag.text)}}
-
@@ -70,7 +73,6 @@ if(this.selection >= this.suggestions.length){ this.selection = -1 //No selection made } - console.log('Current Selection Index: ', this.selection) return } //Down - 40 - Go Down Suggestion @@ -79,7 +81,6 @@ if(this.selection < -1){ this.selection = this.suggestions.length -1 //No selection made } - console.log('Current Selection Index: ', this.selection) return; } @@ -137,7 +138,22 @@ vm.getTags() }) }, + onFocus(){ + console.log('Focused on tag edit') + //Show suggested tags + let vm = this + let postData = { + 'noteId':this.noteId + } + axios.post('/api/tag/latest', postData) + .then(response => { + + vm.suggestions = response.data + vm.selection = -1 //Nothing selected + }) + }, onKeyup(){ + //Clear tags if backspaced if(this.newTagInput == ''){ this.clearSuggestions() } diff --git a/client/src/components/NoteTitleDisplayCard.vue b/client/src/components/NoteTitleDisplayCard.vue index 27d0d5d..669fead 100644 --- a/client/src/components/NoteTitleDisplayCard.vue +++ b/client/src/components/NoteTitleDisplayCard.vue @@ -28,22 +28,22 @@
-
+ +
+

Note Text

+
+
+
+

Note URL Text

+
+
+
+ Tag +
+
- -
-

Note Text

-
-
-
-

Note URL Text

-
-
-
- Tag -
-
+ @@ -77,8 +77,9 @@