Browse Source

feat(client): enforce encapsulation

pull/7076/head
KenTandrian 4 weeks ago
parent
commit
2a8fef5d5a
  1. 54
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts

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

@ -60,21 +60,21 @@ import { AllocationsPageParams } from './interfaces/interfaces';
templateUrl: './allocations-page.html' templateUrl: './allocations-page.html'
}) })
export class GfAllocationsPageComponent implements OnInit { export class GfAllocationsPageComponent implements OnInit {
public accounts: { protected accounts: {
[id: string]: Pick<Account, 'name'> & { [id: string]: Pick<Account, 'name'> & {
id: string; id: string;
value: number; value: number;
}; };
}; };
public continents: { protected continents: {
[code: string]: { name: string; value: number }; [code: string]: { name: string; value: number };
}; };
public countries: { protected countries: {
[code: string]: { name: string; value: number }; [code: string]: { name: string; value: number };
}; };
public deviceType: string; protected deviceType: string;
public hasImpersonationId: boolean; protected hasImpersonationId: boolean;
public holdings: { protected holdings: {
[symbol: string]: Pick< [symbol: string]: Pick<
PortfolioPosition['assetProfile'], PortfolioPosition['assetProfile'],
| 'assetClass' | 'assetClass'
@ -85,26 +85,26 @@ export class GfAllocationsPageComponent implements OnInit {
| 'name' | 'name'
> & { etfProvider: string; exchange?: string; value: number }; > & { etfProvider: string; exchange?: string; value: number };
}; };
public isLoading = false; protected isLoading = false;
public markets: PortfolioDetails['markets']; protected markets: PortfolioDetails['markets'];
public marketsAdvanced: { protected marketsAdvanced: {
[key in MarketAdvanced]: { [key in MarketAdvanced]: {
id: MarketAdvanced; id: MarketAdvanced;
name: string; name: string;
value: number; value: number;
}; };
}; };
public platforms: { protected platforms: {
[id: string]: Pick<Platform, 'name'> & { [id: string]: Pick<Platform, 'name'> & {
id: string; id: string;
value: number; value: number;
}; };
}; };
public portfolioDetails: PortfolioDetails; protected portfolioDetails: PortfolioDetails;
public sectors: { protected sectors: {
[name: string]: { name: string; value: number }; [name: string]: { name: string; value: number };
}; };
public symbols: { protected symbols: {
[name: string]: { [name: string]: {
dataSource?: DataSource; dataSource?: DataSource;
name: string; name: string;
@ -112,14 +112,15 @@ export class GfAllocationsPageComponent implements OnInit {
value: number; value: number;
}; };
}; };
public topHoldings: HoldingWithParents[]; protected topHoldings: HoldingWithParents[];
public topHoldingsMap: { protected UNKNOWN_KEY = UNKNOWN_KEY;
protected user: User;
protected worldMapChartFormat: string;
private topHoldingsMap: {
[name: string]: { name: string; value: number }; [name: string]: { name: string; value: number };
}; };
public totalValueInEtf = 0; private totalValueInEtf = 0;
public UNKNOWN_KEY = UNKNOWN_KEY;
public user: User;
public worldMapChartFormat: string;
private readonly changeDetectorRef = inject(ChangeDetectorRef); private readonly changeDetectorRef = inject(ChangeDetectorRef);
private readonly dataService = inject(DataService); private readonly dataService = inject(DataService);
@ -188,7 +189,7 @@ export class GfAllocationsPageComponent implements OnInit {
this.initialize(); this.initialize();
} }
public onAccountChartClicked({ accountId }: { accountId: string }) { protected onAccountChartClicked({ accountId }: { accountId: string }) {
if (accountId && accountId !== UNKNOWN_KEY) { if (accountId && accountId !== UNKNOWN_KEY) {
void this.router.navigate([], { void this.router.navigate([], {
queryParams: { accountId, accountDetailDialog: true } queryParams: { accountId, accountDetailDialog: true }
@ -196,7 +197,10 @@ export class GfAllocationsPageComponent implements OnInit {
} }
} }
public onSymbolChartClicked({ dataSource, symbol }: AssetProfileIdentifier) { protected onSymbolChartClicked({
dataSource,
symbol
}: AssetProfileIdentifier) {
if (dataSource && symbol) { if (dataSource && symbol) {
void this.router.navigate([], { void this.router.navigate([], {
queryParams: { dataSource, symbol, holdingDetailDialog: true } queryParams: { dataSource, symbol, holdingDetailDialog: true }
@ -204,6 +208,10 @@ export class GfAllocationsPageComponent implements OnInit {
} }
} }
protected showValuesInPercentage() {
return this.hasImpersonationId || this.user?.settings?.isRestrictedView;
}
private extractCurrency({ private extractCurrency({
assetClass, assetClass,
assetSubClass, assetSubClass,
@ -609,8 +617,4 @@ export class GfAllocationsPageComponent implements OnInit {
void this.router.navigate(['.'], { relativeTo: this.route }); void this.router.navigate(['.'], { relativeTo: this.route });
}); });
} }
public showValuesInPercentage() {
return this.hasImpersonationId || this.user?.settings?.isRestrictedView;
}
} }

Loading…
Cancel
Save