Browse Source

Refactoring

pull/4044/head
Thomas Kaul 9 months ago
parent
commit
b99d167ddc
  1. 18
      apps/client/src/app/pages/portfolio/allocations/allocations-page.component.ts
  2. 3
      libs/ui/src/lib/top-holdings/top-holdings.component.html
  3. 2
      libs/ui/src/lib/top-holdings/top-holdings.component.scss

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

@ -493,24 +493,30 @@ export class AllocationsPageComponent implements OnDestroy, OnInit {
parents: Object.entries(this.portfolioDetails.holdings) parents: Object.entries(this.portfolioDetails.holdings)
.map(([symbol, holding]) => { .map(([symbol, holding]) => {
if (holding.holdings.length > 0) { if (holding.holdings.length > 0) {
const parentHolding = holding.holdings.find((parentHolding) => { const currentParentHolding = holding.holdings.find(
(parentHolding) => {
return parentHolding.name === name; return parentHolding.name === name;
}); }
return parentHolding );
return currentParentHolding
? { ? {
allocationInPercentage: allocationInPercentage:
parentHolding.valueInBaseCurrency / value, currentParentHolding.valueInBaseCurrency / value,
name: holding.name, name: holding.name,
position: holding, position: holding,
symbol: prettifySymbol(symbol), symbol: prettifySymbol(symbol),
valueInBaseCurrency: parentHolding.valueInBaseCurrency valueInBaseCurrency:
currentParentHolding.valueInBaseCurrency
} }
: null; : null;
} }
return null; return null;
}) })
.filter((item) => null !== item) .filter((item) => {
return item !== null;
})
.sort((a, b) => { .sort((a, b) => {
return b.allocationInPercentage - a.allocationInPercentage; return b.allocationInPercentage - a.allocationInPercentage;
}), }),

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

@ -3,7 +3,6 @@
class="gf-table holdings-table w-100" class="gf-table holdings-table w-100"
mat-table mat-table
multiTemplateDataRows multiTemplateDataRows
style="table-layout: auto"
[dataSource]="dataSource" [dataSource]="dataSource"
> >
<colgroup> <colgroup>
@ -116,8 +115,8 @@
></tr> ></tr>
<tr <tr
*matFooterRowDef="displayedColumns" *matFooterRowDef="displayedColumns"
class="hidden"
mat-footer-row mat-footer-row
style="visibility: hidden"
></tr> ></tr>
</table> </table>
</div> </div>

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

@ -2,6 +2,8 @@
display: block; display: block;
.holdings-table { .holdings-table {
table-layout: auto;
tr { tr {
&:not(.expanded) + tr.holding-detail td { &:not(.expanded) + tr.holding-detail td {
border-bottom: 0; border-bottom: 0;

Loading…
Cancel
Save