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 ee4b755f4..9c60b4e13 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
@@ -1,6 +1,8 @@
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
+import { AccountDetailDialog } from '@ghostfolio/client/components/account-detail-dialog/account-detail-dialog.component';
+import { AccountDetailDialogParams } from '@ghostfolio/client/components/account-detail-dialog/interfaces/interfaces';
import { PositionDetailDialogParams } from '@ghostfolio/client/components/position/position-detail-dialog/interfaces/interfaces';
import { PositionDetailDialog } from '@ghostfolio/client/components/position/position-detail-dialog/position-detail-dialog.component';
import { DataService } from '@ghostfolio/client/services/data.service';
@@ -99,7 +101,9 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
this.routeQueryParams = route.queryParams
.pipe(takeUntil(this.unsubscribeSubject))
.subscribe((params) => {
- if (
+ if (params['accountId'] && params['accountDetailDialog']) {
+ this.openAccountDetailDialog(params['accountId']);
+ } else if (
params['dataSource'] &&
params['positionDetailDialog'] &&
params['symbol']
@@ -379,13 +383,21 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
this.markets.otherMarkets.value / marketsTotal;
}
+ public onAccountChartClicked({ symbol }: UniqueAsset) {
+ if (symbol) {
+ this.router.navigate([], {
+ queryParams: { accountId: symbol, accountDetailDialog: true }
+ });
+ }
+ }
+
public onChangePeriod(aValue: string) {
this.period = aValue;
this.initializeAnalysisData(this.period);
}
- public onProportionChartClicked({ dataSource, symbol }: UniqueAsset) {
+ public onSymbolChartClicked({ dataSource, symbol }: UniqueAsset) {
if (dataSource && symbol) {
this.router.navigate([], {
queryParams: { dataSource, symbol, positionDetailDialog: true }
@@ -398,6 +410,26 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
this.unsubscribeSubject.complete();
}
+ private openAccountDetailDialog(aAccountId: string) {
+ const dialogRef = this.dialog.open(AccountDetailDialog, {
+ autoFocus: false,
+ data:
{
+ accountId: aAccountId,
+ deviceType: this.deviceType,
+ hasImpersonationId: this.hasImpersonationId
+ },
+ height: this.deviceType === 'mobile' ? '97.5vh' : '80vh',
+ width: this.deviceType === 'mobile' ? '100vw' : '50rem'
+ });
+
+ dialogRef
+ .afterClosed()
+ .pipe(takeUntil(this.unsubscribeSubject))
+ .subscribe(() => {
+ this.router.navigate(['.'], { relativeTo: this.route });
+ });
+ }
+
private openPositionDialog({
dataSource,
symbol
diff --git a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html
index 416af40c0..869148b5c 100644
--- a/apps/client/src/app/pages/portfolio/allocations/allocations-page.html
+++ b/apps/client/src/app/pages/portfolio/allocations/allocations-page.html
@@ -24,11 +24,13 @@
@@ -116,7 +118,7 @@
[locale]="user?.settings?.locale"
[positions]="symbols"
[showLabels]="deviceType !== 'mobile'"
- (proportionChartClicked)="onProportionChartClicked($event)"
+ (proportionChartClicked)="onSymbolChartClicked($event)"
>
diff --git a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
index 11795788e..f8e43fa5e 100644
--- a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
+++ b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts
@@ -276,12 +276,14 @@ export class PortfolioProportionChartComponent
padding: this.showLabels === true ? 100 : 0
},
onClick: (event, activeElements) => {
- const dataIndex = activeElements[0].index;
- const symbol: string = event.chart.data.labels[dataIndex];
+ try {
+ const dataIndex = activeElements[0].index;
+ const symbol: string = event.chart.data.labels[dataIndex];
- const dataSource = this.positions[symbol]?.dataSource;
+ const dataSource = this.positions[symbol]?.dataSource;
- this.proportionChartClicked.emit({ dataSource, symbol });
+ this.proportionChartClicked.emit({ dataSource, symbol });
+ } catch {}
},
onHover: (event, chartElement) => {
if (this.cursor) {