Fix menu separators (#1220)

* Fix separators appearing when they shouldn't

* Use const instead of let
This commit is contained in:
Daniel James Smith 2022-01-07 15:54:35 +01:00 committed by GitHub
parent 695e8389d8
commit d64b00977c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 16 deletions

View File

@ -16,22 +16,33 @@ export class BitwardenMenu implements IMenubarMenu {
readonly label: string = "Bitwarden"; readonly label: string = "Bitwarden";
get items(): MenuItemConstructorOptions[] { get items(): MenuItemConstructorOptions[] {
return [ const items = [this.aboutBitwarden, this.checkForUpdates];
this.aboutBitwarden, if (this.aboutBitwarden.visible === true || this.checkForUpdates.visible === true) {
this.checkForUpdates, items.push(this.separator);
this.separator, }
this.settings, items.push(this.settings);
this.lock, items.push(this.lock);
this.lockAll, items.push(this.lockAll);
this.logOut, items.push(this.logOut);
this.services, items.push(this.services);
this.separator,
this.hideBitwarden, if (
this.hideOthers, this.hideBitwarden.visible === true ||
this.showAll, this.hideOthers.visible === true ||
this.separator, this.showAll.visible === true
this.quitBitwarden, ) {
]; items.push(this.separator);
}
items.push(this.hideBitwarden);
items.push(this.hideOthers);
items.push(this.showAll);
if (this.quitBitwarden.visible === true) {
items.push(this.separator);
}
items.push(this.quitBitwarden);
return items;
} }
private readonly _i18nService: I18nService; private readonly _i18nService: I18nService;

View File

@ -16,6 +16,10 @@ export class WindowMenu implements IMenubarMenu {
} }
get items(): MenuItemConstructorOptions[] { get items(): MenuItemConstructorOptions[] {
if (!isMacAppStore()) {
return [this.hideToMenu, this.alwaysOnTop];
}
return [ return [
this.minimize, this.minimize,
this.hideToMenu, this.hideToMenu,