Skip to content

Commit 113c3bc

Browse files
committedNov 18, 2023
fix: format
1 parent db172b6 commit 113c3bc

20 files changed

+307
-213
lines changed
 

‎frontend/src/angular/src/app/common/detail-base.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ import { CommonUtils } from "./common-utils";
1414
import { ChartPoint, ChartPoints } from "ngx-simple-charts/line";
1515

1616
export class Tuple<A, B> {
17-
constructor(private myA: A, private myB: B) {}
17+
constructor(
18+
private myA: A,
19+
private myB: B,
20+
) {}
1821

1922
// eslint-disable-next-line @typescript-eslint/naming-convention
2023
get A() {
@@ -39,7 +42,7 @@ export abstract class DetailBase {
3942
protected updateChartData(values: Tuple<string, number>[]): void {
4043
const myChartPoint = values
4144
.filter((value) => value.B > 0.009)
42-
.map((myCP) => ({ x: new Date(myCP.A), y: myCP.B } as ChartPoint));
45+
.map((myCP) => ({ x: new Date(myCP.A), y: myCP.B }) as ChartPoint);
4346
this.chartPoints = [
4447
{
4548
name: this.currPair,

‎frontend/src/angular/src/app/details/bfdetail/bfdetail.component.ts

+22-11
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
import { Component, OnInit, Inject, LOCALE_ID, DestroyRef, inject } from "@angular/core";
16+
import {
17+
Component,
18+
OnInit,
19+
Inject,
20+
LOCALE_ID,
21+
DestroyRef,
22+
inject,
23+
} from "@angular/core";
1724
import { ActivatedRoute, Router } from "@angular/router";
1825
import {
1926
trigger,
@@ -51,27 +58,31 @@ export class BfdetailComponent extends DetailBase implements OnInit {
5158
private route: ActivatedRoute,
5259
private router: Router,
5360
private serviceBf: BitfinexService,
54-
@Inject(LOCALE_ID) private myLocale: string
61+
@Inject(LOCALE_ID) private myLocale: string,
5562
) {
5663
super(myLocale);
5764
}
5865

5966
ngOnInit() {
6067
this.chartShow.next(false);
6168
this.route.params.subscribe((params) => {
62-
this.serviceBf.getCurrentQuote(params.currpair).pipe(repeat({delay: 10000}), takeUntilDestroyed(this.destroy)).subscribe((quote) => {
63-
this.currQuote = quote;
64-
this.currPair = this.utils.getCurrpairName(this.currQuote.pair);
65-
});
6669
this.serviceBf
67-
.getTodayQuotes(this.route.snapshot.paramMap.get("currpair")).pipe(takeUntilDestroyed(this.destroy))
70+
.getCurrentQuote(params.currpair)
71+
.pipe(repeat({ delay: 10000 }), takeUntilDestroyed(this.destroy))
72+
.subscribe((quote) => {
73+
this.currQuote = quote;
74+
this.currPair = this.utils.getCurrpairName(this.currQuote.pair);
75+
});
76+
this.serviceBf
77+
.getTodayQuotes(this.route.snapshot.paramMap.get("currpair"))
78+
.pipe(takeUntilDestroyed(this.destroy))
6879
.subscribe((quotes) => {
6980
this.todayQuotes = quotes;
7081
this.updateChartData(
7182
quotes.map(
7283
(quote) =>
73-
new Tuple<string, number>(quote.createdAt, quote.last_price)
74-
)
84+
new Tuple<string, number>(quote.createdAt, quote.last_price),
85+
),
7586
);
7687
this.chartShow.next(true);
7788
});
@@ -105,8 +116,8 @@ export class BfdetailComponent extends DetailBase implements OnInit {
105116
this.updateChartData(
106117
quotes.map(
107118
(quote) =>
108-
new Tuple<string, number>(quote.createdAt, quote.last_price)
109-
)
119+
new Tuple<string, number>(quote.createdAt, quote.last_price),
120+
),
110121
);
111122
this.chartShow.next(true);
112123
});

‎frontend/src/angular/src/app/details/bsdetail/bsdetail.component.ts

+22-11
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
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";
1724
import { ActivatedRoute, Router } from "@angular/router";
1825
import {
1926
trigger,
@@ -51,26 +58,30 @@ export class BsdetailComponent extends DetailBase implements OnInit {
5158
private route: ActivatedRoute,
5259
private router: Router,
5360
private serviceBs: BitstampService,
54-
@Inject(LOCALE_ID) private myLocale: string
61+
@Inject(LOCALE_ID) private myLocale: string,
5562
) {
5663
super(myLocale);
5764
}
5865

5966
ngOnInit() {
6067
this.chartShow.next(false);
6168
this.route.params.subscribe((params) => {
62-
this.serviceBs.getCurrentQuote(params.currpair).pipe(repeat({delay: 10000}), takeUntilDestroyed(this.destroy)).subscribe((quote) => {
63-
this.currQuote = quote;
64-
this.currPair = this.utils.getCurrpairName(this.currQuote.pair);
65-
});
6669
this.serviceBs
67-
.getTodayQuotes(this.route.snapshot.paramMap.get("currpair")).pipe(takeUntilDestroyed(this.destroy))
70+
.getCurrentQuote(params.currpair)
71+
.pipe(repeat({ delay: 10000 }), takeUntilDestroyed(this.destroy))
72+
.subscribe((quote) => {
73+
this.currQuote = quote;
74+
this.currPair = this.utils.getCurrpairName(this.currQuote.pair);
75+
});
76+
this.serviceBs
77+
.getTodayQuotes(this.route.snapshot.paramMap.get("currpair"))
78+
.pipe(takeUntilDestroyed(this.destroy))
6879
.subscribe((quotes) => {
6980
this.todayQuotes = quotes;
7081
this.updateChartData(
7182
quotes.map(
72-
(quote) => new Tuple<string, number>(quote.createdAt, quote.last)
73-
)
83+
(quote) => new Tuple<string, number>(quote.createdAt, quote.last),
84+
),
7485
);
7586
this.chartShow.next(true);
7687
});
@@ -103,8 +114,8 @@ export class BsdetailComponent extends DetailBase implements OnInit {
103114
this.todayQuotes = quotes;
104115
this.updateChartData(
105116
quotes.map(
106-
(quote) => new Tuple<string, number>(quote.createdAt, quote.last)
107-
)
117+
(quote) => new Tuple<string, number>(quote.createdAt, quote.last),
118+
),
108119
);
109120
this.chartShow.next(true);
110121
});

‎frontend/src/angular/src/app/details/cbdetail/cbdetail.component.ts

+52-40
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
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";
1724
import { ActivatedRoute, Router } from "@angular/router";
1825
import {
1926
trigger,
@@ -59,7 +66,7 @@ export class CbdetailComponent extends DetailBase implements OnInit {
5966
private route: ActivatedRoute,
6067
private router: Router,
6168
private serviceCb: CoinbaseService,
62-
@Inject(LOCALE_ID) private myLocale: string
69+
@Inject(LOCALE_ID) private myLocale: string,
6370
) {
6471
super(myLocale);
6572
this.BTCUSD = this.serviceCb.BTCUSD;
@@ -73,39 +80,44 @@ export class CbdetailComponent extends DetailBase implements OnInit {
7380
this.currpair = params.currpair;
7481
this.myCurrPair = this.utils.getCurrpairName(this.currpair);
7582
this.serviceCb
76-
.getCurrentQuote().pipe(repeat({delay: 10000}), takeUntilDestroyed(this.destroy))
83+
.getCurrentQuote()
84+
.pipe(repeat({ delay: 10000 }), takeUntilDestroyed(this.destroy))
7785
.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+
});
109121
});
110122
}
111123

@@ -137,22 +149,22 @@ export class CbdetailComponent extends DetailBase implements OnInit {
137149
if (this.currpair === this.serviceCb.BTCUSD) {
138150
this.updateChartData(
139151
quotes.map(
140-
(quote) => new Tuple<string, number>(quote.createdAt, quote.usd)
141-
)
152+
(quote) => new Tuple<string, number>(quote.createdAt, quote.usd),
153+
),
142154
);
143155
} else if (this.currpair === this.serviceCb.ETHUSD) {
144156
this.updateChartData(
145157
quotes.map(
146158
(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+
),
149161
);
150162
} else if (this.currpair === this.serviceCb.LTCUSD) {
151163
this.updateChartData(
152164
quotes.map(
153165
(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+
),
156168
);
157169
}
158170
this.chartShow.next(true);

‎frontend/src/angular/src/app/details/ibdetail/ibdetail.component.ts

+27-15
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
import { Component, OnInit, Inject, LOCALE_ID, DestroyRef, inject } from "@angular/core";
16+
import {
17+
Component,
18+
OnInit,
19+
Inject,
20+
LOCALE_ID,
21+
DestroyRef,
22+
inject,
23+
} from "@angular/core";
1724
import { ActivatedRoute, Router } from "@angular/router";
1825
import {
1926
trigger,
@@ -51,7 +58,7 @@ export class IbdetailComponent extends DetailBase implements OnInit {
5158
private route: ActivatedRoute,
5259
private router: Router,
5360
private serviceIb: ItbitService,
54-
@Inject(LOCALE_ID) private myLocale: string
61+
@Inject(LOCALE_ID) private myLocale: string,
5562
) {
5663
super(myLocale);
5764
}
@@ -61,18 +68,22 @@ export class IbdetailComponent extends DetailBase implements OnInit {
6168
this.route.params.subscribe((params) => {
6269
this.currPair = params.currpair;
6370
this.serviceIb
64-
.getCurrentQuote(this.currPair).pipe(repeat({delay: 10000}), takeUntilDestroyed(this.destroy))
71+
.getCurrentQuote(this.currPair)
72+
.pipe(repeat({ delay: 10000 }), takeUntilDestroyed(this.destroy))
6573
.subscribe((quote) => (this.currQuote = quote));
66-
this.serviceIb.getTodayQuotes(this.currPair).pipe(takeUntilDestroyed(this.destroy)).subscribe((quotes) => {
67-
this.todayQuotes = quotes;
68-
this.updateChartData(
69-
quotes.map(
70-
(quote) =>
71-
new Tuple<string, number>(quote.createdAt, quote.lastPrice)
72-
)
73-
);
74-
this.chartShow.next(true);
75-
});
74+
this.serviceIb
75+
.getTodayQuotes(this.currPair)
76+
.pipe(takeUntilDestroyed(this.destroy))
77+
.subscribe((quotes) => {
78+
this.todayQuotes = quotes;
79+
this.updateChartData(
80+
quotes.map(
81+
(quote) =>
82+
new Tuple<string, number>(quote.createdAt, quote.lastPrice),
83+
),
84+
);
85+
this.chartShow.next(true);
86+
});
7687
});
7788
}
7889

@@ -101,8 +112,9 @@ export class IbdetailComponent extends DetailBase implements OnInit {
101112
this.todayQuotes = quotes;
102113
this.updateChartData(
103114
quotes.map(
104-
(quote) => new Tuple<string, number>(quote.createdAt, quote.lastPrice)
105-
)
115+
(quote) =>
116+
new Tuple<string, number>(quote.createdAt, quote.lastPrice),
117+
),
106118
);
107119
this.chartShow.next(true);
108120
});

0 commit comments

Comments
 (0)