From 7b39b3229367e6e38dfea2f30d458b1f6127dd1c Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 26 Mar 2023 17:18:48 +0200 Subject: [PATCH] Feature/improve allocations page (#1813) * Improve loading state * Update changelog --- CHANGELOG.md | 1 + .../allocations/allocations-page.component.ts | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00e3ef9cb..f18162ea1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Improved the loading state of the value component on the allocations page - Improved the value component by always showing the label (also while loading) - Improved the language localization for German (`de`) diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts index b7a631625..6ffe53cc0 100644 --- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts +++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts @@ -198,6 +198,8 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { this.changeDetectorRef.markForCheck(); } }); + + this.initialize(); } public initialize() { @@ -217,15 +219,15 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { this.markets = { developedMarkets: { name: 'developedMarkets', - value: 0 + value: undefined }, emergingMarkets: { name: 'emergingMarkets', - value: 0 + value: undefined }, otherMarkets: { name: 'otherMarkets', - value: 0 + value: undefined } }; this.positions = {}; @@ -281,6 +283,16 @@ export class AllocationsPageComponent implements OnDestroy, OnInit { // Prepare analysis data by continents, countries and sectors except for cash if (position.countries.length > 0) { + if (!this.markets.developedMarkets.value) { + this.markets.developedMarkets.value = 0; + } + if (!this.markets.emergingMarkets.value) { + this.markets.emergingMarkets.value = 0; + } + if (!this.markets.otherMarkets.value) { + this.markets.otherMarkets.value = 0; + } + this.markets.developedMarkets.value += position.markets.developedMarkets * position.value; this.markets.emergingMarkets.value +=