From 745ba978a3c4db955557fa5f3ebc44f553512ffa Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 25 Feb 2022 08:04:42 +0100 Subject: [PATCH] Bugfix/fix zen mode (#723) * Fix Zen mode * Update changelog --- CHANGELOG.md | 4 ++++ apps/api/src/app/portfolio/portfolio.controller.ts | 2 ++ .../home-holdings/home-holdings.component.ts | 4 +++- .../app/components/home-holdings/home-holdings.html | 2 +- .../home-overview/home-overview.component.ts | 10 +++++++++- .../app/components/home-overview/home-overview.html | 4 ++-- 6 files changed, 21 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20627236..5b4c46f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Distinguished the labels _Other_ and _Unknown_ in the portfolio proportion chart component - Improved the portfolio entry page +### Fixed + +- Fixed the _Zen Mode_ + ## 1.119.0 - 21.02.2022 ### Added diff --git a/apps/api/src/app/portfolio/portfolio.controller.ts b/apps/api/src/app/portfolio/portfolio.controller.ts index 38a083c7..5d15aa42 100644 --- a/apps/api/src/app/portfolio/portfolio.controller.ts +++ b/apps/api/src/app/portfolio/portfolio.controller.ts @@ -33,6 +33,7 @@ import { } from '@nestjs/common'; import { REQUEST } from '@nestjs/core'; import { AuthGuard } from '@nestjs/passport'; +import { ViewMode } from '@prisma/client'; import { StatusCodes, getReasonPhrase } from 'http-status-codes'; import { PortfolioPositionDetail } from './interfaces/portfolio-position-detail.interface'; @@ -213,6 +214,7 @@ export class PortfolioController { if ( impersonationId || + this.request.user.Settings.viewMode === ViewMode.ZEN || this.userService.isRestrictedView(this.request.user) ) { performanceInformation.performance = nullifyValuesInObject( diff --git a/apps/client/src/app/components/home-holdings/home-holdings.component.ts b/apps/client/src/app/components/home-holdings/home-holdings.component.ts index 50c452ea..7d40a27e 100644 --- a/apps/client/src/app/components/home-holdings/home-holdings.component.ts +++ b/apps/client/src/app/components/home-holdings/home-holdings.component.ts @@ -93,7 +93,9 @@ export class HomeHoldingsComponent implements OnDestroy, OnInit { }); this.dateRange = - this.settingsStorageService.getSetting(RANGE) || 'max'; + this.user.settings.viewMode === 'ZEN' + ? 'max' + : this.settingsStorageService.getSetting(RANGE) ?? 'max'; this.update(); } diff --git a/apps/client/src/app/components/home-holdings/home-holdings.html b/apps/client/src/app/components/home-holdings/home-holdings.html index 9b69a1a8..9e1fb9c9 100644 --- a/apps/client/src/app/components/home-holdings/home-holdings.html +++ b/apps/client/src/app/components/home-holdings/home-holdings.html @@ -1,5 +1,5 @@
-
+
(); @@ -79,7 +80,14 @@ export class HomeOverviewComponent implements OnDestroy, OnInit { }); this.dateRange = - this.settingsStorageService.getSetting(RANGE) || 'max'; + this.user.settings.viewMode === 'ZEN' + ? 'max' + : this.settingsStorageService.getSetting(RANGE) ?? 'max'; + + this.showDetails = + !this.hasImpersonationId && + !this.user.settings.isRestrictedView && + this.user.settings.viewMode !== 'ZEN'; this.update(); } diff --git a/apps/client/src/app/components/home-overview/home-overview.html b/apps/client/src/app/components/home-overview/home-overview.html index a6e1c63f..82f45ed5 100644 --- a/apps/client/src/app/components/home-overview/home-overview.html +++ b/apps/client/src/app/components/home-overview/home-overview.html @@ -34,9 +34,9 @@ [isLoading]="isLoadingPerformance" [locale]="user?.settings?.locale" [performance]="performance" - [showDetails]="!hasImpersonationId && !user.settings.isRestrictedView" + [showDetails]="showDetails" > -
+