chore: show invite count bubble on preferences button (#2458)
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import { IconType } from '@standardnotes/snjs'
|
||||
import { PreferenceId } from '@standardnotes/ui-services'
|
||||
import { PreferencePaneId } from '@standardnotes/services'
|
||||
|
||||
export interface PreferencesMenuItem {
|
||||
readonly id: PreferenceId
|
||||
readonly id: PreferencePaneId
|
||||
readonly icon: IconType
|
||||
readonly label: string
|
||||
readonly order: number
|
||||
readonly hasBubble?: boolean
|
||||
readonly bubbleCount?: number
|
||||
readonly hasErrorIndicator?: boolean
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { action, makeAutoObservable, observable } from 'mobx'
|
||||
import { WebApplication } from '@/Application/WebApplication'
|
||||
import { PackageProvider } from '../Panes/General/Advanced/Packages/Provider/PackageProvider'
|
||||
import { securityPrefsHasBubble } from '../Panes/Security/securityPrefsHasBubble'
|
||||
import { PreferenceId } from '@standardnotes/ui-services'
|
||||
import { PreferencePaneId } from '@standardnotes/services'
|
||||
import { isDesktopApplication } from '@/Utils'
|
||||
import { featureTrunkHomeServerEnabled, featureTrunkVaultsEnabled } from '@/FeatureTrunk'
|
||||
import { PreferencesMenuItem } from './PreferencesMenuItem'
|
||||
@@ -14,7 +14,7 @@ import { PREFERENCES_MENU_ITEMS, READY_PREFERENCES_MENU_ITEMS } from './MenuItem
|
||||
* Preferences menu. It is created and destroyed each time the menu is opened and closed.
|
||||
*/
|
||||
export class PreferencesSessionController {
|
||||
private _selectedPane: PreferenceId = 'account'
|
||||
private _selectedPane: PreferencePaneId = 'account'
|
||||
private _menu: PreferencesMenuItem[]
|
||||
private _extensionLatestVersions: PackageProvider = new PackageProvider(new Map())
|
||||
|
||||
@@ -69,7 +69,8 @@ export class PreferencesSessionController {
|
||||
const item: SelectableMenuItem = {
|
||||
...preference,
|
||||
selected: preference.id === this._selectedPane,
|
||||
hasBubble: this.sectionHasBubble(preference.id),
|
||||
bubbleCount: this.application.status.getPreferencesBubbleCount(preference.id),
|
||||
hasErrorIndicator: this.sectionHasBubble(preference.id),
|
||||
}
|
||||
return item
|
||||
})
|
||||
@@ -81,7 +82,7 @@ export class PreferencesSessionController {
|
||||
return this._menu.find((item) => item.id === this._selectedPane)
|
||||
}
|
||||
|
||||
get selectedPaneId(): PreferenceId {
|
||||
get selectedPaneId(): PreferencePaneId {
|
||||
if (this.selectedMenuItem != undefined) {
|
||||
return this.selectedMenuItem.id
|
||||
}
|
||||
@@ -89,11 +90,11 @@ export class PreferencesSessionController {
|
||||
return 'account'
|
||||
}
|
||||
|
||||
selectPane = (key: PreferenceId) => {
|
||||
selectPane = (key: PreferencePaneId) => {
|
||||
this._selectedPane = key
|
||||
}
|
||||
|
||||
sectionHasBubble(id: PreferenceId): boolean {
|
||||
sectionHasBubble(id: PreferencePaneId): boolean {
|
||||
if (id === 'security') {
|
||||
return securityPrefsHasBubble(this.application)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user