Browse Source

Conditionally show content

pull/1687/head
Thomas 3 years ago
parent
commit
30e20e3ca1
  1. 25
      apps/client/src/app/pages/faq/faq-page.component.ts
  2. 2
      apps/client/src/app/pages/faq/faq-page.html
  3. 21
      apps/client/src/app/pages/landing/landing-page.html

25
apps/client/src/app/pages/faq/faq-page.component.ts

@ -1,5 +1,7 @@
import { Component, OnDestroy } from '@angular/core'; import { ChangeDetectorRef, Component, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { User } from '@ghostfolio/common/interfaces';
import { Subject, takeUntil } from 'rxjs';
@Component({ @Component({
host: { class: 'page' }, host: { class: 'page' },
@ -8,9 +10,26 @@ import { Subject } from 'rxjs';
templateUrl: './faq-page.html' templateUrl: './faq-page.html'
}) })
export class FaqPageComponent implements OnDestroy { export class FaqPageComponent implements OnDestroy {
public user: User;
private unsubscribeSubject = new Subject<void>(); private unsubscribeSubject = new Subject<void>();
public constructor() {} public constructor(
private changeDetectorRef: ChangeDetectorRef,
private userService: UserService
) {}
public ngOnInit() {
this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((state) => {
if (state?.user) {
this.user = state.user;
this.changeDetectorRef.markForCheck();
}
});
}
public ngOnDestroy() { public ngOnDestroy() {
this.unsubscribeSubject.next(); this.unsubscribeSubject.next();

2
apps/client/src/app/pages/faq/faq-page.html

@ -115,7 +115,7 @@
>.</mat-card-content >.</mat-card-content
> >
</mat-card> </mat-card>
<mat-card class="mb-3"> <mat-card *ngIf="user?.subscription?.type === 'Premium'" class="mb-3">
<mat-card-title <mat-card-title
>I cannot find my broker in the list of platforms. What can I >I cannot find my broker in the list of platforms. What can I
do?</mat-card-title do?</mat-card-title

21
apps/client/src/app/pages/landing/landing-page.html

@ -52,6 +52,7 @@
<div *ngIf="hasPermissionForStatistics" class="row mb-5"> <div *ngIf="hasPermissionForStatistics" class="row mb-5">
<div <div
*ngIf="hasPermissionForSubscription"
class="col-md-4 d-flex my-1" class="col-md-4 d-flex my-1"
[ngClass]="{ 'justify-content-center': this.deviceType !== 'mobile' }" [ngClass]="{ 'justify-content-center': this.deviceType !== 'mobile' }"
> >
@ -68,6 +69,24 @@
> >
</a> </a>
</div> </div>
<div
*ngIf="!hasPermissionForSubscription"
class="col-md-4 d-flex my-1"
[ngClass]="{ 'justify-content-center': this.deviceType !== 'mobile' }"
>
<a
class="d-block"
title="Ghostfolio in Numbers: Contributors on GitHub"
[routerLink]="['/about']"
>
<gf-value
icon="people-outline"
size="large"
[value]="statistics?.gitHubContributors ?? '-'"
>Contributors on GitHub</gf-value
>
</a>
</div>
<div <div
class="col-md-4 d-flex my-1" class="col-md-4 d-flex my-1"
[ngClass]="{ 'justify-content-center': this.deviceType !== 'mobile' }" [ngClass]="{ 'justify-content-center': this.deviceType !== 'mobile' }"
@ -300,7 +319,7 @@
</div> </div>
</div> </div>
<div class="row my-3"> <div *ngIf="hasPermissionForSubscription" class="row my-3">
<div class="col-12"> <div class="col-12">
<h2 class="h4 mb-1 text-center"> <h2 class="h4 mb-1 text-center">
How does <strong>Ghostfolio</strong> work? How does <strong>Ghostfolio</strong> work?

Loading…
Cancel
Save