Browse Source

fix(targets): correct account typing and stable chart inputs

pull/8458/head
PJ 4 days ago
parent
commit
b1fa3e25ba
  1. 11
      apps/client/src/app/pages/portfolio/targets/target-configuration-dialog.component.ts

11
apps/client/src/app/pages/portfolio/targets/target-configuration-dialog.component.ts

@ -37,7 +37,7 @@ export class GfTargetConfigurationDialogComponent {
protected readonly presets = TARGET_PRESETS; protected readonly presets = TARGET_PRESETS;
protected profile: PortfolioTargetProfile; protected profile: PortfolioTargetProfile;
private readonly data = inject<{ protected readonly data = inject<{
profile?: PortfolioTargetProfile; profile?: PortfolioTargetProfile;
user: User; user: User;
}>(MAT_DIALOG_DATA); }>(MAT_DIALOG_DATA);
@ -54,10 +54,13 @@ export class GfTargetConfigurationDialogComponent {
...(this.data.profile ?? defaultProfile), ...(this.data.profile ?? defaultProfile),
allocations: { ...(this.data.profile?.allocations ?? defaultProfile.allocations) } allocations: { ...(this.data.profile?.allocations ?? defaultProfile.allocations) }
}; };
this.updateChartData();
} }
protected get chartData() { protected chartData: Record<string, { name: string; value: number }> = {};
return Object.fromEntries(this.classes.map((assetClass) => [
private updateChartData() {
this.chartData = Object.fromEntries(this.classes.map((assetClass) => [
assetClass, assetClass,
{ {
name: this.labels[assetClass], name: this.labels[assetClass],
@ -87,6 +90,7 @@ export class GfTargetConfigurationDialogComponent {
...next, ...next,
tolerance: this.profile.tolerance tolerance: this.profile.tolerance
}; };
this.updateChartData();
} }
protected updateAllocation(assetClass: AssetClass, percent: number) { protected updateAllocation(assetClass: AssetClass, percent: number) {
@ -98,6 +102,7 @@ export class GfTargetConfigurationDialogComponent {
[assetClass]: Number(percent) / 100 [assetClass]: Number(percent) / 100
} }
}; };
this.updateChartData();
} }
protected updateTolerance(percent: number) { protected updateTolerance(percent: number) {

Loading…
Cancel
Save