Skip to content

Commit

Permalink
BREAKING CHANGE: update all code to angular 17 standalone components
Browse files Browse the repository at this point in the history
  • Loading branch information
George-Spanos committed Feb 23, 2024
1 parent 1b027b5 commit 5674e72
Show file tree
Hide file tree
Showing 83 changed files with 6,414 additions and 23,559 deletions.
4 changes: 4 additions & 0 deletions src/ui/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Nx 18 enables using plugins to infer targets by default
# This is disabled for existing workspaces to maintain compatibility
# For more info, see: https://nx.dev/concepts/inferred-tasks
NX_ADD_PLUGINS=false
2 changes: 2 additions & 0 deletions src/ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ testem.log
Thumbs.db

.angular

.nx/cache
2 changes: 1 addition & 1 deletion src/ui/.npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}
@moby-it:registry=https://npm.pkg.github.com/
@moby-it:registry=https://npm.pkg.github.com/
2 changes: 2 additions & 0 deletions src/ui/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

/dist
/coverage

/.nx/cache
14 changes: 5 additions & 9 deletions src/ui/apps/client/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,28 @@
"executor": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "client:build:production"
"buildTarget": "client:build:production"
},
"development": {
"browserTarget": "client:build:development"
"buildTarget": "client:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "client:build"
"buildTarget": "client:build"
}
},
"lint": {
"executor": "@nx/linter:eslint",
"options": {
"lintFilePatterns": ["apps/client/**/*.ts", "apps/client/**/*.html"]
}
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/client"],
"options": {
"jestConfig": "apps/client/jest.config.ts",
"passWithNoTests": true
"jestConfig": "apps/client/jest.config.ts"
}
}
},
Expand Down
4 changes: 3 additions & 1 deletion src/ui/apps/client/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<ppo-top-bar></ppo-top-bar>
<router-outlet></router-outlet>
<ppo-loader *ngIf="loading$ | ngrxPush"></ppo-loader>
@if (loading$ | ngrxPush) {
<ppo-loader></ppo-loader>
}
9 changes: 7 additions & 2 deletions src/ui/apps/client/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { LoaderService } from '@ppo/shared/ui';
import { LoaderComponent, LoaderService } from '@ppo/shared/ui';
import { TopBarComponent } from './top-bar/top-bar.component';
import { RouterModule } from '@angular/router';
import { PushPipe } from '@ngrx/component';
@Component({
selector: 'ppo-root',
imports: [TopBarComponent, RouterModule, LoaderComponent, PushPipe],
templateUrl: './app.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true
})
export class AppComponent {
constructor(private loaderService: LoaderService) {}
constructor(private loaderService: LoaderService) { }
loading$ = this.loaderService.loading$;
}
36 changes: 5 additions & 31 deletions src/ui/apps/client/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,65 +1,39 @@
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { ErrorHandler, NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LetModule, PushModule } from '@ngrx/component';
import { LetDirective, PushPipe } from '@ngrx/component';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { AuthDomainModule } from '@ppo/auth/domain';
import { AuthFeatureUserFormModule } from '@ppo/auth/feature-user-form';
import { PlayDomainModule } from '@ppo/play/domain';
import { API_URL } from '@ppo/shared/config';
import { SharedUiModule } from '@ppo/shared/ui';
import { LoaderComponent, SharedUiModule } from '@ppo/shared/ui';
import { UserDomainModule } from '@ppo/user/domain';
import { ToastrModule } from 'ngx-toastr';
import { environment } from '../environments/environment';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app.routing.module';
import { GlobalErrorHandler } from './errorHandler';
import { TokenInterceptor } from './interceptors';
import { TopBarComponent } from './top-bar/top-bar.component';
import { UserStatusComponent } from './top-bar/user-status/user-status.component';
@NgModule({
declarations: [
AppComponent,
TopBarComponent,
UserStatusComponent,
],
imports: [
BrowserModule,
HttpClientModule,
BrowserAnimationsModule,
AppRoutingModule,
PushModule,
LetModule,
StoreModule.forRoot({}),
EffectsModule.forRoot([]),
StoreDevtoolsModule.instrument({
maxAge: 25, // Retains last 25 states
logOnly: environment.production, // Restrict extension to log-only mode
autoPause: true, // Pauses recording actions and state changes when the extension window is not open
connectInZone: true
}),
PlayDomainModule,
AuthDomainModule,
SharedUiModule,
UserDomainModule,
AuthFeatureUserFormModule,
ToastrModule.forRoot({
positionClass: 'toast-bottom-right',
timeOut: 5000,
closeButton: true,
}), // ToastrModule added
],
providers: [
{ provide: API_URL, useValue: environment.apiUrl },
{
provide: HTTP_INTERCEPTORS,
useClass: TokenInterceptor,
multi: true,
},
{ provide: ErrorHandler, useClass: GlobalErrorHandler },
],
bootstrap: [AppComponent],
})
export class AppModule { }
40 changes: 0 additions & 40 deletions src/ui/apps/client/src/app/app.routing.module.ts

This file was deleted.

6 changes: 5 additions & 1 deletion src/ui/apps/client/src/app/top-bar/top-bar.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Component } from '@angular/core';
import { UserStatusComponent } from './user-status/user-status.component';
import { RouterModule } from '@angular/router';
@Component({
selector: 'ppo-top-bar',
imports: [UserStatusComponent, RouterModule],
templateUrl: './top-bar.component.html',
styles: [`
:host {
display: block;
z-index: 10;
}
`]
`],
standalone: true
})
export class TopBarComponent { }
Loading

0 comments on commit 5674e72

Please sign in to comment.