From 2de5b804afb288142e5fde7ebe03a264db894776 Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 6 Feb 2025 17:00:23 +0100 Subject: [PATCH 01/17] Components: fix some components being double nested --- src/app/app.component.ts | 2 +- .../create-edit-modal/create-edit-modal.component.css | 0 .../create-edit-modal/create-edit-modal.component.html | 0 .../create-edit-modal.component.spec.ts | 0 .../create-edit-modal/create-edit-modal.component.ts | 10 +++++----- .../toast-container.component.css | 0 .../toast-container.component.html | 0 .../toast-container.component.spec.ts | 0 .../{toast-container => }/toast-container.component.ts | 2 +- src/pages/shows/shows.component.ts | 2 +- 10 files changed, 8 insertions(+), 8 deletions(-) rename src/components/{create-modal => }/create-edit-modal/create-edit-modal.component.css (100%) rename src/components/{create-modal => }/create-edit-modal/create-edit-modal.component.html (100%) rename src/components/{create-modal => }/create-edit-modal/create-edit-modal.component.spec.ts (100%) rename src/components/{create-modal => }/create-edit-modal/create-edit-modal.component.ts (90%) rename src/components/toast-container/{toast-container => }/toast-container.component.css (100%) rename src/components/toast-container/{toast-container => }/toast-container.component.html (100%) rename src/components/toast-container/{toast-container => }/toast-container.component.spec.ts (100%) rename src/components/toast-container/{toast-container => }/toast-container.component.ts (84%) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 2e9431a..1ff2e6e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,6 +1,6 @@ import {Component} from '@angular/core'; import {RouterLink, RouterLinkActive, RouterOutlet} from '@angular/router'; -import {ToastContainerComponent} from '../components/toast-container/toast-container/toast-container.component'; +import {ToastContainerComponent} from '../components/toast-container/toast-container.component'; import {NgbCollapse} from '@ng-bootstrap/ng-bootstrap'; import {routes} from './app.routes'; diff --git a/src/components/create-modal/create-edit-modal/create-edit-modal.component.css b/src/components/create-edit-modal/create-edit-modal.component.css similarity index 100% rename from src/components/create-modal/create-edit-modal/create-edit-modal.component.css rename to src/components/create-edit-modal/create-edit-modal.component.css diff --git a/src/components/create-modal/create-edit-modal/create-edit-modal.component.html b/src/components/create-edit-modal/create-edit-modal.component.html similarity index 100% rename from src/components/create-modal/create-edit-modal/create-edit-modal.component.html rename to src/components/create-edit-modal/create-edit-modal.component.html diff --git a/src/components/create-modal/create-edit-modal/create-edit-modal.component.spec.ts b/src/components/create-edit-modal/create-edit-modal.component.spec.ts similarity index 100% rename from src/components/create-modal/create-edit-modal/create-edit-modal.component.spec.ts rename to src/components/create-edit-modal/create-edit-modal.component.spec.ts diff --git a/src/components/create-modal/create-edit-modal/create-edit-modal.component.ts b/src/components/create-edit-modal/create-edit-modal.component.ts similarity index 90% rename from src/components/create-modal/create-edit-modal/create-edit-modal.component.ts rename to src/components/create-edit-modal/create-edit-modal.component.ts index caeac9d..586c624 100644 --- a/src/components/create-modal/create-edit-modal/create-edit-modal.component.ts +++ b/src/components/create-edit-modal/create-edit-modal.component.ts @@ -1,12 +1,12 @@ import {Component, inject} from '@angular/core'; import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap'; import {FormControl, FormGroup, ReactiveFormsModule, Validators} from '@angular/forms'; -import {ShowsApiService} from '../../../services/shows/shows-api.service'; -import {ShowsApiCreation} from '../../../interfaces/shows-api-creation'; -import {ToastService} from '../../../services/toast/toast.service'; -import {Show} from '../../../interfaces/show'; +import {ShowsApiService} from '../../services/shows/shows-api.service'; +import {ShowsApiCreation} from '../../interfaces/shows-api-creation'; +import {ToastService} from '../../services/toast/toast.service'; +import {Show} from '../../interfaces/show'; import {formatDate} from '@angular/common'; -import {ShowsApiDeletionEdit} from '../../../interfaces/shows-api-deletion-edit'; +import {ShowsApiDeletionEdit} from '../../interfaces/shows-api-deletion-edit'; @Component({ selector: 'app-create-edit-modal', diff --git a/src/components/toast-container/toast-container/toast-container.component.css b/src/components/toast-container/toast-container.component.css similarity index 100% rename from src/components/toast-container/toast-container/toast-container.component.css rename to src/components/toast-container/toast-container.component.css diff --git a/src/components/toast-container/toast-container/toast-container.component.html b/src/components/toast-container/toast-container.component.html similarity index 100% rename from src/components/toast-container/toast-container/toast-container.component.html rename to src/components/toast-container/toast-container.component.html diff --git a/src/components/toast-container/toast-container/toast-container.component.spec.ts b/src/components/toast-container/toast-container.component.spec.ts similarity index 100% rename from src/components/toast-container/toast-container/toast-container.component.spec.ts rename to src/components/toast-container/toast-container.component.spec.ts diff --git a/src/components/toast-container/toast-container/toast-container.component.ts b/src/components/toast-container/toast-container.component.ts similarity index 84% rename from src/components/toast-container/toast-container/toast-container.component.ts rename to src/components/toast-container/toast-container.component.ts index c1eac7a..6538dea 100644 --- a/src/components/toast-container/toast-container/toast-container.component.ts +++ b/src/components/toast-container/toast-container.component.ts @@ -1,5 +1,5 @@ import {Component, inject} from '@angular/core'; -import {ToastService} from '../../../services/toast/toast.service'; +import {ToastService} from '../../services/toast/toast.service'; import {NgbToast} from '@ng-bootstrap/ng-bootstrap'; @Component({ diff --git a/src/pages/shows/shows.component.ts b/src/pages/shows/shows.component.ts index 6c1eefb..ae944f0 100644 --- a/src/pages/shows/shows.component.ts +++ b/src/pages/shows/shows.component.ts @@ -5,7 +5,7 @@ import {ShowsApiResponse} from '../../interfaces/shows-api-response'; import {Toast} from '../../interfaces/toast'; import {ToastService} from '../../services/toast/toast.service'; import {NgbModal, NgbModalRef} from '@ng-bootstrap/ng-bootstrap'; -import {CreateEditModalComponent} from '../../components/create-modal/create-edit-modal/create-edit-modal.component'; +import {CreateEditModalComponent} from '../../components/create-edit-modal/create-edit-modal.component'; import {DatePipe} from '@angular/common'; import {DeleteModalComponent} from '../../components/delete-modal/delete-modal.component'; From 58bb2cb3ca9d49f116cad5ef855df3e78c15ba9e Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 6 Feb 2025 17:25:02 +0100 Subject: [PATCH 02/17] Components/create-edit-modal: don't add date form control separately --- .../create-edit-modal.component.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/create-edit-modal/create-edit-modal.component.ts b/src/components/create-edit-modal/create-edit-modal.component.ts index 586c624..3570ebc 100644 --- a/src/components/create-edit-modal/create-edit-modal.component.ts +++ b/src/components/create-edit-modal/create-edit-modal.component.ts @@ -31,18 +31,18 @@ export class CreateEditModalComponent { private initForm() { let formattedDate: string - this.newShowForm = new FormGroup({ - title: new FormControl(this.show?.title, Validators.required), - seasons: new FormControl(this.show?.seasons, [Validators.required, Validators.min(1)]), - episodes: new FormControl(this.show?.episodes, [Validators.required, Validators.min(1)]), - description: new FormControl(this.show?.description, Validators.required) - }) if (this.show?.date !== undefined) { formattedDate = formatDate(this.show?.date, "YYYY-MM-dd", "en") } else { formattedDate = "" } - this.newShowForm.addControl("date", new FormControl(formattedDate, Validators.required)) + this.newShowForm = new FormGroup({ + title: new FormControl(this.show?.title, Validators.required), + seasons: new FormControl(this.show?.seasons, [Validators.required, Validators.min(1)]), + date: new FormControl(formattedDate, Validators.required), + episodes: new FormControl(this.show?.episodes, [Validators.required, Validators.min(1)]), + description: new FormControl(this.show?.description, Validators.required) + }) } protected dismiss() { From aec0a34f71d24d7aca235cedd20ab98c9fa5ecdd Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 6 Feb 2025 18:20:50 +0100 Subject: [PATCH 03/17] Components/create-edit-modal: add floating labels --- .../create-edit-modal.component.html | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/components/create-edit-modal/create-edit-modal.component.html b/src/components/create-edit-modal/create-edit-modal.component.html index 951fd1b..b8db797 100644 --- a/src/components/create-edit-modal/create-edit-modal.component.html +++ b/src/components/create-edit-modal/create-edit-modal.component.html @@ -10,26 +10,25 @@