diff --git a/angular.json b/angular.json index 887f9b20..60ba86d2 100644 --- a/angular.json +++ b/angular.json @@ -15,7 +15,7 @@ "prefix": "app", "architect": { "build": { - "builder": "@angular-devkit/build-angular:application", + "builder": "@angular/build:application", "options": { "outputPath": "dist/public", "index": "client/index.html", @@ -62,7 +62,7 @@ "defaultConfiguration": "production" }, "serve": { - "builder": "@angular-devkit/build-angular:dev-server", + "builder": "@angular/build:dev-server", "configurations": { "production": { "buildTarget": "angular2-full-stack:build:production" @@ -75,10 +75,10 @@ "defaultConfiguration": "development" }, "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n" + "builder": "@angular/build:extract-i18n" }, "test": { - "builder": "@angular-devkit/build-angular:karma", + "builder": "@angular/build:karma", "options": { "polyfills": [ "zone.js", @@ -116,5 +116,31 @@ "schematicCollections": [ "angular-eslint" ] + }, + "schematics": { + "@schematics/angular:component": { + "type": "component" + }, + "@schematics/angular:directive": { + "type": "directive" + }, + "@schematics/angular:service": { + "type": "service" + }, + "@schematics/angular:guard": { + "typeSeparator": "." + }, + "@schematics/angular:interceptor": { + "typeSeparator": "." + }, + "@schematics/angular:module": { + "typeSeparator": "." + }, + "@schematics/angular:pipe": { + "typeSeparator": "." + }, + "@schematics/angular:resolver": { + "typeSeparator": "." + } } } diff --git a/client/app/account/account.component.html b/client/app/account/account.component.html index 18f960ac..d6502238 100644 --- a/client/app/account/account.component.html +++ b/client/app/account/account.component.html @@ -2,37 +2,39 @@ -
-

Account settings

-
-
-
- - - - -
-
- - - - -
-
- - - - -
- -
+@if (!isLoading) { +
+

Account settings

+
+
+
+ + + + +
+
+ + + + +
+
+ + + + +
+ +
+
-
\ No newline at end of file +} \ No newline at end of file diff --git a/client/app/account/account.component.ts b/client/app/account/account.component.ts index 3c184773..319d7bb8 100644 --- a/client/app/account/account.component.ts +++ b/client/app/account/account.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; import { ToastComponent } from '../shared/toast/toast.component'; import { AuthService } from '../services/auth.service'; import { UserService } from '../services/user.service'; @@ -10,14 +10,14 @@ import { User } from '../shared/models/user.model'; standalone: false }) export class AccountComponent implements OnInit { + private auth = inject(AuthService); + toast = inject(ToastComponent); + private userService = inject(UserService); + user: User = new User(); isLoading = true; - constructor(private auth: AuthService, - public toast: ToastComponent, - private userService: UserService) { } - ngOnInit(): void { this.getUser(); } diff --git a/client/app/add-cat-form/add-cat-form.component.ts b/client/app/add-cat-form/add-cat-form.component.ts index 04649e52..881f7f38 100644 --- a/client/app/add-cat-form/add-cat-form.component.ts +++ b/client/app/add-cat-form/add-cat-form.component.ts @@ -1,4 +1,4 @@ -import { Component, Input } from '@angular/core'; +import { Component, Input, inject } from '@angular/core'; import { UntypedFormGroup, UntypedFormControl, Validators, UntypedFormBuilder } from '@angular/forms'; import { CatService } from '../services/cat.service'; import { ToastComponent } from '../shared/toast/toast.component'; @@ -12,6 +12,10 @@ import { Cat } from '../shared/models/cat.model'; }) export class AddCatFormComponent { + private catService = inject(CatService); + private formBuilder = inject(UntypedFormBuilder); + toast = inject(ToastComponent); + @Input() cats: Cat[] = []; addCatForm: UntypedFormGroup; @@ -19,9 +23,7 @@ export class AddCatFormComponent { age = new UntypedFormControl('', Validators.required); weight = new UntypedFormControl('', Validators.required); - constructor(private catService: CatService, - private formBuilder: UntypedFormBuilder, - public toast: ToastComponent) { + constructor() { this.addCatForm = this.formBuilder.group({ name: this.name, age: this.age, diff --git a/client/app/admin/admin.component.html b/client/app/admin/admin.component.html index 0ad2a48e..92742063 100644 --- a/client/app/admin/admin.component.html +++ b/client/app/admin/admin.component.html @@ -2,36 +2,42 @@ -
-

Registered users ({{users.length}})

-
- - - - - - - - - - - - - - - - - - - - - - -
UsernameEmailRoleActions
There are no registered users.
{{user.username}}{{user.email}}{{user.role}} - -
+@if (!isLoading) { +
+

Registered users ({{users.length}})

+
+ + + + + + + + + + @if (users.length === 0) { + + + + + + } + + @for (user of users; track user) { + + + + + + + } + +
UsernameEmailRoleActions
There are no registered users.
{{user.username}}{{user.email}}{{user.role}} + +
+
-
\ No newline at end of file +} \ No newline at end of file diff --git a/client/app/admin/admin.component.ts b/client/app/admin/admin.component.ts index 9bde013b..938a77fb 100644 --- a/client/app/admin/admin.component.ts +++ b/client/app/admin/admin.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; import { ToastComponent } from '../shared/toast/toast.component'; import { AuthService } from '../services/auth.service'; @@ -11,14 +11,14 @@ import { User } from '../shared/models/user.model'; standalone: false }) export class AdminComponent implements OnInit { + auth = inject(AuthService); + toast = inject(ToastComponent); + private userService = inject(UserService); + users: User[] = []; isLoading = true; - constructor(public auth: AuthService, - public toast: ToastComponent, - private userService: UserService) { } - ngOnInit(): void { this.getUsers(); } diff --git a/client/app/app.component.html b/client/app/app.component.html index ca2d4074..cc057384 100644 --- a/client/app/app.component.html +++ b/client/app/app.component.html @@ -2,8 +2,8 @@
+} - \ No newline at end of file +@if (!isEditing) { + +} \ No newline at end of file diff --git a/client/app/cats/cats.component.ts b/client/app/cats/cats.component.ts index ba379e56..70b89392 100644 --- a/client/app/cats/cats.component.ts +++ b/client/app/cats/cats.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; import { CatService } from '../services/cat.service'; import { ToastComponent } from '../shared/toast/toast.component'; @@ -11,15 +11,15 @@ import { Cat } from '../shared/models/cat.model'; standalone: false }) export class CatsComponent implements OnInit { + private catService = inject(CatService); + toast = inject(ToastComponent); + cat = new Cat(); cats: Cat[] = []; isLoading = true; isEditing = false; - constructor(private catService: CatService, - public toast: ToastComponent) { } - ngOnInit(): void { this.getCats(); } diff --git a/client/app/login/login.component.html b/client/app/login/login.component.html index 6d00fb1e..5163727e 100644 --- a/client/app/login/login.component.html +++ b/client/app/login/login.component.html @@ -9,14 +9,14 @@

Login

+ formControlName="email" placeholder="Email" autocomplete="email">
+ formControlName="password" placeholder="Password" autocomplete="current-password">