diff --git a/src/app/app-config.ts b/src/app/app-config.ts index 249df44..585e361 100644 --- a/src/app/app-config.ts +++ b/src/app/app-config.ts @@ -19,17 +19,18 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -type NetworkConfig = { +export type SubsquidConfig = { + archiveUrl: string, + explorerUrl: string; + giantSquidExplorerUrl: string; + giantSquidMainUrl: string; +} + +export type NetworkConfig = { [network: string]: { substrateRpcUrlArray: string[]; explorerWsUrlArray: string[]; - subsquid: { - archiveUrl: string, - explorerUrl: string; - giantSquidExplorerUrl: string; - giantSquidMainUrl: string; - balancesUrl: string; - }; + subsquid: SubsquidConfig; coingecko: { coinId: string; }; @@ -40,7 +41,9 @@ type NetworkConfig = { export class AppConfig { networks: NetworkConfig; - constructor(private readonly http: HttpClient) {} + constructor(private readonly http: HttpClient) { + } + public load(): Promise { return this.http .get('assets/config.json') diff --git a/src/app/components/ps-connection-dialog/ps-connection-dialog.component.html b/src/app/components/ps-connection-dialog/ps-connection-dialog.component.html index a497163..400fd50 100644 --- a/src/app/components/ps-connection-dialog/ps-connection-dialog.component.html +++ b/src/app/components/ps-connection-dialog/ps-connection-dialog.component.html @@ -16,75 +16,124 @@ ~ along with this program. If not, see . --> -

{{vars.network|async}} connection

+

{{vars.network|async}} connections

Your browser is offline

Select or enter connection endpoints:

-
- - {{vars.network|async}} node URL - - - - {{option}} - - - - - - - - - - (connected) - (connecting) - - - - (error) + + + Node URL + + + + {{option}} + + + + + + + + + + (connected) + (connecting) + + (error) + - + + -
- - {{vars.network|async}} Polkascan URL - - - - {{option}} - - - - - - - - - - (connected) - (connecting) - - - - (error) + + + Polkascan URL + + + + {{option}} + + + + + + + + + + (connected) + (connecting) + + (error) + + + + {{ dataErrorCount }} errors + + +
+ + Subsquid Archive URL + + + + + Subsquid Explorer URL + + + + + Subsquid Giant Squid Explorer URL + + + + + Subsquid Giant Squid Main URL + + +
- {{ dataErrorCount }} errors -
diff --git a/src/app/components/ps-connection-dialog/ps-connection-dialog.component.ts b/src/app/components/ps-connection-dialog/ps-connection-dialog.component.ts index 621169f..2ae27e1 100644 --- a/src/app/components/ps-connection-dialog/ps-connection-dialog.component.ts +++ b/src/app/components/ps-connection-dialog/ps-connection-dialog.component.ts @@ -24,12 +24,13 @@ import { ViewEncapsulation } from '@angular/core'; import { FormControl, FormGroup } from '@angular/forms'; -import { Subject } from 'rxjs'; -import { takeUntil } from 'rxjs/operators'; +import { combineLatestWith, map, Observable, Subject, take } from 'rxjs'; +import { filter, takeUntil } from 'rxjs/operators'; import { PolkadaptService } from '../../services/polkadapt.service'; import { MatDialogRef } from '@angular/material/dialog'; import { VariablesService } from '../../services/variables.service'; import { NetworkService } from '../../services/network.service'; +import { AppConfig, SubsquidConfig } from '../../app-config'; @Component({ templateUrl: 'ps-connection-dialog.component.html', @@ -46,13 +47,16 @@ export class PsConnectionDialogComponent implements OnInit, OnDestroy { url: new FormControl('') }); + subsquidUrls: Observable | undefined; + private destroyer = new Subject(); constructor( public dialogRef: MatDialogRef, public pa: PolkadaptService, public ns: NetworkService, - public vars: VariablesService + public vars: VariablesService, + private config: AppConfig ) { } @@ -68,6 +72,17 @@ export class PsConnectionDialogComponent implements OnInit, OnDestroy { this.explorerWsUrlForm.setValue({url}); } }); + + this.subsquidUrls = this.pa.subsquidRegistered.pipe( + combineLatestWith(this.ns.currentNetwork), + map(([registered, network]) => { + if (registered) { + const config = this.config?.networks[network]; + return config.subsquid; + } + return null; + }) + ) } ngOnDestroy(): void { diff --git a/src/app/pages/network/network.component.html b/src/app/pages/network/network.component.html index b3ab882..0fc5939 100644 --- a/src/app/pages/network/network.component.html +++ b/src/app/pages/network/network.component.html @@ -22,4 +22,11 @@
+
+
Provided by Subsquid.
+
Polkascan Foundation offers no warranties or guarantees concerning the accuracy of the data provided.
+
+ +
+
diff --git a/src/app/pages/network/network.component.scss b/src/app/pages/network/network.component.scss index 2fcbd24..0d7dfa5 100644 --- a/src/app/pages/network/network.component.scss +++ b/src/app/pages/network/network.component.scss @@ -17,5 +17,20 @@ */ .network-explorer-container { - padding-bottom: 100px; + padding-bottom: 120px; +} + +.network-explorer-bottom-bar { + position: fixed; + bottom: 0; + left: 0; + right: 0; + z-index: 1000; + display: flex; + justify-content: space-between; + align-items: center; + column-gap: 16px; + background: var(--ps-top-bar-bg-color); + color: var(--ps-top-bar-text-color); + padding: 0 8px; } diff --git a/src/app/pages/network/network.component.ts b/src/app/pages/network/network.component.ts index 65e9ba8..cdb5472 100644 --- a/src/app/pages/network/network.component.ts +++ b/src/app/pages/network/network.component.ts @@ -20,8 +20,10 @@ import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/ import { ActivatedRoute } from '@angular/router'; import { distinctUntilChanged, filter, map, switchMap, takeUntil } from 'rxjs/operators'; import { NetworkService } from '../../services/network.service'; -import { Subject } from 'rxjs'; +import { combineLatestWith, Observable, Subject } from 'rxjs'; import { VariablesService } from '../../services/variables.service'; +import { PolkadaptService } from '../../services/polkadapt.service'; +import { AppConfig } from '../../app-config'; @Component({ selector: 'app-network', @@ -30,11 +32,17 @@ import { VariablesService } from '../../services/variables.service'; changeDetection: ChangeDetectionStrategy.OnPush }) export class NetworkComponent implements OnInit, OnDestroy { + subsquidRegistered: Observable; + showBottomBar = true; + private destroyer = new Subject(); constructor(private route: ActivatedRoute, private ns: NetworkService, - public vars: VariablesService) { + private pa: PolkadaptService, + public vars: VariablesService + ) { + this.subsquidRegistered = this.pa.subsquidRegistered.asObservable(); } ngOnInit(): void {