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:
Gorjan Petrovski
2021-09-22 15:56:34 +02:00
committed by GitHub
parent 77525a56cd
commit 7b5b78832a
8 changed files with 97 additions and 8 deletions

View File

@@ -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;
}
}