diff --git a/frontend/src/app/components/submit-button/submit-button.component.html b/frontend/src/app/components/submit-button/submit-button.component.html new file mode 100644 index 0000000..b5c47cd --- /dev/null +++ b/frontend/src/app/components/submit-button/submit-button.component.html @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/frontend/src/app/components/submit-button/submit-button.component.scss b/frontend/src/app/components/submit-button/submit-button.component.scss new file mode 100644 index 0000000..13fe5c9 --- /dev/null +++ b/frontend/src/app/components/submit-button/submit-button.component.scss @@ -0,0 +1,43 @@ +button { + padding: .8em 1.2em; + border-radius: 10em; + border: none; + background-color: #3f51b5; + color: white; + transition: background-color .2s ease-in-out; + position: relative; + + &:hover { + background-color: #5b6ed8; + cursor: pointer; + } + + &.secondary { + color: #3f51b5; + background-color: white; + + &:hover { + background-color: #f2f4ff; + cursor: pointer; + } + } + + &:disabled { + background-color: #6d7ac5; + cursor: not-allowed; + } + + mat-spinner { + position: absolute; + top: calc(50% - 12px); + left: calc(50% - 12px); + } +} + +:host ::ng-deep .spinner circle { + stroke: white; +} + +:host ::ng-deep .spinner.secondary circle { + stroke: #3f51b5; +} \ No newline at end of file diff --git a/frontend/src/app/components/submit-button/submit-button.component.ts b/frontend/src/app/components/submit-button/submit-button.component.ts new file mode 100644 index 0000000..9f7434f --- /dev/null +++ b/frontend/src/app/components/submit-button/submit-button.component.ts @@ -0,0 +1,20 @@ +import { CommonModule } from "@angular/common"; +import { Component, EventEmitter, Input, Output } from "@angular/core"; +import { MatProgressSpinnerModule } from "@angular/material/progress-spinner"; + + +@Component({ + selector: 'app-submit-button', + standalone: true, + imports: [MatProgressSpinnerModule, CommonModule], + templateUrl: 'submit-button.component.html', + styleUrl: 'submit-button.component.scss' +}) +export class SubmitButtonComponent { + @Input() requestPending: boolean = false; + @Input() label: string = ''; + @Input() disabled: boolean = false; + @Input() color?: 'secondary'; + @Output() click = new EventEmitter(); + } + \ No newline at end of file diff --git a/frontend/src/app/core/rest-services/publications/publication.rest-service.ts b/frontend/src/app/core/rest-services/publications/publication.rest-service.ts index a1ef724..155332e 100644 --- a/frontend/src/app/core/rest-services/publications/publication.rest-service.ts +++ b/frontend/src/app/core/rest-services/publications/publication.rest-service.ts @@ -16,4 +16,8 @@ export class PublicationRestService { getById(publicationId: string): Promise { return lastValueFrom(this.httpClient.get(`/api/publications/${publicationId}`)); } + + update(publication: Publication): Promise { + return lastValueFrom(this.httpClient.put(`/api/publications/${publication.id}`, publication)); + } } diff --git a/frontend/src/app/pages/login/login.component.scss b/frontend/src/app/pages/login/login.component.scss index 1fdc1a3..4cfc60b 100644 --- a/frontend/src/app/pages/login/login.component.scss +++ b/frontend/src/app/pages/login/login.component.scss @@ -43,6 +43,20 @@ color: #3f51b5; text-decoration: none; } + + button, a.button { + padding: .8em 1.2em; + border-radius: 10em; + border: none; + background-color: #3f51b5; + color: white; + transition: background-color .2s ease-in-out; + + &:hover { + background-color: #5b6ed8; + cursor: pointer; + } + } } label { diff --git a/frontend/src/app/pages/login/login.component.ts b/frontend/src/app/pages/login/login.component.ts index ec93f59..08b956d 100644 --- a/frontend/src/app/pages/login/login.component.ts +++ b/frontend/src/app/pages/login/login.component.ts @@ -36,7 +36,7 @@ export class LoginComponent implements OnInit, OnDestroy { const passwordSubscription = this.loginForm.controls['password'].valueChanges .pipe( - debounceTime(300), + debounceTime(100), map(value => value?.length ? value as string : '') ) .subscribe(password => { diff --git a/frontend/src/app/pages/publication-edition/publication-edition.component.html b/frontend/src/app/pages/publication-edition/publication-edition.component.html index 386af08..5c93796 100644 --- a/frontend/src/app/pages/publication-edition/publication-edition.component.html +++ b/frontend/src/app/pages/publication-edition/publication-edition.component.html @@ -42,9 +42,7 @@