1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 05:43:41 +00:00

revert change to removing send tab (#11394)

This commit is contained in:
Jordan Aasen
2024-10-04 06:35:07 -07:00
committed by GitHub
parent 8ec5517809
commit d4767bf172

View File

@@ -1,41 +1,9 @@
import { CommonModule } from "@angular/common"; import { CommonModule } from "@angular/common";
import { Component } from "@angular/core"; import { Component } from "@angular/core";
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
import { RouterModule } from "@angular/router"; import { RouterModule } from "@angular/router";
import { filter, map, switchMap } from "rxjs";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
import { LinkModule } from "@bitwarden/components"; import { LinkModule } from "@bitwarden/components";
const allNavButtons = [
{
label: "Vault",
page: "/tabs/vault",
iconKey: "lock",
iconKeyActive: "lock-f",
},
{
label: "Generator",
page: "/tabs/generator",
iconKey: "generate",
iconKeyActive: "generate-f",
},
{
label: "Send",
page: "/tabs/send",
iconKey: "send",
iconKeyActive: "send-f",
},
{
label: "Settings",
page: "/tabs/settings",
iconKey: "cog",
iconKeyActive: "cog-f",
},
];
@Component({ @Component({
selector: "popup-tab-navigation", selector: "popup-tab-navigation",
templateUrl: "popup-tab-navigation.component.html", templateUrl: "popup-tab-navigation.component.html",
@@ -46,23 +14,30 @@ const allNavButtons = [
}, },
}) })
export class PopupTabNavigationComponent { export class PopupTabNavigationComponent {
navButtons = allNavButtons; navButtons = [
constructor( {
private policyService: PolicyService, label: "Vault",
private sendService: SendService, page: "/tabs/vault",
) { iconKey: "lock",
this.policyService iconKeyActive: "lock-f",
.policyAppliesToActiveUser$(PolicyType.DisableSend) },
.pipe( {
filter((policyAppliesToActiveUser) => policyAppliesToActiveUser), label: "Generator",
switchMap(() => this.sendService.sends$), page: "/tabs/generator",
map((sends) => sends.length > 0), iconKey: "generate",
takeUntilDestroyed(), iconKeyActive: "generate-f",
) },
.subscribe((hasSends) => { {
this.navButtons = hasSends label: "Send",
? allNavButtons page: "/tabs/send",
: allNavButtons.filter((b) => b.page !== "/tabs/send"); iconKey: "send",
}); iconKeyActive: "send-f",
} },
{
label: "Settings",
page: "/tabs/settings",
iconKey: "cog",
iconKeyActive: "cog-f",
},
];
} }