diff --git a/browser/components/NoteItem.js b/browser/components/NoteItem.js index e55db70a..7abb86b9 100644 --- a/browser/components/NoteItem.js +++ b/browser/components/NoteItem.js @@ -48,14 +48,15 @@ const TagElementList = (tags) => { */ const NoteItem = ({ isActive, - isAllNotesView, note, dateDisplay, handleNoteClick, handleNoteContextMenu, handleDragStart, pathname, - storage + storageName, + folderName, + viewType }) => (
Empty }
- {isAllNotesView &&
+ {['ALL', 'STORAGE'].includes(viewType) &&
{dateDisplay}
- {storage.name} + {viewType === 'ALL' && storageName} + {viewType === 'STORAGE' && folderName}
diff --git a/browser/main/NoteList/index.js b/browser/main/NoteList/index.js index 8ec64ec8..6ba45faa 100644 --- a/browser/main/NoteList/index.js +++ b/browser/main/NoteList/index.js @@ -67,6 +67,8 @@ class NoteList extends React.Component { this.focusNote = this.focusNote.bind(this) this.pinToTop = this.pinToTop.bind(this) this.getNoteStorage = this.getNoteStorage.bind(this) + this.getNoteFolder = this.getNoteFolder.bind(this) + this.getViewType = this.getViewType.bind(this) // TODO: not Selected noteKeys but SelectedNote(for reusing) this.state = { @@ -696,6 +698,20 @@ class NoteList extends React.Component { return this.props.data.storageMap.toJS()[note.storage] } + getNoteFolder (note) { // note.folder = folder key + return _.find(this.getNoteStorage(note).folders, ({ key }) => key === note.folder) + } + + getViewType () { + const { pathname } = this.props.location + const folder = /\/folders\/[a-zA-Z0-9]+/.test(pathname) + const storage = /\/storages\/[a-zA-Z0-9]+/.test(pathname) && !folder + const allNotes = pathname === '/home' + if (allNotes) return 'ALL' + if (folder) return 'FOLDER' + if (storage) return 'STORAGE' + } + render () { const { location, config } = this.props let { notes } = this.props @@ -750,7 +766,6 @@ class NoteList extends React.Component { return ( ) } @@ -766,14 +783,15 @@ class NoteList extends React.Component { return ( ) })