1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[CL-420][PM-18798] - Berry component and tab navigation (#14135)

* berry component and nav slot

* remove debug

* don't worry about routes

* add announce and tests

* fix story

* use existing notification color. fix border radius

* fix berry component class

* finalize berry component

* fix tests

* fix story

* move logic to tabs-v2 component.

* move navButtons to tabs-v2.component

* fix layout

* move story.

* cleanup
This commit is contained in:
Jordan Aasen
2025-04-22 10:18:10 -07:00
committed by GitHub
parent 490a46e9b6
commit 18d47a29df
9 changed files with 189 additions and 39 deletions

View File

@@ -24,6 +24,7 @@ export * from "./components/carousel";
export * as VaultIcons from "./icons";
export * from "./services/vault-nudges.service";
export * from "./services/custom-nudges-services";
export { DefaultSshImportPromptService } from "./services/default-ssh-import-prompt.service";
export { SshImportPromptService } from "./services/ssh-import-prompt.service";

View File

@@ -0,0 +1,47 @@
import { inject, Injectable } from "@angular/core";
import { combineLatest, distinctUntilChanged, map, Observable, of, switchMap } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { UserId } from "@bitwarden/common/types/guid";
import { DefaultSingleNudgeService } from "../default-single-nudge.service";
import { VaultNudgeType } from "../vault-nudges.service";
/**
* Custom Nudge Service used for showing if the user has any existing nudge in the Vault.
*/
@Injectable({
providedIn: "root",
})
export class HasNudgeService extends DefaultSingleNudgeService {
private accountService = inject(AccountService);
private nudgeTypes: VaultNudgeType[] = [
VaultNudgeType.HasVaultItems,
VaultNudgeType.IntroCarouselDismissal,
// add additional nudge types here as needed
];
/**
* Returns an observable that emits true if any of the provided nudge types are present
*/
shouldShowNudge$(): Observable<boolean> {
return this.accountService.activeAccount$.pipe(
switchMap((activeAccount) => {
const userId: UserId | undefined = activeAccount?.id;
if (!userId) {
return of(false);
}
const nudgeObservables: Observable<boolean>[] = this.nudgeTypes.map((nudge) =>
super.shouldShowNudge$(nudge, userId),
);
return combineLatest(nudgeObservables).pipe(
map((nudgeStates) => nudgeStates.some((state) => state)),
distinctUntilChanged(),
);
}),
);
}
}

View File

@@ -1 +1,2 @@
export * from "./has-items-nudge.service";
export * from "./has-nudge.service";