feat: implement encrypted items info (#641)
* feat: implement encrypted items info * Update app/assets/javascripts/ui_models/app_state/account_menu_state.ts Co-authored-by: Mo Bitar <mo@standardnotes.org> * Update app/assets/javascripts/ui_models/app_state/account_menu_state.ts Co-authored-by: Mo Bitar <mo@standardnotes.org> * Update app/assets/javascripts/preferences/panes/EndToEndEncryption.tsx Co-authored-by: Mo Bitar <mo@standardnotes.org> * Update app/assets/javascripts/preferences/panes/EndToEndEncryption.tsx Co-authored-by: Mo Bitar <mo@standardnotes.org> Co-authored-by: Mo Bitar <mo@standardnotes.org>
This commit is contained in:
@@ -3,6 +3,9 @@ import { ApplicationEvent, ContentType } from '@standardnotes/snjs';
|
||||
import { WebApplication } from '@/ui_models/application';
|
||||
import { SNItem } from '@standardnotes/snjs/dist/@types/models/core/item';
|
||||
|
||||
type StructuredItemsCount =
|
||||
{ notes: number, tags: number, deleted: number, archived: number };
|
||||
|
||||
export class AccountMenuState {
|
||||
show = false;
|
||||
signingOut = false;
|
||||
@@ -116,4 +119,27 @@ export class AccountMenuState {
|
||||
get notesAndTagsCount(): number {
|
||||
return this.notesAndTags.length;
|
||||
}
|
||||
|
||||
get structuredNotesAndTagsCount(): StructuredItemsCount {
|
||||
const count: StructuredItemsCount = { notes: 0, archived: 0, deleted: 0, tags: 0 };
|
||||
for (const item of this.notesAndTags) {
|
||||
if (item.archived) {
|
||||
count.archived++;
|
||||
}
|
||||
|
||||
if (item.trashed) {
|
||||
count.deleted++;
|
||||
}
|
||||
|
||||
if (item.content_type === ContentType.Note) {
|
||||
count.notes++;
|
||||
}
|
||||
|
||||
if (item.content_type === ContentType.Tag) {
|
||||
count.tags++;
|
||||
}
|
||||
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user