Skip to content

Commit afdc409

Browse files
committed
feat(insight): scaffold routing, continue building out blocks view
1 parent e9aad69 commit afdc409

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+955
-184
lines changed

packages/bitcore-node/src/types/Query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const enum Direction {
1+
export const enum Direction {
22
ascending = 1,
33
descending = -1
44
}

packages/insight/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,5 @@ $RECYCLE.BIN/
3232
.DS_Store
3333
Thumbs.db
3434
UserInterfaceState.xcuserstate
35+
36+
proxy.conf.override.js*

packages/insight/angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"builder": "@angular-devkit/build-angular:dev-server",
7171
"options": {
7272
"browserTarget": "app:build",
73-
"proxyConfig": "proxy.conf.json"
73+
"proxyConfig": "proxy.conf.js"
7474
},
7575
"configurations": {
7676
"production": {

packages/insight/package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/insight/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"@angular/platform-browser": "~6.1.1",
4848
"@angular/platform-browser-dynamic": "~6.1.1",
4949
"@angular/router": "~6.1.1",
50+
"@ionic-native/app-preferences": "^5.0.0-beta.21",
5051
"@ionic-native/core": "5.0.0-beta.15",
5152
"@ionic-native/splash-screen": "5.0.0-beta.15",
5253
"@ionic-native/status-bar": "5.0.0-beta.15",

packages/insight/proxy.conf.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
let config;
2+
try {
3+
config = require('./proxy.conf.override');
4+
} catch (err) {
5+
config = {
6+
'/api': {
7+
target: {
8+
host: 'api.bitcore.io',
9+
protocol: 'https:',
10+
port: 443
11+
},
12+
secure: false,
13+
changeOrigin: true,
14+
logLevel: 'debug'
15+
}
16+
};
17+
}
18+
19+
module.exports = config;

packages/insight/proxy.conf.json

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,53 @@
11
import { NgModule } from '@angular/core';
2-
import { RouterModule, Routes } from '@angular/router';
2+
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
3+
import { environment } from '../environments/environment';
4+
import {
5+
AvailableChainGuard,
6+
availableChainsMatcher
7+
} from './guards/available-chain.guard';
38

49
const routes: Routes = [
510
{
611
path: '',
7-
redirectTo: 'home',
12+
redirectTo: `${environment.initialChain.code}/home`,
813
pathMatch: 'full'
914
},
1015
{
11-
path: 'home',
12-
loadChildren: './home/home.module#HomePageModule'
16+
matcher: availableChainsMatcher,
17+
canActivateChild: [AvailableChainGuard],
18+
children: [
19+
{
20+
path: '',
21+
redirectTo: `home`,
22+
pathMatch: 'full'
23+
},
24+
{
25+
path: 'home',
26+
loadChildren: './home/home.module#HomePageModule'
27+
},
28+
{
29+
path: 'blocks',
30+
loadChildren: './blocks/blocks.module#BlocksPageModule'
31+
},
32+
{
33+
path: 'block/:hash',
34+
loadChildren: './block/block.module#BlockPageModule'
35+
}
36+
]
1337
},
1438
{
15-
path: 'blocks',
16-
loadChildren: './blocks/blocks.module#BlocksPageModule'
39+
path: '**',
40+
loadChildren: './not-found/not-found.module#NotFoundPageModule'
1741
}
1842
];
1943

2044
@NgModule({
21-
imports: [RouterModule.forRoot(routes)],
45+
imports: [
46+
RouterModule.forRoot(routes, {
47+
enableTracing: !environment.production,
48+
preloadingStrategy: PreloadAllModules
49+
})
50+
],
2251
exports: [RouterModule]
2352
})
2453
export class AppRoutingModule {}

packages/insight/src/app/app.component.html

Lines changed: 106 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,120 @@
66
padding
77
>
88
<ion-list>
9-
<ion-menu-toggle
10-
auto-hide="false"
11-
*ngFor="let p of appPages"
12-
>
9+
<ion-menu-toggle auto-hide="false">
1310
<ion-item
1411
[routerDirection]="'root'"
15-
[routerLink]="[p.url]"
12+
[routerLink]="['/' + (config.currentChain$ | async).code + '/home']"
13+
routerLinkActive="active"
1614
>
17-
<ion-label>{{ p.title }}</ion-label>
15+
<ion-label>Home</ion-label>
1816
</ion-item>
17+
<ion-item
18+
[routerDirection]="'root'"
19+
[routerLink]="['/' + (config.currentChain$ | async).code + '/blocks']"
20+
routerLinkActive="active"
21+
>
22+
<ion-label>Blocks</ion-label>
23+
</ion-item>
24+
<ion-item
25+
[routerDirection]="'root'"
26+
[routerLink]="['/' + (config.currentChain$ | async).code + '/transactions']"
27+
routerLinkActive="active"
28+
>
29+
<ion-label>Transactions</ion-label>
30+
</ion-item>
31+
<ion-item
32+
[routerDirection]="'root'"
33+
[routerLink]="['/' + (config.currentChain$ | async).code + '/broadcast']"
34+
routerLinkActive="active"
35+
>
36+
<ion-label>Broadcast</ion-label>
37+
</ion-item>
38+
39+
<ion-item-divider>
40+
<ion-label>Chains</ion-label>
41+
</ion-item-divider>
42+
43+
<ion-item
44+
[routerDirection]="'root'"
45+
[routerLink]="['/BCH']"
46+
routerLinkActive="active"
47+
>
48+
<ion-label>BCH</ion-label>
49+
</ion-item>
50+
<ion-item
51+
[routerDirection]="'root'"
52+
[routerLink]="['/tBCH']"
53+
routerLinkActive="active"
54+
>
55+
<ion-label>tBCH</ion-label>
56+
</ion-item>
57+
<ion-item
58+
[routerDirection]="'root'"
59+
[routerLink]="['/BTC']"
60+
routerLinkActive="active"
61+
>
62+
<ion-label>BTC</ion-label>
63+
</ion-item>
64+
<ion-item
65+
[routerDirection]="'root'"
66+
[routerLink]="['/tBTC']"
67+
routerLinkActive="active"
68+
>
69+
<ion-label>tBTC</ion-label>
70+
</ion-item>
71+
72+
<ion-item-divider>
73+
<ion-label>Display Currency</ion-label>
74+
</ion-item-divider>
75+
<ion-item
76+
(click)="config.displayValueCode$.next('BCH')"
77+
[ngClass]="{'active': (config.displayValueCode$ | async) === 'BCH'}"
78+
>
79+
<ion-label>BCH</ion-label>
80+
</ion-item>
81+
<ion-item
82+
(click)="config.displayValueCode$.next('BCH_bits')"
83+
[ngClass]="{'active': (config.displayValueCode$ | async) === 'BCH_bits'}"
84+
>
85+
<ion-label>Bits (BCH)</ion-label>
86+
</ion-item>
87+
<ion-item
88+
(click)="config.displayValueCode$.next('BTC')"
89+
[ngClass]="{'active': (config.displayValueCode$ | async) === 'BTC'}"
90+
>
91+
<ion-label>BTC</ion-label>
92+
</ion-item>
93+
<ion-item
94+
(click)="config.displayValueCode$.next('USD')"
95+
[ngClass]="{'active': (config.displayValueCode$ | async) === 'USD'}"
96+
>
97+
<ion-label>USD</ion-label>
98+
</ion-item>
99+
<ion-item
100+
(click)="config.displayValueCode$.next('EUR')"
101+
[ngClass]="{'active': (config.displayValueCode$ | async) === 'EUR'}"
102+
>
103+
<ion-label>EUR</ion-label>
104+
</ion-item>
105+
<ion-item
106+
(click)="config.displayValueCode$.next('GBP')"
107+
[ngClass]="{'active': (config.displayValueCode$ | async) === 'GBP'}"
108+
>
109+
<ion-label>GBP</ion-label>
110+
</ion-item>
111+
<ion-item
112+
(click)="config.displayValueCode$.next('CNY')"
113+
[ngClass]="{'active': (config.displayValueCode$ | async) === 'CNY'}"
114+
>
115+
<ion-label>CNY</ion-label>
116+
</ion-item>
117+
19118
</ion-menu-toggle>
20119
</ion-list>
21120
</ion-content>
22121
</ion-menu>
23122
<ion-router-outlet main></ion-router-outlet>
24123
</ion-split-pane>
25124
</ion-app>
125+
<app-status-notifier></app-status-notifier>

packages/insight/src/app/app.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
--ion-background-color: #3d3d4d;
33
--ion-item-background-color-active: lighten(--ion-background-color, 15%);
44
--ion-text-color: rgba(255, 255, 255, 0.9);
5+
6+
ion-item.active {
7+
border-left: 3px solid rgba(119, 209, 255, 0.79);
8+
}
59
}

0 commit comments

Comments
 (0)