Browse Source

Remove show condition for markets overview

pull/2441/head
Thomas 2 years ago
parent
commit
2d758817f9
  1. 2
      apps/client/src/app/components/home-market/home-market.html
  2. 14
      apps/client/src/app/pages/home/home-page.component.ts

2
apps/client/src/app/components/home-market/home-market.html

@ -1,6 +1,6 @@
<div class="container"> <div class="container">
<h1 class="d-none d-sm-block h3 mb-4 text-center" i18n>Markets</h1> <h1 class="d-none d-sm-block h3 mb-4 text-center" i18n>Markets</h1>
<div class="mb-5 row"> <div *ngIf="hasPermissionToAccessFearAndGreedIndex" class="mb-5 row">
<div class="col-xs-12 col-md-8 offset-md-2"> <div class="col-xs-12 col-md-8 offset-md-2">
<div class="mb-2 text-center text-muted"> <div class="mb-2 text-center text-muted">
<small i18n>Last {{ numberOfDays }} Days</small> <small i18n>Last {{ numberOfDays }} Days</small>

14
apps/client/src/app/pages/home/home-page.component.ts

@ -1,8 +1,6 @@
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core'; import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { DataService } from '@ghostfolio/client/services/data.service';
import { UserService } from '@ghostfolio/client/services/user/user.service'; import { UserService } from '@ghostfolio/client/services/user/user.service';
import { TabConfiguration, User } from '@ghostfolio/common/interfaces'; import { TabConfiguration, User } from '@ghostfolio/common/interfaces';
import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { DeviceDetectorService } from 'ngx-device-detector'; import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
@ -15,7 +13,6 @@ import { takeUntil } from 'rxjs/operators';
}) })
export class HomePageComponent implements OnDestroy, OnInit { export class HomePageComponent implements OnDestroy, OnInit {
public deviceType: string; public deviceType: string;
public hasPermissionToAccessFearAndGreedIndex: boolean;
public tabs: TabConfiguration[] = []; public tabs: TabConfiguration[] = [];
public user: User; public user: User;
@ -23,17 +20,9 @@ export class HomePageComponent implements OnDestroy, OnInit {
public constructor( public constructor(
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private dataService: DataService,
private deviceService: DeviceDetectorService, private deviceService: DeviceDetectorService,
private userService: UserService private userService: UserService
) { ) {
const { globalPermissions } = this.dataService.fetchInfo();
this.hasPermissionToAccessFearAndGreedIndex = hasPermission(
globalPermissions,
permissions.enableFearAndGreedIndex
);
this.userService.stateChanged this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
.subscribe((state) => { .subscribe((state) => {
@ -57,8 +46,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
{ {
iconName: 'newspaper-outline', iconName: 'newspaper-outline',
label: $localize`Markets`, label: $localize`Markets`,
path: ['/home', 'market'], path: ['/home', 'market']
showCondition: this.hasPermissionToAccessFearAndGreedIndex
} }
]; ];
this.user = state.user; this.user = state.user;

Loading…
Cancel
Save