unoffical wafrn mirror wafrn.net
atproto social-network activitypub
at angular21 68 lines 2.7 kB view raw
1import { NgModule, isDevMode } from '@angular/core' 2import { BrowserModule } from '@angular/platform-browser' 3import { BrowserAnimationsModule } from '@angular/platform-browser/animations' 4import { HTTP_INTERCEPTORS, provideHttpClient, withFetch, withInterceptorsFromDi } from '@angular/common/http' 5import { CommonModule } from '@angular/common' 6import { AppRoutingModule } from './app-routing.module' 7import { AppComponent } from './app.component' 8import { FormsModule, ReactiveFormsModule } from '@angular/forms' 9import { WafrnAuthInterceptor } from './interceptors/wafrn-auth.interceptor' 10import { ServiceWorkerModule } from '@angular/service-worker' 11import { MAT_RIPPLE_GLOBAL_OPTIONS, MatNativeDateModule, RippleGlobalOptions } from '@angular/material/core' 12import { FontAwesomeModule } from '@fortawesome/angular-fontawesome' 13import { MatSnackBarModule } from '@angular/material/snack-bar' 14import { TranslateHttpLoader } from '@ngx-translate/http-loader' 15import { TranslateLoader, TranslateModule } from '@ngx-translate/core' 16import { HttpClient } from '@angular/common/http' 17import { HotkeyManagerComponent } from './components/hotkey-manager/hotkey-manager.component' 18import buildData from '../buildData.json' 19import { ThemeManagerComponent } from './components/theme-manager/theme-manager.component' 20 21const globalRippleConfig: RippleGlobalOptions = { 22 disabled: true, 23 animation: { 24 enterDuration: 300, 25 exitDuration: 0 26 } 27} 28@NgModule({ 29 declarations: [AppComponent], 30 bootstrap: [AppComponent], 31 exports: [], 32 imports: [ 33 BrowserModule, 34 BrowserAnimationsModule, 35 CommonModule, 36 FormsModule, 37 ReactiveFormsModule, 38 AppRoutingModule, 39 MatNativeDateModule, 40 ServiceWorkerModule.register('ngsw-worker.js', { 41 enabled: !isDevMode(), 42 // Register the ServiceWorker as soon as the application is stable 43 // or after 5 seconds (whichever comes first). 44 registrationStrategy: 'registerWhenStable:5000' 45 }), 46 FontAwesomeModule, 47 MatSnackBarModule, 48 TranslateModule.forRoot({ 49 loader: { 50 provide: TranslateLoader, 51 useFactory: HttpLoaderFactory, 52 deps: [HttpClient] 53 } 54 }), 55 ThemeManagerComponent, 56 HotkeyManagerComponent 57 ], 58 providers: [ 59 { provide: HTTP_INTERCEPTORS, useClass: WafrnAuthInterceptor, multi: true }, 60 { provide: MAT_RIPPLE_GLOBAL_OPTIONS, useValue: globalRippleConfig }, 61 provideHttpClient(withInterceptorsFromDi(), withFetch()) 62 ] 63}) 64export class AppModule {} 65 66export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader { 67 return new TranslateHttpLoader(http, '/assets/i18n/', `.json?v=${buildData.git.fullHash}`) 68}