Browse Source

Update code with separate symbol property and code style enhancement

pull/4044/head
JoryHogeveen 9 months ago
parent
commit
429e05fbb7
  1. 28
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
  2. 2
      libs/common/src/lib/interfaces/index.ts
  3. 4
      libs/ui/src/lib/top-holdings/top-holdings.component.html
  4. 10
      libs/ui/src/lib/top-holdings/top-holdings.component.scss

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

@ -490,24 +490,21 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
name, name,
allocationInPercentage: allocationInPercentage:
this.totalValueInEtf > 0 ? value / this.totalValueInEtf : 0, this.totalValueInEtf > 0 ? value / this.totalValueInEtf : 0,
valueInBaseCurrency: value,
parents: Object.entries(this.portfolioDetails.holdings) parents: Object.entries(this.portfolioDetails.holdings)
.map(([symbol, holding]) => { .map(([symbol, holding]) => {
if (holding.holdings) { if (holding.holdings.length > 0) {
const parentHoldings = holding.holdings; const parentHolding = holding.holdings.find((parentHolding) => {
for (const index in parentHoldings) { return parentHolding.name === name;
if (name === parentHoldings[index].name) { });
return { return parentHolding
name: holding.name ? {
? holding.name + ' (' + symbol + ')'
: symbol,
allocationInPercentage: allocationInPercentage:
parentHoldings[index].valueInBaseCurrency / value, parentHolding.valueInBaseCurrency / value,
valueInBaseCurrency: name: holding.name,
parentHoldings[index].valueInBaseCurrency symbol: prettifySymbol(symbol),
}; valueInBaseCurrency: parentHolding.valueInBaseCurrency
}
} }
: null;
} }
return null; return null;
@ -515,7 +512,8 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
.filter((item) => null !== item) .filter((item) => null !== item)
.sort((a, b) => { .sort((a, b) => {
return b.allocationInPercentage - a.allocationInPercentage; return b.allocationInPercentage - a.allocationInPercentage;
}) }),
valueInBaseCurrency: value
}; };
}) })
.sort((a, b) => { .sort((a, b) => {

2
libs/common/src/lib/interfaces/index.ts

@ -80,8 +80,8 @@ export {
Filter, Filter,
FilterGroup, FilterGroup,
HistoricalDataItem, HistoricalDataItem,
HoldingWithParents,
Holding, Holding,
HoldingWithParents,
ImportResponse, ImportResponse,
InfoItem, InfoItem,
InvestmentItem, InvestmentItem,

4
libs/ui/src/lib/top-holdings/top-holdings.component.html

@ -73,7 +73,9 @@
@for (parentHolding of element.parents; track parentHolding) { @for (parentHolding of element.parents; track parentHolding) {
<mat-list-item> <mat-list-item>
<span matListItemTitle style="font-size: inherit" <span matListItemTitle style="font-size: inherit"
>{{ parentHolding.name }}:</span >{{ parentHolding.name }} ({{
parentHolding.symbol
}}):</span
> >
<span matListItemMeta> <span matListItemMeta>
<gf-value <gf-value

10
libs/ui/src/lib/top-holdings/top-holdings.component.scss

@ -18,4 +18,14 @@
tr:not(.expanded) + tr.holding-detail td { tr:not(.expanded) + tr.holding-detail td {
border-bottom: 0; border-bottom: 0;
} }
.holdingParents {
padding: 1em 0;
table,
tr,
td {
background-color: transparent;
}
}
} }

Loading…
Cancel
Save