mempool/frontend/src/app/master-page.module.ts

157 lines
4.7 KiB
TypeScript
Raw Normal View History

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
2024-05-16 07:35:55 +00:00
import { Routes, RouterModule, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { MasterPageComponent } from './components/master-page/master-page.component';
import { SharedModule } from './shared/shared.module';
import { StartComponent } from './components/start/start.component';
import { PushTransactionComponent } from './components/push-transaction/push-transaction.component';
2024-03-24 09:02:19 +00:00
import { TestTransactionsComponent } from './components/test-transactions/test-transactions.component';
2023-11-22 18:13:41 +09:00
import { CalculatorComponent } from './components/calculator/calculator.component';
import { BlocksList } from './components/blocks-list/blocks-list.component';
import { RbfList } from './components/rbf-list/rbf-list.component';
import { ServerHealthComponent } from './components/server-health/server-health.component';
import { ServerStatusComponent } from './components/server-health/server-status.component';
2024-05-16 07:35:55 +00:00
import { FaucetComponent } from './components/faucet/faucet.component'
const browserWindow = window || {};
// @ts-ignore
const browserWindowEnv = browserWindow.__env || {};
const routes: Routes = [
{
path: '',
component: MasterPageComponent,
children: [
{
path: 'mining/blocks',
redirectTo: 'blocks',
pathMatch: 'full'
},
{
path: 'tx/push',
component: PushTransactionComponent,
},
2024-06-03 21:12:12 +00:00
{
path: 'pushtx',
component: PushTransactionComponent,
},
2024-03-24 09:02:19 +00:00
{
path: 'tx/test',
component: TestTransactionsComponent,
},
{
path: 'about',
loadChildren: () => import('./components/about/about.module').then(m => m.AboutModule),
},
{
path: 'blocks/:page',
component: BlocksList,
},
{
path: 'blocks',
redirectTo: 'blocks/1',
},
{
path: 'rbf',
component: RbfList,
},
{
path: 'terms-of-service',
loadChildren: () => import('./components/terms-of-service/terms-of-service.module').then(m => m.TermsOfServiceModule),
},
{
path: 'privacy-policy',
loadChildren: () => import('./components/privacy-policy/privacy-policy.module').then(m => m.PrivacyPolicyModule),
},
{
path: 'trademark-policy',
loadChildren: () => import('./components/trademark-policy/trademark-policy.module').then(m => m.TrademarkModule),
},
{
path: 'tx',
component: StartComponent,
data: { preload: true, networkSpecific: true },
loadChildren: () => import('./components/transaction/transaction.module').then(m => m.TransactionModule),
},
{
path: 'block',
component: StartComponent,
data: { preload: true, networkSpecific: true },
loadChildren: () => import('./components/block/block.module').then(m => m.BlockModule),
},
{
path: 'docs',
loadChildren: () => import('./docs/docs.module').then(m => m.DocsModule),
data: { preload: true },
},
{
path: 'api',
loadChildren: () => import('./docs/docs.module').then(m => m.DocsModule)
},
{
path: 'lightning',
loadChildren: () => import('./lightning/lightning.module').then(m => m.LightningModule),
data: { preload: browserWindowEnv && browserWindowEnv.LIGHTNING === true, networks: ['bitcoin'] },
},
2023-11-22 18:13:41 +09:00
{
path: 'tools/calculator',
component: CalculatorComponent
},
],
}
];
if (window['__env']?.OFFICIAL_MEMPOOL_SPACE) {
routes[0].children.push({
2024-03-06 19:34:12 +00:00
path: 'monitoring',
data: { networks: ['bitcoin', 'liquid'] },
component: ServerHealthComponent
});
routes[0].children.push({
2024-03-06 19:34:12 +00:00
path: 'nodes',
data: { networks: ['bitcoin', 'liquid'] },
component: ServerStatusComponent
});
if (window['isMempoolSpaceBuild']) {
routes[0].children.push({
path: 'faucet',
canActivate: [(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => {
return state.url.startsWith('/testnet4/');
}],
component: StartComponent,
data: { preload: true, networkSpecific: true },
children: [{
path: '',
data: { networks: ['bitcoin'] },
component: FaucetComponent,
}]
})
}
}
@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [
RouterModule
]
})
export class MasterPageRoutingModule { }
@NgModule({
imports: [
CommonModule,
MasterPageRoutingModule,
SharedModule,
],
declarations: [
MasterPageComponent,
],
exports: [
MasterPageComponent,
]
})
export class MasterPageModule { }