Browse Source

Refactoring

pull/6988/head
Thomas Kaul 3 months ago
parent
commit
3962fb9e48
  1. 6
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
  2. 5
      libs/ui/src/lib/portfolio-proportion-chart/interfaces/interfaces.ts
  3. 9
      libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

6
apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

@ -185,10 +185,10 @@ export class GfAllocationsPageComponent implements OnInit {
this.initialize(); this.initialize();
} }
public onAccountChartClicked({ symbol }: AssetProfileIdentifier) { public onAccountChartClicked({ accountId }: { accountId: string }) {
if (symbol && symbol !== UNKNOWN_KEY) { if (accountId && accountId !== UNKNOWN_KEY) {
this.router.navigate([], { this.router.navigate([], {
queryParams: { accountId: symbol, accountDetailDialog: true } queryParams: { accountId, accountDetailDialog: true }
}); });
} }
} }

5
libs/ui/src/lib/portfolio-proportion-chart/interfaces/interfaces.ts

@ -0,0 +1,5 @@
import { AssetProfileIdentifier } from '@ghostfolio/common/interfaces';
export type PortfolioProportionChartClickEvent =
| AssetProfileIdentifier
| { accountId: string };

9
libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts

@ -33,10 +33,7 @@ import Color from 'color';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import OpenColor from 'open-color'; import OpenColor from 'open-color';
export interface PortfolioProportionChartClickEvent { import { PortfolioProportionChartClickEvent } from './interfaces/interfaces';
dataSource?: DataSource;
symbol: string;
}
const { const {
blue, blue,
@ -359,7 +356,9 @@ export class GfPortfolioProportionChartComponent
const symbol = chart.data.labels?.[dataIndex] as string; const symbol = chart.data.labels?.[dataIndex] as string;
const dataSource = this.data[symbol]?.dataSource; const dataSource = this.data[symbol]?.dataSource;
this.proportionChartClicked.emit({ dataSource, symbol }); this.proportionChartClicked.emit(
dataSource ? { dataSource, symbol } : { accountId: symbol }
);
} catch {} } catch {}
}, },
onHover: (event, chartElement) => { onHover: (event, chartElement) => {

Loading…
Cancel
Save