Skip to content

Commit

Permalink
feat: Added user name under message box in frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienHdz committed Oct 18, 2023
1 parent bb48362 commit 6d02586
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions frontend/src/app/chat-messages/chat-messages.component.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<div class="message-item flex items-start mb-4 last:mb-0">
<img class="rounded-full mr-4" [src]="message.avatar" width="40" height="40" [alt]="message.user" />
<div class="max-w-[480px]">
<div class="text-sm p-3 rounded-lg rounded-tl-none border border-transparent shadow-md mb-1 overflow-auto break-words"
[ngClass]="message.bgClass"
[ngStyle]="{'color': message.textColor}"
[innerHTML]="message.text">
</div>
<img class="rounded-full mr-4" [src]="message.avatar" width="40" height="40" [alt]="message.user" />
<div class="max-w-[480px]">
<div class="text-sm p-3 rounded-lg rounded-tl-none border border-transparent shadow-md mb-1 overflow-auto break-words"
[ngClass]="message.bgClass"
[ngStyle]="{'color': message.textColor}"
[innerHTML]="message.text">
</div>
<div class="message-username text-xs mt-1 font-semibold text-gray-500">{{message.user}}</div>
</div>
</div>
4 changes: 2 additions & 2 deletions frontend/src/app/messages/messages.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class MessagesComponent implements AfterViewInit {
addServerMessage(text: string) {
const serverMsg: Message = {
text: text,
user: 'Server',
user: 'Lexi',
avatar: '../../assets/avatar_profile_pic.png',
bgClass: 'bg-white',
textColor: 'text-slate-800'
Expand All @@ -82,7 +82,7 @@ export class MessagesComponent implements AfterViewInit {
addUserMessage(text: string) {
const userMsg: Message = {
text: text,
user: 'Current User',
user: 'Adrien',
avatar: '../../assets/photo_profil.jpg',
bgClass: 'bg-indigo-500',
textColor: '#FFFFFF'
Expand Down

0 comments on commit 6d02586

Please sign in to comment.