]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/app.module.ts
Add help to custom markdown textarea
[github/Chocobozzz/PeerTube.git] / client / src / app / app.module.ts
index 6e74cd394298b48a4e8d71bb3b8e8aed64613857..9f46d49a2e59c212f8217a6f8ba63477784ba7be 100644 (file)
@@ -1,73 +1,64 @@
-import { LOCALE_ID, NgModule, TRANSLATIONS, TRANSLATIONS_FORMAT } from '@angular/core'
-import { BrowserModule } from '@angular/platform-browser'
-import { ServerService } from '@app/core'
-import { ResetPasswordModule } from '@app/reset-password'
-
-import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core'
 import 'focus-visible'
-
+import { environment } from 'src/environments/environment'
+import { APP_BASE_HREF, registerLocaleData } from '@angular/common'
+import { NgModule } from '@angular/core'
+import { BrowserModule } from '@angular/platform-browser'
+import { ServiceWorkerModule } from '@angular/service-worker'
+import localeOc from '@app/helpers/locales/oc'
 import { AppRoutingModule } from './app-routing.module'
 import { AppComponent } from './app.component'
 import { CoreModule } from './core'
-import { HeaderComponent, SearchTypeaheadComponent, SuggestionsComponent, SuggestionComponent } from './header'
-import { LoginModule } from './login'
-import { AvatarNotificationComponent, LanguageChooserComponent, MenuComponent } from './menu'
-import { SharedModule } from './shared'
-import { VideosModule } from './videos'
-import { SearchModule } from '@app/search'
-import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
-import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
-import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
-import { APP_BASE_HREF } from '@angular/common'
-import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
-import { CustomModalComponent } from '@app/modal/custom-modal.component'
+import { EmptyComponent } from './empty.component'
+import { HeaderComponent, SearchTypeaheadComponent, SuggestionComponent } from './header'
+import { HighlightPipe } from './header/highlight.pipe'
+import { LanguageChooserComponent, MenuComponent, NotificationComponent } from './menu'
+import { ConfirmComponent } from './modal/confirm.component'
+import { CustomModalComponent } from './modal/custom-modal.component'
+import { InstanceConfigWarningModalComponent } from './modal/instance-config-warning-modal.component'
+import { QuickSettingsModalComponent } from './modal/quick-settings-modal.component'
+import { WelcomeModalComponent } from './modal/welcome-modal.component'
+import { SharedActorImageModule } from './shared/shared-actor-image/shared-actor-image.module'
+import { SharedFormModule } from './shared/shared-forms'
+import { SharedGlobalIconModule } from './shared/shared-icons'
+import { SharedInstanceModule } from './shared/shared-instance'
+import { SharedMainModule } from './shared/shared-main'
+import { SharedUserInterfaceSettingsModule } from './shared/shared-user-settings'
+
+registerLocaleData(localeOc, 'oc')
 
 @NgModule({
   bootstrap: [ AppComponent ],
+
   declarations: [
     AppComponent,
+    EmptyComponent,
 
     MenuComponent,
     LanguageChooserComponent,
     QuickSettingsModalComponent,
-    AvatarNotificationComponent,
+    NotificationComponent,
     HeaderComponent,
     SearchTypeaheadComponent,
-    SuggestionsComponent,
     SuggestionComponent,
+    HighlightPipe,
 
     CustomModalComponent,
     WelcomeModalComponent,
-    InstanceConfigWarningModalComponent
+    InstanceConfigWarningModalComponent,
+    ConfirmComponent
   ],
+
   imports: [
     BrowserModule,
+    ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }),
 
     CoreModule,
-    SharedModule,
-
-    CoreModule,
-    LoginModule,
-    ResetPasswordModule,
-    SearchModule,
-    SharedModule,
-    VideosModule,
-
-    MetaModule.forRoot({
-      provide: MetaLoader,
-      useFactory: (serverService: ServerService) => {
-        return new MetaStaticLoader({
-          pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
-          pageTitleSeparator: ' - ',
-          get applicationName () { return serverService.getTmpConfig().instance.name },
-          defaults: {
-            get title () { return serverService.getTmpConfig().instance.name },
-            get description () { return serverService.getTmpConfig().instance.shortDescription }
-          }
-        })
-      },
-      deps: [ ServerService ]
-    }),
+    SharedMainModule,
+    SharedFormModule,
+    SharedUserInterfaceSettingsModule,
+    SharedGlobalIconModule,
+    SharedInstanceModule,
+    SharedActorImageModule,
 
     AppRoutingModule // Put it after all the module because it has the 404 route
   ],
@@ -76,21 +67,7 @@ import { CustomModalComponent } from '@app/modal/custom-modal.component'
     {
       provide: APP_BASE_HREF,
       useValue: '/'
-    },
-
-    {
-      provide: TRANSLATIONS,
-      useFactory: (locale: string) => {
-        // Default locale, nothing to translate
-        const completeLocale = getCompleteLocale(locale)
-        if (isDefaultLocale(completeLocale)) return ''
-
-        const fileLocale = buildFileLocale(locale)
-        return require(`raw-loader!../locale/angular.${fileLocale}.xlf`).default
-      },
-      deps: [ LOCALE_ID ]
-    },
-    { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
+    }
   ]
 })
 export class AppModule {}