Refactor. API explanations. UX revamp.
This commit is contained in:
20
frontend/src/app/components/explorer/explorer.component.html
Normal file
20
frontend/src/app/components/explorer/explorer.component.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<div class="container">
|
||||
|
||||
<br>
|
||||
|
||||
<ul class="nav nav-tabs mb-2">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" [class.active]="view === 'blocks'" routerLink="/explorer" (click)="view = 'blocks'">Blocks</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" [class.active]="view === 'transactions'" routerLink="/explorer" fragment="transactions" (click)="view = 'transactions'">Transactions</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<app-latest-blocks *ngIf="view === 'blocks'; else latestTransactions"></app-latest-blocks>
|
||||
<ng-template #latestTransactions>
|
||||
<app-latest-transactions></app-latest-transactions>
|
||||
</ng-template>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
@@ -0,0 +1,3 @@
|
||||
.search-container {
|
||||
padding-top: 50px;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExplorerComponent } from './explorer.component';
|
||||
|
||||
describe('ExplorerComponent', () => {
|
||||
let component: ExplorerComponent;
|
||||
let fixture: ComponentFixture<ExplorerComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ExplorerComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ExplorerComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
25
frontend/src/app/components/explorer/explorer.component.ts
Normal file
25
frontend/src/app/components/explorer/explorer.component.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-explorer',
|
||||
templateUrl: './explorer.component.html',
|
||||
styleUrls: ['./explorer.component.scss']
|
||||
})
|
||||
export class ExplorerComponent implements OnInit {
|
||||
view: 'blocks' | 'transactions' = 'blocks';
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.fragment
|
||||
.subscribe((fragment: string) => {
|
||||
if (fragment === 'transactions' ) {
|
||||
this.view = 'transactions';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user