Finished up with css-only flair implementation.

This commit is contained in:
rainbownapkin 2024-11-21 08:42:21 -05:00
parent 5b5f495853
commit 9dbbc4e924
13 changed files with 231 additions and 60 deletions

View file

@ -53,7 +53,7 @@ class userList{
}
defineListeners(){
this.client.socket.on('user-list', (data) => {
this.client.socket.on('userList', (data) => {
this.updateList(data);
});
}
@ -72,12 +72,12 @@ class userList{
var color = this.userColors[Math.floor(Math.random()*this.userColors.length)]
//if this user was in the previous colormap
if(this.colorMap.get(user) != null){
if(this.colorMap.get(user.user) != null){
//Override with previous color
color = this.colorMap.get(user);
color = this.colorMap.get(user.user);
}
newMap.set(user, color);
newMap.set(user.user, color);
this.renderUser(user, color);
});
@ -87,8 +87,14 @@ class userList{
renderUser(user, color){
var userEntry = document.createElement('p');
userEntry.innerText = user;
userEntry.id = `user-entry-${user}`;
userEntry.innerText = user.user;
userEntry.id = `user-entry-${user.user}`;
//Override color with flair
if(user.flair != ""){
color = `flair-${user.flair}`;
}
userEntry.classList.add("chat-panel-users","user-entry",color);
this.userList.appendChild(userEntry);