Création de groupe terminé + affichage des noms d'utilisateur dans la discussion

This commit is contained in:
2026-06-11 01:15:04 +02:00
parent 6ffcece3fa
commit 673269e2b8
4 changed files with 15 additions and 3 deletions
@@ -2,5 +2,5 @@
<div class="icon-wrapper">
<img width="50" height="50" src="https://img.icons8.com/ios/50/user-male-circle--v1.png" alt="user"/>
</div>
<span class="username">Nom User</span>
<span class="username">{{ name || 'Utilisateur' }}</span>
</button>
@@ -1,4 +1,5 @@
import { Component } from '@angular/core';
import {Component, inject, Input} from '@angular/core';
import {AuthService} from "../../../core/auth/auth.service";
@Component({
selector: 'app-messages-infouser',
@@ -7,5 +8,8 @@ import { Component } from '@angular/core';
styleUrl: './messages-infouser.component.css'
})
export class MessagesInfoUser {
@Input() name: string = '';
private authService = inject(AuthService);
user = this.authService.currentUser;
}
@@ -2,7 +2,7 @@
<div class="header">
<app-messages-menu/>
<app-messages-infouser/>
<app-messages-infouser [name]="discussionName"/>
</div>
<div class="messages">
@@ -22,11 +22,19 @@ export class MessagesMain implements OnInit {
currentDiscussionId!: string;
currentUserId!: number;
messages: Message[] = [];
discussionName: string = '';
ngOnInit() {
this.currentDiscussionId = this.route.snapshot.paramMap.get('discussionId')!;
this.currentUserId = this.authService.getCurrentUserId();
this.discussionService.getDiscussions().subscribe({
next: (discussions) => {
const discussion = discussions.find(d => d.id === +this.currentDiscussionId);
this.discussionName = discussion?.name ?? '';
}
});
this.discussionService.getMessages(this.currentDiscussionId).subscribe({
next: (messages) => this.messages = messages,
error: (err) => console.error('Impossible de charger les messages', err)