Skip to content

Commit

Permalink
feat(insight): scaffold routing, continue building out blocks view
Browse files Browse the repository at this point in the history
  • Loading branch information
bitjson committed Oct 18, 2018
1 parent e9aad69 commit afdc409
Show file tree
Hide file tree
Showing 50 changed files with 955 additions and 184 deletions.
2 changes: 1 addition & 1 deletion packages/bitcore-node/src/types/Query.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const enum Direction {
export const enum Direction {
ascending = 1,
descending = -1
}
Expand Down
2 changes: 2 additions & 0 deletions packages/insight/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ $RECYCLE.BIN/
.DS_Store
Thumbs.db
UserInterfaceState.xcuserstate

proxy.conf.override.js*
2 changes: 1 addition & 1 deletion packages/insight/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app:build",
"proxyConfig": "proxy.conf.json"
"proxyConfig": "proxy.conf.js"
},
"configurations": {
"production": {
Expand Down
8 changes: 8 additions & 0 deletions packages/insight/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/insight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@angular/platform-browser": "~6.1.1",
"@angular/platform-browser-dynamic": "~6.1.1",
"@angular/router": "~6.1.1",
"@ionic-native/app-preferences": "^5.0.0-beta.21",
"@ionic-native/core": "5.0.0-beta.15",
"@ionic-native/splash-screen": "5.0.0-beta.15",
"@ionic-native/status-bar": "5.0.0-beta.15",
Expand Down
19 changes: 19 additions & 0 deletions packages/insight/proxy.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let config;
try {
config = require('./proxy.conf.override');
} catch (err) {
config = {
'/api': {
target: {
host: 'api.bitcore.io',
protocol: 'https:',
port: 443
},
secure: false,
changeOrigin: true,
logLevel: 'debug'
}
};
}

module.exports = config;
12 changes: 0 additions & 12 deletions packages/insight/proxy.conf.json

This file was deleted.

43 changes: 36 additions & 7 deletions packages/insight/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,53 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { environment } from '../environments/environment';
import {
AvailableChainGuard,
availableChainsMatcher
} from './guards/available-chain.guard';

const routes: Routes = [
{
path: '',
redirectTo: 'home',
redirectTo: `${environment.initialChain.code}/home`,
pathMatch: 'full'
},
{
path: 'home',
loadChildren: './home/home.module#HomePageModule'
matcher: availableChainsMatcher,
canActivateChild: [AvailableChainGuard],
children: [
{
path: '',
redirectTo: `home`,
pathMatch: 'full'
},
{
path: 'home',
loadChildren: './home/home.module#HomePageModule'
},
{
path: 'blocks',
loadChildren: './blocks/blocks.module#BlocksPageModule'
},
{
path: 'block/:hash',
loadChildren: './block/block.module#BlockPageModule'
}
]
},
{
path: 'blocks',
loadChildren: './blocks/blocks.module#BlocksPageModule'
path: '**',
loadChildren: './not-found/not-found.module#NotFoundPageModule'
}
];

@NgModule({
imports: [RouterModule.forRoot(routes)],
imports: [
RouterModule.forRoot(routes, {
enableTracing: !environment.production,
preloadingStrategy: PreloadAllModules
})
],
exports: [RouterModule]
})
export class AppRoutingModule {}
112 changes: 106 additions & 6 deletions packages/insight/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,120 @@
padding
>
<ion-list>
<ion-menu-toggle
auto-hide="false"
*ngFor="let p of appPages"
>
<ion-menu-toggle auto-hide="false">
<ion-item
[routerDirection]="'root'"
[routerLink]="[p.url]"
[routerLink]="['/' + (config.currentChain$ | async).code + '/home']"
routerLinkActive="active"
>
<ion-label>{{ p.title }}</ion-label>
<ion-label>Home</ion-label>
</ion-item>
<ion-item
[routerDirection]="'root'"
[routerLink]="['/' + (config.currentChain$ | async).code + '/blocks']"
routerLinkActive="active"
>
<ion-label>Blocks</ion-label>
</ion-item>
<ion-item
[routerDirection]="'root'"
[routerLink]="['/' + (config.currentChain$ | async).code + '/transactions']"
routerLinkActive="active"
>
<ion-label>Transactions</ion-label>
</ion-item>
<ion-item
[routerDirection]="'root'"
[routerLink]="['/' + (config.currentChain$ | async).code + '/broadcast']"
routerLinkActive="active"
>
<ion-label>Broadcast</ion-label>
</ion-item>

<ion-item-divider>
<ion-label>Chains</ion-label>
</ion-item-divider>

<ion-item
[routerDirection]="'root'"
[routerLink]="['/BCH']"
routerLinkActive="active"
>
<ion-label>BCH</ion-label>
</ion-item>
<ion-item
[routerDirection]="'root'"
[routerLink]="['/tBCH']"
routerLinkActive="active"
>
<ion-label>tBCH</ion-label>
</ion-item>
<ion-item
[routerDirection]="'root'"
[routerLink]="['/BTC']"
routerLinkActive="active"
>
<ion-label>BTC</ion-label>
</ion-item>
<ion-item
[routerDirection]="'root'"
[routerLink]="['/tBTC']"
routerLinkActive="active"
>
<ion-label>tBTC</ion-label>
</ion-item>

<ion-item-divider>
<ion-label>Display Currency</ion-label>
</ion-item-divider>
<ion-item
(click)="config.displayValueCode$.next('BCH')"
[ngClass]="{'active': (config.displayValueCode$ | async) === 'BCH'}"
>
<ion-label>BCH</ion-label>
</ion-item>
<ion-item
(click)="config.displayValueCode$.next('BCH_bits')"
[ngClass]="{'active': (config.displayValueCode$ | async) === 'BCH_bits'}"
>
<ion-label>Bits (BCH)</ion-label>
</ion-item>
<ion-item
(click)="config.displayValueCode$.next('BTC')"
[ngClass]="{'active': (config.displayValueCode$ | async) === 'BTC'}"
>
<ion-label>BTC</ion-label>
</ion-item>
<ion-item
(click)="config.displayValueCode$.next('USD')"
[ngClass]="{'active': (config.displayValueCode$ | async) === 'USD'}"
>
<ion-label>USD</ion-label>
</ion-item>
<ion-item
(click)="config.displayValueCode$.next('EUR')"
[ngClass]="{'active': (config.displayValueCode$ | async) === 'EUR'}"
>
<ion-label>EUR</ion-label>
</ion-item>
<ion-item
(click)="config.displayValueCode$.next('GBP')"
[ngClass]="{'active': (config.displayValueCode$ | async) === 'GBP'}"
>
<ion-label>GBP</ion-label>
</ion-item>
<ion-item
(click)="config.displayValueCode$.next('CNY')"
[ngClass]="{'active': (config.displayValueCode$ | async) === 'CNY'}"
>
<ion-label>CNY</ion-label>
</ion-item>

</ion-menu-toggle>
</ion-list>
</ion-content>
</ion-menu>
<ion-router-outlet main></ion-router-outlet>
</ion-split-pane>
</ion-app>
<app-status-notifier></app-status-notifier>
4 changes: 4 additions & 0 deletions packages/insight/src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
--ion-background-color: #3d3d4d;
--ion-item-background-color-active: lighten(--ion-background-color, 15%);
--ion-text-color: rgba(255, 255, 255, 0.9);

ion-item.active {
border-left: 3px solid rgba(119, 209, 255, 0.79);
}
}
26 changes: 3 additions & 23 deletions packages/insight/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,18 @@
import { Component } from '@angular/core';

import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { Platform } from '@ionic/angular';
import { ConfigService } from './services/config/config.service';

@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss']
})
export class AppComponent {
public appPages = [
{
title: 'Home',
url: '/home'
},
{
title: 'Blocks',
url: '/blocks'
}
];

constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar
) {
constructor(private platform: Platform, public config: ConfigService) {
this.initializeApp();
}

initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
});
this.platform.ready().then(() => {});
}
}
5 changes: 4 additions & 1 deletion packages/insight/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { AppPreferences } from '@ionic-native/app-preferences/ngx';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
Expand All @@ -12,9 +13,10 @@ import { LoggerModule } from 'ngx-logger';
import { environment } from '../environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { StatusNotifierComponent } from './status-notifier/status-notifier.component';

@NgModule({
declarations: [AppComponent],
declarations: [AppComponent, StatusNotifierComponent],
entryComponents: [],
imports: [
BrowserModule,
Expand All @@ -24,6 +26,7 @@ import { AppComponent } from './app.component';
HttpClientModule
],
providers: [
AppPreferences,
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
Expand Down
26 changes: 26 additions & 0 deletions packages/insight/src/app/block/block.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { RouterModule, Routes } from '@angular/router';
import { IonicModule } from '@ionic/angular';
import { SharedModule } from '../shared/shared.module';
import { BlockPage } from './block.page';

const routes: Routes = [
{
path: '',
component: BlockPage
}
];

@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
RouterModule.forChild(routes),
SharedModule
],
declarations: [BlockPage]
})
export class BlockPageModule {}
18 changes: 18 additions & 0 deletions packages/insight/src/app/block/block.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-menu-button></ion-menu-button>
<ion-back-button></ion-back-button>
</ion-buttons>
<ion-title>Block</ion-title>
</ion-toolbar>
</ion-header>

<ion-content padding>
<app-block
*ngIf="block$ | async as block"
[block]="block"
[summary]="false"
[displayValueCode]="config.displayValueCode$ | async"
></app-block>
</ion-content>
Empty file.
Loading

0 comments on commit afdc409

Please sign in to comment.