1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-18 10:23:52 +00:00

clean up code in at risk password callout component

This commit is contained in:
jng
2025-09-15 15:16:52 -04:00
parent 017a4551a9
commit cfaa9532a5
3 changed files with 7 additions and 14 deletions

View File

@@ -12,7 +12,7 @@
</bit-callout>
}
@if (showTasksResolvedBanner()) {
@if (showTasksCompleteBanner()) {
<bit-banner
class="-tw-m-5 tw-flex tw-flex-col tw-pt-2 tw-px-2 tw-mb-3"
bannerType="info"

View File

@@ -50,22 +50,15 @@ export class AtRiskPasswordCalloutComponent {
dismissedClicked: WritableSignal<boolean> = signal(false);
showTasksResolvedBanner = computed(() => {
showTasksCompleteBanner = computed(() => {
if (this.dismissedClicked()) {
return false;
}
if (
(this.atRiskPasswordStateSignal()?.showTasksCompleteBanner &&
this.currentPendingTasks()?.length === 0 &&
!this.atRiskPasswordStateSignal()?.hadPendingTasks) ||
(this.atRiskPasswordStateSignal()?.hadPendingTasks &&
this.currentPendingTasks()?.length === 0)
) {
return true;
} else {
return false;
}
const { showTasksCompleteBanner, hadPendingTasks } = this.atRiskPasswordStateSignal() ?? {};
const hasPendingTasks = (this.currentPendingTasks()?.length ?? 0) > 0;
return !hasPendingTasks && (showTasksCompleteBanner || hadPendingTasks);
});
constructor() {

View File

@@ -32,7 +32,7 @@ export class BannerComponent implements OnInit {
readonly bannerType = input<BannerType>("info");
// passing `null` will remove the icon from element from the banner
readonly icon = model<string>();
readonly icon = model<string | null>();
readonly useAlertRole = input(true);
readonly showClose = input(true);