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>
<mat-card-content> <mat-card-content>
<div class="console-app__widget"> <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> <mat-icon class="console-app__widget-icon">account_balance</mat-icon>
<h1 class="console-app__widget-title">Billing Info</h1> <h1 class="console-app__widget-title">Billing Info</h1>
<h4 class="secondary-text text-center"> <h4 class="secondary-text text-center">
View important billing and payments information. <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> </h4>
</div> </a>
</div> </div>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View file

@ -13,11 +13,25 @@
// limitations under the License. // limitations under the License.
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { RegistrarService } from 'src/app/registrar/registrar.service';
@Component({ @Component({
selector: '[app-billing-widget]', selector: '[app-billing-widget]',
templateUrl: './billing-widget.component.html', templateUrl: './billing-widget.component.html',
}) })
export class BillingWidgetComponent { 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); this.activeRegistrarIdChange.next(registrarId);
} }
public get registrar(): Registrar {
return this.registrars.filter(
(r) => r.registrarId === this.activeRegistrarId
)[0];
}
loadingTimeout() { loadingTimeout() {
// TODO: Decide what to do when timeout happens // TODO: Decide what to do when timeout happens
} }

View file

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