Add gradient-colored display names in ChannelListComponent: implemented name parsing with gradient support, refactored UI logic to dynamically render colored name segments, and improved message handling in ChatService with null channel filtering.

This commit is contained in:
2026-08-01 21:16:37 +02:00
parent 8f9aea2e0f
commit d1acf39a22
3 changed files with 128 additions and 13 deletions
@@ -90,10 +90,13 @@ export class ChatService implements OnDestroy {
messageJson: normalizeComponent(JSON.parse(m.messageJson)),
};
const channelKey = this.getChannelKey(message);
if (channelKey === null) {
return null;
}
message.channelName = channelKey.name;
message.channelType = channelKey.type;
return message;
});
}).filter((message) => message !== null) as ChatMessage[];
this._messages.update((old) => [...old, ...messages]);
messages.forEach((message) => {
@@ -110,7 +113,7 @@ export class ChatService implements OnDestroy {
return messages;
}
private getChannelKey(message: ChatMessage): { name: string, type: ChatChannel['type'] } {
private getChannelKey(message: ChatMessage): { name: string, type: ChatChannel['type'] } | null {
if (message.type === 'GAC') {
return {name: 'Global Admin Chat', type: 'GAC'};
}
@@ -124,11 +127,10 @@ export class ChatService implements OnDestroy {
if (message.type === 'MSG') {
const uuid = this.authService.getUuid();
if (message.uuid === uuid) {
this.updateUserNameMap(message.receiver)
return {name: message.receiver, type: 'DM'};
return null;
}
this.updateUserNameMap(message.uuid)
return {name: message.uuid, type: 'DM'};
this.updateUserNameMap(message.receiver)
return {name: message.receiver, type: 'DM'};
}
return {name: message.server, type: 'SERVER'};
}