From 18bf700936971bc3b2b0b2874367b237d8bf666b Mon Sep 17 00:00:00 2001 From: Nikolay Lopin Date: Wed, 14 Feb 2018 23:35:11 +0300 Subject: [PATCH] Show pinned notes in All notes view and allow to pin them there All restrictions of pin functionality were removed. Now user can see pinned notes and also pin notes right from 'home'. Technically, a note still pins to the storage it belong. #1506 --- browser/components/NoteItem.js | 2 +- browser/components/NoteItemSimple.js | 2 +- browser/main/NoteList/index.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/browser/components/NoteItem.js b/browser/components/NoteItem.js index 3e703f18..31769abf 100644 --- a/browser/components/NoteItem.js +++ b/browser/components/NoteItem.js @@ -73,7 +73,7 @@ const NoteItem = ({ isActive, note, dateDisplay, handleNoteClick, handleNoteCont {note.isStarred ? : '' } - {note.isPinned && !pathname.match(/\/home|\/starred|\/trash/) + {note.isPinned && !pathname.match(/\/starred|\/trash/) ? : '' } {note.type === 'MARKDOWN_NOTE' diff --git a/browser/components/NoteItemSimple.js b/browser/components/NoteItemSimple.js index 77ff2d80..6b0dd4e0 100644 --- a/browser/components/NoteItemSimple.js +++ b/browser/components/NoteItemSimple.js @@ -30,7 +30,7 @@ const NoteItemSimple = ({ isActive, note, handleNoteClick, handleNoteContextMenu ? : } - {note.isPinned && !pathname.match(/\/home|\/starred|\/trash/) + {note.isPinned && !pathname.match(/\/starred|\/trash/) ? : '' } diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 30317095..8358a44f 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -442,7 +442,7 @@ class NoteList extends React.Component { const cloneNote = 'Clone Note' const menu = new Menu() - if (!location.pathname.match(/\/home|\/starred|\/trash/)) { + if (!location.pathname.match(/\/starred|\/trash/)) { menu.append(new MenuItem({ label: pinLabel, click: this.pinToTop @@ -687,7 +687,7 @@ class NoteList extends React.Component { : config.sortBy === 'ALPHABETICAL' ? sortByAlphabetical : sortByUpdatedAt - const sortedNotes = location.pathname.match(/\/home|\/starred|\/trash/) + const sortedNotes = location.pathname.match(/\/starred|\/trash/) ? this.getNotes().sort(sortFunc) : this.sortByPin(this.getNotes().sort(sortFunc)) this.notes = notes = sortedNotes.filter((note) => {