fix: restore showing tags in the notes view

This commit is contained in:
Baptiste Grob
2020-10-23 11:17:17 +02:00
parent 27affa4cee
commit 54ed0bdabb
4 changed files with 31 additions and 5 deletions

View File

@@ -94,6 +94,13 @@
faded="self.state.hideDate"
label="'Date'"
)
menu-row(
action="self.selectedMenuItem(); self.toggleWebPrefKey('hideTags')"
circle="self.state.hideTags ? 'danger' : 'success'"
desc="'Hide the list of tags associated with each note'"
faded="self.state.hideTags"
label="'Tags'"
)
p.empty-notes-list.faded(
ng-if="self.state.completedFullSync && !self.state.renderedNotes.length"
) No notes.
@@ -137,6 +144,8 @@
| Modified {{note.updatedAtString || 'Now'}}
span(ng-show="self.state.sortBy != 'userModifiedDate'")
| {{note.createdAtString || 'Now'}}
.tags-string(ng-if='!self.state.hideTags && self.state.renderedNotesTags[$index]')
.faded {{self.state.renderedNotesTags[$index]}}
panel-resizer(
collapsable="true"

View File

@@ -26,12 +26,14 @@ type NotesState = {
panelTitle: string
notes?: SNNote[]
renderedNotes: SNNote[]
renderedNotesTags: string[],
sortBy?: string
sortReverse?: boolean
showArchived?: boolean
hidePinned?: boolean
hideNotePreview?: boolean
hideDate?: boolean
hideTags: boolean
noteFilter: { text: string }
mutable: { showMenu: boolean }
completedFullSync: boolean
@@ -124,10 +126,12 @@ class NotesViewCtrl extends PureViewCtrl<{}, NotesState> {
return {
notes: [],
renderedNotes: [],
renderedNotesTags: [],
mutable: { showMenu: false },
noteFilter: { text: '' },
panelTitle: '',
completedFullSync: false,
hideTags: true,
};
}
@@ -352,9 +356,17 @@ class NotesViewCtrl extends PureViewCtrl<{}, NotesState> {
return;
}
const notes = this.application.getDisplayableItems(ContentType.Note) as SNNote[];
let renderedNotes = notes.slice(0, this.notesToDisplay);
const renderedNotes = notes.slice(0, this.notesToDisplay);
const renderedNotesTags = this.state.hideTags
? []
: renderedNotes.map((note) =>
this.appState.getNoteTags(note)
.map(tag => "#" + tag.title)
.join(" ")
);
await this.setNotesState({
notes,
renderedNotesTags,
renderedNotes,
});
this.reloadPanelTitle();
@@ -413,12 +425,17 @@ class NotesViewCtrl extends PureViewCtrl<{}, NotesState> {
WebPrefKey.NotesHideDate,
false
);
viewOptions.hideTags = this.application.getPrefsService().getValue(
WebPrefKey.NotesHideTags,
true,
);
const state = this.getState();
const displayOptionsChanged = (
viewOptions.sortBy !== state.sortBy ||
viewOptions.sortReverse !== state.sortReverse ||
viewOptions.hidePinned !== state.hidePinned ||
viewOptions.showArchived !== state.showArchived
viewOptions.showArchived !== state.showArchived ||
viewOptions.hideTags !== state.hideTags
);
await this.setNotesState({
...viewOptions

4
package-lock.json generated
View File

@@ -10961,8 +10961,8 @@
"from": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad"
},
"snjs": {
"version": "github:standardnotes/snjs#8aafecd58a2ec889414cf21c0425b8df4ae43538",
"from": "github:standardnotes/snjs#8aafecd58a2ec889414cf21c0425b8df4ae43538"
"version": "github:standardnotes/snjs#c0ebfffae2c6c380b62aa080bac073a886e0d0a8",
"from": "github:standardnotes/snjs#c0ebfffae2c6c380b62aa080bac073a886e0d0a8"
},
"sockjs": {
"version": "0.3.20",

View File

@@ -71,6 +71,6 @@
"dependencies": {
"mobx": "^6.0.1",
"sncrypto": "github:standardnotes/sncrypto#8794c88daa967eaae493cd5fdec7506d52b257ad",
"snjs": "github:standardnotes/snjs#8aafecd58a2ec889414cf21c0425b8df4ae43538"
"snjs": "github:standardnotes/snjs#c0ebfffae2c6c380b62aa080bac073a886e0d0a8"
}
}