feat: starred notes (#1813)

This commit is contained in:
Mo
2022-10-17 10:22:58 -05:00
committed by GitHub
parent 0082a76b19
commit d52fdae0b3
10 changed files with 84 additions and 18 deletions

View File

@@ -13,6 +13,7 @@ export interface ItemContent {
trashed?: boolean
pinned?: boolean
archived?: boolean
starred?: boolean
locked?: boolean
appData?: AppData
}

View File

@@ -21,6 +21,7 @@ export class DecryptedItem<C extends ItemContent = ItemContent>
public readonly pinned: boolean = false
public readonly archived: boolean = false
public readonly locked: boolean = false
public readonly starred: boolean = false
constructor(payload: DecryptedPayloadInterface<C>) {
super(payload)
@@ -32,6 +33,7 @@ export class DecryptedItem<C extends ItemContent = ItemContent>
this.updatedAtString = dateToLocalizedString(this.userModifiedDate)
this.protected = useBoolean(this.payload.content.protected, false)
this.trashed = useBoolean(this.payload.content.trashed, false)
this.starred = useBoolean(this.payload.content.starred, false)
this.pinned = this.getAppDomainValueWithDefault(AppDataField.Pinned, false)
this.archived = this.getAppDomainValueWithDefault(AppDataField.Archived, false)
this.locked = this.getAppDomainValueWithDefault(AppDataField.Locked, false)

View File

@@ -22,6 +22,7 @@ export interface DecryptedItemInterface<C extends ItemContent = ItemContent>
readonly pinned: boolean
readonly archived: boolean
readonly locked: boolean
readonly starred: boolean
readonly userModifiedDate: Date
readonly references: ContentReference[]

View File

@@ -78,6 +78,10 @@ export class DecryptedItemMutator<C extends ItemContent = ItemContent> extends I
this.mutableContent.trashed = trashed
}
set starred(starred: boolean) {
this.mutableContent.starred = starred
}
public set pinned(pinned: boolean) {
this.setAppDataItem(AppDataField.Pinned, pinned)
}