Add billing details (#2136)

This adds functionality to billing details widget on home screen
This commit is contained in:
Pavlo Tkach 2023-09-06 14:37:58 -04:00 committed by GitHub
parent 9a6a7116da
commit 001e9363a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 40 additions and 4 deletions

View file

@ -1,13 +1,22 @@
<mat-card>
<mat-card-content>
<div class="console-app__widget">
<div class="console-app__widget_left">
<a
class="console-app__widget_left"
href="{{ driveFolderUrl }}"
(click)="openBillingDetails($event)"
>
<mat-icon class="console-app__widget-icon">account_balance</mat-icon>
<h1 class="console-app__widget-title">Billing Info</h1>
<h4 class="secondary-text text-center">
<span *ngIf="driveFolderUrl; else noDriveFolderUrl">
View important billing and payments information.
</span>
<ng-template #noDriveFolderUrl>
<span> Your billing folder is pending allocation. </span>
</ng-template>
</h4>
</div>
</a>
</div>
</mat-card-content>
</mat-card>

View file

@ -13,11 +13,25 @@
// limitations under the License.
import { Component } from '@angular/core';
import { RegistrarService } from 'src/app/registrar/registrar.service';
@Component({
selector: '[app-billing-widget]',
templateUrl: './billing-widget.component.html',
})
export class BillingWidgetComponent {
constructor() {}
constructor(public registrarService: RegistrarService) {}
public get driveFolderUrl(): string {
if (this.registrarService?.registrar.driveFolderId) {
return `https://drive.google.com/drive/folders/${this.registrarService?.registrar.driveFolderId}`;
}
return '';
}
openBillingDetails(e: MouseEvent) {
if (!this.driveFolderUrl) {
e.preventDefault();
}
}
}

View file

@ -66,6 +66,12 @@ export class RegistrarService implements GlobalLoader {
this.activeRegistrarIdChange.next(registrarId);
}
public get registrar(): Registrar {
return this.registrars.filter(
(r) => r.registrarId === this.activeRegistrarId
)[0];
}
loadingTimeout() {
// TODO: Decide what to do when timeout happens
}

View file

@ -31,6 +31,13 @@ body {
&__widget {
display: flex;
gap: 10px;
> a {
text-decoration: none;
color: initial;
}
> a[href=""] {
cursor: not-allowed;
}
&-wrapper__wide {
grid-column: span 2;
}