From 146fcfc16d506f2189750f608bb036dc78ae1e1b Mon Sep 17 00:00:00 2001 From: softsimon Date: Sun, 14 Mar 2021 02:42:14 +0700 Subject: [PATCH] Bisq markets: Hide altcoins when not in official bisq markets mode --- .../bisq-dashboard/bisq-dashboard.component.ts | 14 +++++++++++++- .../app/bisq/bisq-market/bisq-market.component.ts | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/bisq/bisq-dashboard/bisq-dashboard.component.ts b/frontend/src/app/bisq/bisq-dashboard/bisq-dashboard.component.ts index 497382c12..e1770e1bd 100644 --- a/frontend/src/app/bisq/bisq-dashboard/bisq-dashboard.component.ts +++ b/frontend/src/app/bisq/bisq-dashboard/bisq-dashboard.component.ts @@ -1,6 +1,7 @@ import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { Observable, combineLatest } from 'rxjs'; -import { map } from 'rxjs/operators'; +import { filter, map } from 'rxjs/operators'; +import { StateService } from 'src/app/services/state.service'; import { WebsocketService } from 'src/app/services/websocket.service'; import { BisqApiService } from '../bisq-api.service'; @@ -12,10 +13,12 @@ import { BisqApiService } from '../bisq-api.service'; }) export class BisqDashboardComponent implements OnInit { tickers$: Observable; + allowCryptoCoins = ['usdc', 'l-btc', 'bsq']; constructor( private websocketService: WebsocketService, private bisqApiService: BisqApiService, + private stateService: StateService, ) { } ngOnInit(): void { @@ -28,8 +31,17 @@ export class BisqDashboardComponent implements OnInit { ]) .pipe( map(([tickers, markets, volumes]) => { + const newTickers = []; for (const t in tickers) { + + if (!this.stateService.env.OFFICIAL_BISQ_MARKETS) { + const pair = t.split('_'); + if (pair[1] === 'btc' && this.allowCryptoCoins.indexOf(pair[0]) === -1) { + continue; + } + } + tickers[t].pair_url = t; tickers[t].pair = t.replace('_', '/').toUpperCase(); tickers[t].market = markets[t]; diff --git a/frontend/src/app/bisq/bisq-market/bisq-market.component.ts b/frontend/src/app/bisq/bisq-market/bisq-market.component.ts index de03e1aad..91205cd27 100644 --- a/frontend/src/app/bisq/bisq-market/bisq-market.component.ts +++ b/frontend/src/app/bisq/bisq-market/bisq-market.component.ts @@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/ import { FormBuilder, FormGroup } from '@angular/forms'; import { ActivatedRoute } from '@angular/router'; import { combineLatest, merge, Observable, of } from 'rxjs'; -import { filter, map, mergeAll, switchMap, tap } from 'rxjs/operators'; +import { map, switchMap } from 'rxjs/operators'; import { WebsocketService } from 'src/app/services/websocket.service'; import { BisqApiService } from '../bisq-api.service';