13
13
See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
- import { Component , OnInit , LOCALE_ID , Inject , DestroyRef , inject } from "@angular/core" ;
16
+ import {
17
+ Component ,
18
+ OnInit ,
19
+ LOCALE_ID ,
20
+ Inject ,
21
+ DestroyRef ,
22
+ inject ,
23
+ } from "@angular/core" ;
17
24
import { ActivatedRoute , Router } from "@angular/router" ;
18
25
import {
19
26
trigger ,
@@ -59,7 +66,7 @@ export class CbdetailComponent extends DetailBase implements OnInit {
59
66
private route : ActivatedRoute ,
60
67
private router : Router ,
61
68
private serviceCb : CoinbaseService ,
62
- @Inject ( LOCALE_ID ) private myLocale : string
69
+ @Inject ( LOCALE_ID ) private myLocale : string ,
63
70
) {
64
71
super ( myLocale ) ;
65
72
this . BTCUSD = this . serviceCb . BTCUSD ;
@@ -73,39 +80,44 @@ export class CbdetailComponent extends DetailBase implements OnInit {
73
80
this . currpair = params . currpair ;
74
81
this . myCurrPair = this . utils . getCurrpairName ( this . currpair ) ;
75
82
this . serviceCb
76
- . getCurrentQuote ( ) . pipe ( repeat ( { delay : 10000 } ) , takeUntilDestroyed ( this . destroy ) )
83
+ . getCurrentQuote ( )
84
+ . pipe ( repeat ( { delay : 10000 } ) , takeUntilDestroyed ( this . destroy ) )
77
85
. subscribe ( ( quote ) => ( this . currQuote = quote ) ) ;
78
- this . serviceCb . getTodayQuotes ( ) . pipe ( takeUntilDestroyed ( this . destroy ) ) . subscribe ( ( quotes ) => {
79
- this . todayQuotes = quotes ;
80
- if ( this . currpair === this . serviceCb . BTCUSD ) {
81
- this . updateChartData (
82
- quotes . map (
83
- ( quote ) => new Tuple < string , number > ( quote . createdAt , quote . usd )
84
- )
85
- ) ;
86
- } else if ( this . currpair === this . serviceCb . ETHUSD ) {
87
- this . updateChartData (
88
- quotes . map (
89
- ( quote ) =>
90
- new Tuple < string , number > (
91
- quote . createdAt ,
92
- quote . usd / quote . eth
93
- )
94
- )
95
- ) ;
96
- } else if ( this . currpair === this . serviceCb . LTCUSD ) {
97
- this . updateChartData (
98
- quotes . map (
99
- ( quote ) =>
100
- new Tuple < string , number > (
101
- quote . createdAt ,
102
- quote . usd / quote . ltc
103
- )
104
- )
105
- ) ;
106
- }
107
- this . chartShow . next ( true ) ;
108
- } ) ;
86
+ this . serviceCb
87
+ . getTodayQuotes ( )
88
+ . pipe ( takeUntilDestroyed ( this . destroy ) )
89
+ . subscribe ( ( quotes ) => {
90
+ this . todayQuotes = quotes ;
91
+ if ( this . currpair === this . serviceCb . BTCUSD ) {
92
+ this . updateChartData (
93
+ quotes . map (
94
+ ( quote ) =>
95
+ new Tuple < string , number > ( quote . createdAt , quote . usd ) ,
96
+ ) ,
97
+ ) ;
98
+ } else if ( this . currpair === this . serviceCb . ETHUSD ) {
99
+ this . updateChartData (
100
+ quotes . map (
101
+ ( quote ) =>
102
+ new Tuple < string , number > (
103
+ quote . createdAt ,
104
+ quote . usd / quote . eth ,
105
+ ) ,
106
+ ) ,
107
+ ) ;
108
+ } else if ( this . currpair === this . serviceCb . LTCUSD ) {
109
+ this . updateChartData (
110
+ quotes . map (
111
+ ( quote ) =>
112
+ new Tuple < string , number > (
113
+ quote . createdAt ,
114
+ quote . usd / quote . ltc ,
115
+ ) ,
116
+ ) ,
117
+ ) ;
118
+ }
119
+ this . chartShow . next ( true ) ;
120
+ } ) ;
109
121
} ) ;
110
122
}
111
123
@@ -137,22 +149,22 @@ export class CbdetailComponent extends DetailBase implements OnInit {
137
149
if ( this . currpair === this . serviceCb . BTCUSD ) {
138
150
this . updateChartData (
139
151
quotes . map (
140
- ( quote ) => new Tuple < string , number > ( quote . createdAt , quote . usd )
141
- )
152
+ ( quote ) => new Tuple < string , number > ( quote . createdAt , quote . usd ) ,
153
+ ) ,
142
154
) ;
143
155
} else if ( this . currpair === this . serviceCb . ETHUSD ) {
144
156
this . updateChartData (
145
157
quotes . map (
146
158
( quote ) =>
147
- new Tuple < string , number > ( quote . createdAt , quote . usd / quote . eth )
148
- )
159
+ new Tuple < string , number > ( quote . createdAt , quote . usd / quote . eth ) ,
160
+ ) ,
149
161
) ;
150
162
} else if ( this . currpair === this . serviceCb . LTCUSD ) {
151
163
this . updateChartData (
152
164
quotes . map (
153
165
( quote ) =>
154
- new Tuple < string , number > ( quote . createdAt , quote . usd / quote . ltc )
155
- )
166
+ new Tuple < string , number > ( quote . createdAt , quote . usd / quote . ltc ) ,
167
+ ) ,
156
168
) ;
157
169
}
158
170
this . chartShow . next ( true ) ;
0 commit comments