From 41cc1e168f1e81010704ca79cee650c54faa9323 Mon Sep 17 00:00:00 2001 From: David Requeno Date: Tue, 4 Nov 2025 19:28:33 -0600 Subject: [PATCH] Refactoring --- .../{app-routing.module.ts => app.routes.ts} | 28 ++----------------- apps/client/src/main.ts | 21 +++++++++----- 2 files changed, 16 insertions(+), 33 deletions(-) rename apps/client/src/app/{app-routing.module.ts => app.routes.ts} (83%) diff --git a/apps/client/src/app/app-routing.module.ts b/apps/client/src/app/app.routes.ts similarity index 83% rename from apps/client/src/app/app-routing.module.ts rename to apps/client/src/app/app.routes.ts index fb045a174..ace605ee1 100644 --- a/apps/client/src/app/app-routing.module.ts +++ b/apps/client/src/app/app.routes.ts @@ -1,13 +1,10 @@ import { publicRoutes, internalRoutes } from '@ghostfolio/common/routes/routes'; -import { NgModule } from '@angular/core'; -import { RouterModule, Routes, TitleStrategy } from '@angular/router'; +import { Routes } from '@angular/router'; import { AuthGuard } from './core/auth.guard'; -import { ModulePreloadService } from './core/module-preload.service'; -import { PageTitleStrategy } from './services/page-title.strategy'; -const routes: Routes = [ +export const routes: Routes = [ { path: publicRoutes.about.path, loadChildren: () => @@ -147,24 +144,3 @@ const routes: Routes = [ pathMatch: 'full' } ]; - -@NgModule({ - imports: [ - RouterModule.forRoot( - routes, - // Preload all lazy loaded modules with the attribute preload === true - { - anchorScrolling: 'enabled', - // enableTracing: true, // <-- debugging purposes only - preloadingStrategy: ModulePreloadService, - scrollPositionRestoration: 'top' - } - ) - ], - providers: [ - ModulePreloadService, - { provide: TitleStrategy, useClass: PageTitleStrategy } - ], - exports: [RouterModule] -}) -export class AppRoutingModule {} diff --git a/apps/client/src/main.ts b/apps/client/src/main.ts index f1d2e43c1..8a5ee59ab 100644 --- a/apps/client/src/main.ts +++ b/apps/client/src/main.ts @@ -9,7 +9,6 @@ import { } from '@angular/common/http'; import { enableProdMode, importProvidersFrom, LOCALE_ID } from '@angular/core'; import { MatAutocompleteModule } from '@angular/material/autocomplete'; -import { MatChipsModule } from '@angular/material/chips'; import { DateAdapter, MAT_DATE_FORMATS, @@ -19,7 +18,8 @@ import { import { MatSnackBarModule } from '@angular/material/snack-bar'; import { MatTooltipModule } from '@angular/material/tooltip'; import { bootstrapApplication } from '@angular/platform-browser'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { provideAnimations } from '@angular/platform-browser/animations'; +import { RouterModule, TitleStrategy } from '@angular/router'; import { ServiceWorkerModule } from '@angular/service-worker'; import { provideIonicAngular } from '@ionic/angular/standalone'; import { provideMarkdown } from 'ngx-markdown'; @@ -28,12 +28,14 @@ import { NgxStripeModule, STRIPE_PUBLISHABLE_KEY } from 'ngx-stripe'; import { CustomDateAdapter } from './app/adapter/custom-date-adapter'; import { DateFormats } from './app/adapter/date-formats'; -import { AppRoutingModule } from './app/app-routing.module'; import { GfAppComponent } from './app/app.component'; +import { routes } from './app/app.routes'; import { authInterceptorProviders } from './app/core/auth.interceptor'; import { httpResponseInterceptorProviders } from './app/core/http-response.interceptor'; import { LanguageService } from './app/core/language.service'; +import { ModulePreloadService } from './app/core/module-preload.service'; import { GfNotificationModule } from './app/core/notification/notification.module'; +import { PageTitleStrategy } from './app/services/page-title.strategy'; import { environment } from './environments/environment'; (async () => { @@ -77,11 +79,13 @@ import { environment } from './environments/environment'; useFactory: () => environment.stripePublicKey }, importProvidersFrom( - AppRoutingModule, - BrowserAnimationsModule, + RouterModule.forRoot(routes, { + anchorScrolling: 'enabled', + preloadingStrategy: ModulePreloadService, + scrollPositionRestoration: 'top' + }), GfNotificationModule, MatAutocompleteModule, - MatChipsModule, MatNativeDateModule, MatSnackBarModule, MatTooltipModule, @@ -90,7 +94,10 @@ import { environment } from './environments/environment'; enabled: environment.production, registrationStrategy: 'registerImmediately' }) - ) + ), + provideAnimations(), + ModulePreloadService, + { provide: TitleStrategy, useClass: PageTitleStrategy } ] }); })();