1
1
@page " /"
2
+ @using Model
3
+ @using Services
4
+ @using Utils
5
+ <style >
6
+ .demo-mat-card {
7
+ margin-bottom : 2em ;
8
+ }
2
9
3
- <h1 >Hello, world!</h1 >
10
+ .demo-mat-card-content {
11
+ padding : 1rem ;
12
+ }
4
13
5
- Welcome to KIV/NET app.
14
+ .clear-margin {
15
+ margin : 0px ;
16
+ }
17
+ </style >
18
+ <div class =" mat-layout-grid mat-layout-grid-align-center" >
19
+ <div class =" mat-layout-grid-inner center" >
20
+
21
+ <div class =" mat-layout-grid-cell mat-layout-grid-cell-span-3" ></div >
22
+ <div class =" mat-layout-grid-cell mat-layout-grid-cell-span-6" >
23
+ <MatCard class =" demo-mat-card" >
24
+ <MatCardContent >
25
+ <div class =" demo-mat-card-content" >
26
+ <MatHeadline6 class =" clear-margin" >
27
+ <MatChipSet Style =" align-items: center" >
28
+ <MatH5 Class =" clear-margin" >@activePortfolio.Name </MatH5 >
29
+ <MatChip Style =" vertical-align: center" Label =" @CurrencyUtils.GetCurrencyLabel(activePortfolio.Currency)" />
30
+ </MatChipSet >
31
+ </MatHeadline6 >
32
+ </div >
33
+
34
+ <MatBody2 class =" demo-mat-card-content clear-margin" >
35
+ <div class =" mat-layout-grid" >
36
+ <div class =" mat-layout-grid-inner" style =" align-items : center " >
37
+ <div class =" mat-layout-grid-cell mat-layout-grid-cell-span-6" >
38
+ <MatH4 Class =" clear-margin" >@( CurrencyUtils .Format (portfolioSummary .MarketValue , activePortfolio .Currency )) </MatH4 >
39
+ </div >
40
+ <div class =" mat-layout-grid-cell mat-layout-grid-cell-span-6" style =" text-align : end " >
41
+ @( portfolioSummary .RelativeChange * 100 m ) %
42
+ </div >
43
+ </div >
44
+ </div >
45
+ </MatBody2 >
46
+ </MatCardContent >
47
+ </MatCard >
48
+ <MatTable Items =" @portfolioEntryRows" Striped =" true" AllowSelection =" true" RowClass =" tester" class =" mat-elevation-z5" ShowPaging =" false" PageSize =" 9999" >
49
+ <MatTableHeader >
50
+ <th >Coin</th >
51
+ <th >Price</th >
52
+ <th >Change (1h)</th >
53
+ <th >Holdings</th >
54
+ </MatTableHeader >
55
+ <MatTableRow >
56
+ <td >@context.symbol.ToUpper() </td >
57
+ <td >@( CurrencyUtils .Format (context .currentPrice , activePortfolio .Currency )) </td >
58
+ <td style =' color : @(context.relativeChange >= 0 ? " #17a104" : " #FF0000" )' >@context.relativeChange %</td >
59
+ <td >@context.percentage %</td >
60
+ </MatTableRow >
61
+ </MatTable >
62
+ </div >
63
+ <div class =" mat-layout-grid-cell mat-layout-grid-cell-span-3" ></div >
64
+ </div >
65
+ </div >
66
+
67
+
68
+ @code
69
+ {
70
+ protected Portfolio activePortfolio = new Portfolio (" Main Portfolio" , " My main portfolio to be used" , Currency .Usd );
71
+
72
+ protected ISummaryService .Summary portfolioSummary = new (1341 m , 1 . 8 m , 9982 . 489 m , 1000 m );
73
+
74
+ protected List <PortfolioEntry > activePortfolioEntries = new List <PortfolioEntry >()
75
+ {
76
+ new (" btc" , 1 , 1 ),
77
+ new (" ada" , 1 , 2 ),
78
+ new (" eth" , 1 , 3 ),
79
+ new (" ltc" , 1 , 4 ),
80
+ new (" link" , 1 , 5 ),
81
+ };
82
+
83
+ protected List <decimal > portfolioHoldings = new ()
84
+ {
85
+ 44 . 8886 m ,
86
+ 28 . 18 m ,
87
+ 10 . 116 m ,
88
+ 9 . 38 m ,
89
+ 2 . 70 m ,
90
+ };
91
+
92
+ protected List <PortfolioEntryRow > portfolioEntryRows = new ()
93
+ {
94
+ new (" btc" , 57644 . 42 m , 1 . 35 m , 44 . 76 m ),
95
+ new (" ada" , 1 . 36 m , 0 . 58 m , 28 . 18 m ),
96
+ new (" eth" , 3279 . 64 m , 10 . 95 m , 27 . 11 m ),
97
+ new (" ltc" , 291 . 55 m , 7 . 20 m , 9 . 38 m ),
98
+ new (" link" , 42 . 20 m , - 5 . 19 m , 2 . 70 m )
99
+ };
100
+
101
+ protected record PortfolioEntryRow (string symbol , decimal currentPrice , decimal relativeChange , decimal percentage );
102
+
103
+ protected override async Task OnInitializedAsync ()
104
+ {
105
+ // _existingPortfolios = PortfolioService.GetPortfolios();
106
+ }
107
+
108
+ }
0 commit comments