Merge branch 'master' into nymkappa/feature/update-warm-cache
This commit is contained in:
		
						commit
						e89d466827
					
				| @ -1,5 +1,6 @@ | |||||||
| import { NgModule } from '@angular/core'; | import { NgModule } from '@angular/core'; | ||||||
| import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; | import { Routes, RouterModule } from '@angular/router'; | ||||||
|  | import { AppPreloadingStrategy } from './app.preloading-strategy' | ||||||
| import { StartComponent } from './components/start/start.component'; | import { StartComponent } from './components/start/start.component'; | ||||||
| import { TransactionComponent } from './components/transaction/transaction.component'; | import { TransactionComponent } from './components/transaction/transaction.component'; | ||||||
| import { TransactionPreviewComponent } from './components/transaction/transaction-preview.component'; | import { TransactionPreviewComponent } from './components/transaction/transaction-preview.component'; | ||||||
| @ -25,6 +26,10 @@ import { AssetsComponent } from './components/assets/assets.component'; | |||||||
| import { AssetComponent } from './components/asset/asset.component'; | import { AssetComponent } from './components/asset/asset.component'; | ||||||
| import { AssetsNavComponent } from './components/assets/assets-nav/assets-nav.component'; | import { AssetsNavComponent } from './components/assets/assets-nav/assets-nav.component'; | ||||||
| 
 | 
 | ||||||
|  | const browserWindow = window || {}; | ||||||
|  | // @ts-ignore
 | ||||||
|  | const browserWindowEnv = browserWindow.__env || {}; | ||||||
|  | 
 | ||||||
| let routes: Routes = [ | let routes: Routes = [ | ||||||
|   { |   { | ||||||
|     path: 'testnet', |     path: 'testnet', | ||||||
| @ -32,7 +37,8 @@ let routes: Routes = [ | |||||||
|       { |       { | ||||||
|         path: '', |         path: '', | ||||||
|         pathMatch: 'full', |         pathMatch: 'full', | ||||||
|         loadChildren: () => import('./graphs/graphs.module').then(m => m.GraphsModule) |         loadChildren: () => import('./graphs/graphs.module').then(m => m.GraphsModule), | ||||||
|  |         data: { preload: true }, | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         path: '', |         path: '', | ||||||
| @ -109,7 +115,8 @@ let routes: Routes = [ | |||||||
|           }, |           }, | ||||||
|           { |           { | ||||||
|             path: 'docs', |             path: 'docs', | ||||||
|             loadChildren: () => import('./docs/docs.module').then(m => m.DocsModule) |             loadChildren: () => import('./docs/docs.module').then(m => m.DocsModule), | ||||||
|  |             data: { preload: true }, | ||||||
|           }, |           }, | ||||||
|           { |           { | ||||||
|             path: 'api', |             path: 'api', | ||||||
| @ -117,7 +124,8 @@ let routes: Routes = [ | |||||||
|           }, |           }, | ||||||
|           { |           { | ||||||
|             path: 'lightning', |             path: 'lightning', | ||||||
|             loadChildren: () => import('./lightning/lightning.module').then(m => m.LightningModule) |             loadChildren: () => import('./lightning/lightning.module').then(m => m.LightningModule), | ||||||
|  |             data: { preload: browserWindowEnv && browserWindowEnv.LIGHTNING === true }, | ||||||
|           }, |           }, | ||||||
|         ], |         ], | ||||||
|       }, |       }, | ||||||
| @ -410,10 +418,6 @@ let routes: Routes = [ | |||||||
|   }, |   }, | ||||||
| ]; | ]; | ||||||
| 
 | 
 | ||||||
| const browserWindow = window || {}; |  | ||||||
| // @ts-ignore
 |  | ||||||
| const browserWindowEnv = browserWindow.__env || {}; |  | ||||||
| 
 |  | ||||||
| if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'bisq') { | if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'bisq') { | ||||||
|   routes = [{ |   routes = [{ | ||||||
|     path: '', |     path: '', | ||||||
| @ -691,7 +695,7 @@ if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'liquid') { | |||||||
|     initialNavigation: 'enabled', |     initialNavigation: 'enabled', | ||||||
|     scrollPositionRestoration: 'enabled', |     scrollPositionRestoration: 'enabled', | ||||||
|     anchorScrolling: 'enabled', |     anchorScrolling: 'enabled', | ||||||
|     preloadingStrategy: PreloadAllModules |     preloadingStrategy: AppPreloadingStrategy | ||||||
|   })], |   })], | ||||||
| }) | }) | ||||||
| export class AppRoutingModule { } | export class AppRoutingModule { } | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ import { LanguageService } from './services/language.service'; | |||||||
| import { FiatShortenerPipe } from './shared/pipes/fiat-shortener.pipe'; | import { FiatShortenerPipe } from './shared/pipes/fiat-shortener.pipe'; | ||||||
| import { ShortenStringPipe } from './shared/pipes/shorten-string-pipe/shorten-string.pipe'; | import { ShortenStringPipe } from './shared/pipes/shorten-string-pipe/shorten-string.pipe'; | ||||||
| import { CapAddressPipe } from './shared/pipes/cap-address-pipe/cap-address-pipe'; | import { CapAddressPipe } from './shared/pipes/cap-address-pipe/cap-address-pipe'; | ||||||
|  | import { AppPreloadingStrategy } from './app.preloading-strategy'; | ||||||
| 
 | 
 | ||||||
| @NgModule({ | @NgModule({ | ||||||
|   declarations: [ |   declarations: [ | ||||||
| @ -44,6 +45,7 @@ import { CapAddressPipe } from './shared/pipes/cap-address-pipe/cap-address-pipe | |||||||
|     ShortenStringPipe, |     ShortenStringPipe, | ||||||
|     FiatShortenerPipe, |     FiatShortenerPipe, | ||||||
|     CapAddressPipe, |     CapAddressPipe, | ||||||
|  |     AppPreloadingStrategy, | ||||||
|     { provide: HTTP_INTERCEPTORS, useClass: HttpCacheInterceptor, multi: true } |     { provide: HTTP_INTERCEPTORS, useClass: HttpCacheInterceptor, multi: true } | ||||||
|   ], |   ], | ||||||
|   bootstrap: [AppComponent] |   bootstrap: [AppComponent] | ||||||
|  | |||||||
							
								
								
									
										10
									
								
								frontend/src/app/app.preloading-strategy.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								frontend/src/app/app.preloading-strategy.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,10 @@ | |||||||
|  | import { PreloadingStrategy, Route } from '@angular/router'; | ||||||
|  | import { Observable, timer, mergeMap, of } from 'rxjs'; | ||||||
|  | 
 | ||||||
|  | export class AppPreloadingStrategy implements PreloadingStrategy { | ||||||
|  |   preload(route: Route, load: Function): Observable<any> { | ||||||
|  |       return route.data && route.data.preload  | ||||||
|  |           ? timer(1500).pipe(mergeMap(() => load())) | ||||||
|  |           : of(null); | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user