diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 5428d3fe4..62219de98 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -25,7 +25,7 @@ - Added React Hooks ESLint Plugin [#1789](https://github.com/Automattic/simplenote-electron/pull/1789) - Added end-to-end testing with Spectron [#1773](https://github.com/Automattic/simplenote-electron/pull/1773) - Removed a workaround for indexing note pinned status [#1795](https://github.com/Automattic/simplenote-electron/pull/1795) -- Maintenance cleanups [#1796](https://github.com/Automattic/simplenote-electron/pull/1796), [#1797](https://github.com/Automattic/simplenote-electron/pull/1797), [#1808](https://github.com/Automattic/simplenote-electron/pull/1808), [#1809](https://github.com/Automattic/simplenote-electron/pull/1809) +- Maintenance cleanups [#1796](https://github.com/Automattic/simplenote-electron/pull/1796), [#1797](https://github.com/Automattic/simplenote-electron/pull/1797), [#1808](https://github.com/Automattic/simplenote-electron/pull/1808), [#1809](https://github.com/Automattic/simplenote-electron/pull/1809), [#1810](https://github.com/Automattic/simplenote-electron/pull/1810) - Updated dependencies [#1802](https://github.com/Automattic/simplenote-electron/pull/1802) ## [v1.13.0] diff --git a/lib/note-list/index.jsx b/lib/note-list/index.jsx index f0c3fa9dd..5e3180627 100644 --- a/lib/note-list/index.jsx +++ b/lib/note-list/index.jsx @@ -115,12 +115,12 @@ const rowHeightCache = f => ( const note = notes[index]; // handle special sections - switch (note.type) { - case 'header': + switch (note) { + case 'notes-header': return HEADER_HEIGHT; case 'tag-suggestions': return HEADER_HEIGHT + TAG_ROW_HEIGHT * tagResultsFound; - case 'empty': + case 'no-notes': return EMPTY_DIV_HEIGHT; } @@ -206,11 +206,11 @@ const renderNote = ( const note = notes['undefined' === typeof index ? rowIndex : index]; // handle special sections - switch (note.type) { - case 'header': + switch (note) { + case 'notes-header': return (
- {note.data} + Notes
); case 'tag-suggestions': @@ -219,10 +219,10 @@ const renderNote = ( ); - case 'empty': + case 'no-notes': return (
- {note.data} + No Notes
); } @@ -285,24 +285,15 @@ const renderNote = ( * @returns {Object[]} modified notes list */ const createCompositeNoteList = (notes, filter, tagResultsFound) => { - if (filter.length > 0 && tagResultsFound > 0) { - if (notes.length === 0) { - notes.push({ - type: 'empty', - data: 'No Notes', - }); - } - - notes.unshift({ - type: 'header', - data: 'Notes', - }); - notes.unshift({ - type: 'tag-suggestions', - data: 'Tag Suggestions', - }); + if (filter.length === 0 || tagResultsFound === 0) { + return notes; } - return notes; + + return [ + 'tag-suggestions', + 'notes-header', + ...(notes.length > 0 ? notes : ['no-notes']), + ]; }; export class NoteList extends Component {