diff --git a/src/app/components/comment-form/comment-form.component.css b/src/app/components/comment-form/comment-form.component.css index a13e8c5..7164016 100644 --- a/src/app/components/comment-form/comment-form.component.css +++ b/src/app/components/comment-form/comment-form.component.css @@ -3,3 +3,9 @@ height: 8rem; resize: none; } + +form { + gap: 1rem; + display: flex; + flex-direction: column; +} diff --git a/src/app/components/comment-form/comment-form.component.html b/src/app/components/comment-form/comment-form.component.html index b414a70..564b5be 100644 --- a/src/app/components/comment-form/comment-form.component.html +++ b/src/app/components/comment-form/comment-form.component.html @@ -1,4 +1,4 @@
diff --git a/src/app/components/comment-form/comment-form.component.ts b/src/app/components/comment-form/comment-form.component.ts index 60138cc..6daf490 100644 --- a/src/app/components/comment-form/comment-form.component.ts +++ b/src/app/components/comment-form/comment-form.component.ts @@ -8,6 +8,7 @@ import {Author} from '../../models/author'; import {Subscription} from 'rxjs'; import {Comment} from '../../models/comment'; import {MessageService} from 'primeng/api'; +import {NgStyle} from '@angular/common'; @Component({ selector: 'app-comment-form', @@ -15,7 +16,8 @@ import {MessageService} from 'primeng/api'; imports: [ ReactiveFormsModule, InputTextareaModule, - Button + Button, + NgStyle ], templateUrl: './comment-form.component.html', styleUrl: './comment-form.component.css' diff --git a/src/app/pages/login/login.component.ts b/src/app/pages/login/login.component.ts index 7ccf3fa..a82bdb2 100644 --- a/src/app/pages/login/login.component.ts +++ b/src/app/pages/login/login.component.ts @@ -50,7 +50,7 @@ export class LoginComponent implements OnDestroy { .subscribe({ next: (author: Author) => { console.log(author) - this.cookieService.set("author", JSON.stringify(author)); + this.cookieService.set("author", JSON.stringify(author), {path: '/'}); this.getAuthorCookie(); this.router.navigate(['/']).then(() => { this.successMessage('Connecté avec succès', 'Heureux de vous revoir ' + this.actualAuthor?.name) diff --git a/src/app/pages/post/post.component.css b/src/app/pages/post/post.component.css index 166ee37..b9e602f 100644 --- a/src/app/pages/post/post.component.css +++ b/src/app/pages/post/post.component.css @@ -68,6 +68,13 @@ em { margin-top: 5rem; } +.delete-dialog { + display: flex; + justify-content: center; + align-items: center; + gap: 3em; +} + .comment-div { display: flex; align-items: center; diff --git a/src/app/pages/post/post.component.html b/src/app/pages/post/post.component.html index c973280..73b3f87 100644 --- a/src/app/pages/post/post.component.html +++ b/src/app/pages/post/post.component.html @@ -1,7 +1,7 @@Mis à jour le {{ comment.commentDate | date: "dd/MM/yyyy à HH:mm" }}
+Modifié le {{ comment.commentDate | date: "dd/MM/yyyy à HH:mm" }}
} @else {Envoyé le {{ comment.commentDate | date: "dd/MM/yyyy à HH:mm" }}
} + @if (actualAuthor) { + @if (comment.authorId === actualAuthor.id || actualAuthor.role === 'ADMIN') { +{{ comment.content }}
diff --git a/src/app/pages/post/post.component.ts b/src/app/pages/post/post.component.ts index cd30109..97c134b 100644 --- a/src/app/pages/post/post.component.ts +++ b/src/app/pages/post/post.component.ts @@ -15,6 +15,8 @@ import {CookieService} from 'ngx-cookie-service'; import {Author} from '../../models/author'; import {CommentFormComponent} from '../../components/comment-form/comment-form.component'; import {FooterComponent} from '../../components/footer/footer.component'; +import {Button} from 'primeng/button'; +import {DialogModule} from 'primeng/dialog'; @Component({ selector: 'app-post', @@ -26,7 +28,9 @@ import {FooterComponent} from '../../components/footer/footer.component'; CardModule, SafeHtmlPipe, CommentFormComponent, - FooterComponent + FooterComponent, + Button, + DialogModule ], templateUrl: './post.component.html', styleUrl: './post.component.css' @@ -36,6 +40,7 @@ export class PostComponent { comments: Comment[] = []; concernedPost: Post | undefined; actualAuthor: Author | undefined; + commentDeleteDialogMap: Map
- {{ comment.authorRole }}
@if (comment.isUpdated) { -Mis à jour le {{ comment.commentDate | date: "dd/MM/yyyy à HH:mm" }}
+Modifié le {{ comment.commentDate | date: "dd/MM/yyyy à HH:mm" }}
} @else {Envoyé le {{ comment.commentDate | date: "dd/MM/yyyy à HH:mm" }}
} + @if (actualAuthor) { + @if (comment.authorId === actualAuthor.id || actualAuthor.role === 'ADMIN') { +