mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +01:00
[PM-9855] Add premium badge to new file send item dropdown (#10137)
* Create browsers SendV2 component * Add premium badge to new file send item dropdown --------- Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
parent
84b719d797
commit
cebbb9486e
@ -10,5 +10,8 @@
|
||||
<a type="button" bitMenuItem (click)="newItemNavigate(sendType.File)">
|
||||
<i class="bwi bwi-file" slot="start" aria-hidden="true"></i>
|
||||
{{ "sendTypeFile" | i18n }}
|
||||
<button type="button" slot="end" *ngIf="hasNoPremium" bitBadge variant="success">
|
||||
{{ "premium" | i18n }}
|
||||
</button>
|
||||
</a>
|
||||
</bit-menu>
|
||||
|
@ -1,23 +1,39 @@
|
||||
import { CommonModule } from "@angular/common";
|
||||
import { Component } from "@angular/core";
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { Router, RouterLink } from "@angular/router";
|
||||
import { firstValueFrom } from "rxjs";
|
||||
|
||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
||||
import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions";
|
||||
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
|
||||
import { ButtonModule, MenuModule } from "@bitwarden/components";
|
||||
import { BadgeModule, ButtonModule, MenuModule } from "@bitwarden/components";
|
||||
|
||||
@Component({
|
||||
selector: "tools-new-send-dropdown",
|
||||
templateUrl: "new-send-dropdown.component.html",
|
||||
standalone: true,
|
||||
imports: [JslibModule, CommonModule, ButtonModule, RouterLink, MenuModule],
|
||||
imports: [JslibModule, CommonModule, ButtonModule, RouterLink, MenuModule, BadgeModule],
|
||||
})
|
||||
export class NewSendDropdownComponent {
|
||||
export class NewSendDropdownComponent implements OnInit {
|
||||
sendType = SendType;
|
||||
|
||||
constructor(private router: Router) {}
|
||||
hasNoPremium = false;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private billingAccountProfileStateService: BillingAccountProfileStateService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.hasNoPremium = !(await firstValueFrom(
|
||||
this.billingAccountProfileStateService.hasPremiumFromAnySource$,
|
||||
));
|
||||
}
|
||||
|
||||
newItemNavigate(type: SendType) {
|
||||
if (this.hasNoPremium && type === SendType.File) {
|
||||
return this.router.navigate(["/premium"]);
|
||||
}
|
||||
void this.router.navigate(["/add-send"], { queryParams: { type: type, isNew: true } });
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user