Skip to content

Commit 5155b40

Browse files
committed
Improved the PortfolioDetail.razor page by changing the portfolio card.
1 parent bd6ee8a commit 5155b40

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

WebFrontend/Pages/PortfolioDetail.razor

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,18 @@
4949
<MatChip Style="vertical-align: center" Label="@CurrencyUtils.GetCurrencyLabel(ActivePortfolio.Currency)"/>
5050
</MatChipSet>
5151
</MatHeadline6>
52+
<span style="padding-left: 4px;">@ActivePortfolio.Description</span>
5253
</div>
53-
5454
<MatBody2 class="demo-mat-card-content clear-margin">
5555
<div class="mat-layout-grid">
5656
<div class="mat-layout-grid-inner" style="align-items: center">
5757
@if (PortfolioSummary != null)
5858
{
5959
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-6">
60-
61-
<MatH4 Class="clear-margin">@(CurrencyUtils.Format(PortfolioSummary.MarketValue, ActivePortfolio.Currency))</MatH4>
60+
<LabelDecimalValue Label="Market Value" Value="@(CurrencyUtils.Format(PortfolioSummary.MarketValue, ActivePortfolio.Currency))"></LabelDecimalValue>
6261
</div>
6362
<div class="mat-layout-grid-cell mat-layout-grid-cell-span-6" style="text-align: end">
64-
@(DecimalUtils.FormatTwoDecimalPlacesWithPlusSign(PortfolioSummary.RelativeChange * 100m)) %
63+
<LabelDecimalValue Positive="PortfolioSummary.RelativeChange >= 0" ValueColorBasedOnValue="true" Label="Total Change" Value="@(DecimalUtils.FormatTwoDecimalPlacesWithPlusSign(PortfolioSummary.RelativeChange * 100m) + "%")"></LabelDecimalValue>
6564
</div>
6665
}
6766
else
@@ -79,14 +78,14 @@
7978
<MatTableHeader>
8079
<th>Coin</th>
8180
<th>Price</th>
82-
<th>Change (1h)</th>
81+
<th>Price change (1h)</th>
8382
<th>Holdings</th>
8483
</MatTableHeader>
8584
<MatTableRow>
8685
<td>@context.Symbol.ToUpper()</td>
87-
<td>@(CurrencyUtils.Format(context.CurrentPrice, ActivePortfolio.Currency))</td>
88-
<td style='color: @(context.RelativeChange >= 0 ? "#17a104" : "#FF0000")'>@DecimalUtils.FormatTwoDecimalPlaces(context.RelativeChange)%</td>
89-
<td>@context.Percentage%</td>
86+
<td><div style="min-width: 8rem">@(CurrencyUtils.Format(context.CurrentPrice, ActivePortfolio.Currency))</div></td>
87+
<td style='color: @(context.RelativeChange >= 0 ? "#17a104" : "#FF0000"); min-width: 7rem;'><div style="min-width: 6rem">@DecimalUtils.FormatTwoDecimalPlaces(context.RelativeChange)%</div></td>
88+
<td>@(CurrencyUtils.Format(context.MarketValue, ActivePortfolio.Currency)) (@(DecimalUtils.FormatTwoDecimalPlaces(context.Percentage))%)</td>
9089
</MatTableRow>
9190
</MatTable>
9291
}
@@ -119,7 +118,7 @@
119118

120119
protected List<PortfolioEntryRow> PortfolioEntryRows;
121120

122-
protected record PortfolioEntryRow(string Symbol, decimal CurrentPrice, decimal RelativeChange, decimal Percentage, int EntryId);
121+
protected record PortfolioEntryRow(string Symbol, decimal CurrentPrice, decimal RelativeChange, decimal Percentage, decimal AbsoluteChange, decimal MarketValue, int EntryId);
123122

124123
protected override void OnInitialized()
125124
{
@@ -189,8 +188,12 @@
189188
symbolsToMarketEntries[tuple.Second.Symbol].CurrentPrice,
190189
// asset's price change since the last 24h
191190
new decimal(symbolsToMarketEntries[tuple.Second.Symbol].PriceChangePercentage24H),
192-
// percentage within the portfolio
191+
// percentage within the portfolio entry
193192
portfolioTotalMarketValue > 0 ? (tuple.First.MarketValue / portfolioTotalMarketValue) * 100 : 0,
193+
// absolute change within the portfolio entry
194+
tuple.First.AbsoluteChange,
195+
// market value
196+
tuple.First.MarketValue,
194197
// pass the entry id
195198
tuple.Second.Id
196199
)

WebFrontend/Pages/PortfolioEntryDetail.razor

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,6 @@
293293

294294
void ShowOrderDetail(Tuple<MarketOrder, ISummaryService.Summary> order)
295295
{
296-
Console.WriteLine("here");
297296
OrderToBeShown = order;
298297
OrderDetailDialogIsOpen = true;
299298
StateHasChanged();
@@ -308,10 +307,8 @@
308307

309308
private void SelectionChangedEvent(object obj)
310309
{
311-
Console.WriteLine("show dialog");
312310
if (obj != null)
313311
{
314-
Console.WriteLine("showing dialog");
315312
ShowOrderDetail((Tuple<MarketOrder, ISummaryService.Summary>) obj) ;
316313
}
317314
}

0 commit comments

Comments
 (0)