Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/remove permission to markets overview on home page (#2441)

Thomas Kauld40bc5070ac3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 40c7e843ef..17ff05e896 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added the application version to the endpoint `GET api/v1/admin`
- Introduced a carousel component for the testimonial section on the landing page
+### Changed
+
+- Displayed the link to the markets overview on the home page without any permission
+
### Fixed
- Fixed the style of the active features page in the navigation on desktop
diff --git a/apps/client/src/app/components/home-market/home-market.html b/apps/client/src/app/components/home-market/home-market.html
index 43f560d85b..7ce07b6e92 100644
--- a/apps/client/src/app/components/home-market/home-market.html
+++ b/apps/client/src/app/components/home-market/home-market.html
@@ -1,6 +1,6 @@
<div class="container">
<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="mb-2 text-center text-muted">
<small i18n>Last {{ numberOfDays }} Days</small>
diff --git a/apps/client/src/app/pages/home/home-page.component.ts b/apps/client/src/app/pages/home/home-page.component.ts
index a39a371c4f..fea8e9ac3f 100644
--- a/apps/client/src/app/pages/home/home-page.component.ts
+++ b/apps/client/src/app/pages/home/home-page.component.ts
@@ -1,8 +1,6 @@
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 { TabConfiguration, User } from '@ghostfolio/common/interfaces';
-import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
@@ -15,7 +13,6 @@ import { takeUntil } from 'rxjs/operators';
})
export class HomePageComponent implements OnDestroy, OnInit {
public deviceType: string;
- public hasPermissionToAccessFearAndGreedIndex: boolean;
public tabs: TabConfiguration[] = [];
public user: User;
@@ -23,17 +20,9 @@ export class HomePageComponent implements OnDestroy, OnInit {
public constructor(
private changeDetectorRef: ChangeDetectorRef,
- private dataService: DataService,
private deviceService: DeviceDetectorService,
private userService: UserService
) {
- const { globalPermissions } = this.dataService.fetchInfo();
-
- this.hasPermissionToAccessFearAndGreedIndex = hasPermission(
- globalPermissions,
- permissions.enableFearAndGreedIndex
- );
-
this.userService.stateChanged
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((state) => {
@@ -57,8 +46,7 @@ export class HomePageComponent implements OnDestroy, OnInit {
{
iconName: 'newspaper-outline',
label: $localize`Markets`,
- path: ['/home', 'market'],
- showCondition: this.hasPermissionToAccessFearAndGreedIndex
+ path: ['/home', 'market']
}
];
this.user = state.user;