From f938642a391a34a9fab8a18a6dfa5dc8ccce0eaf Mon Sep 17 00:00:00 2001 From: KyrunaKJ <144215395+KyrunaKJ@users.noreply.github.com> Date: Tue, 19 Dec 2023 03:33:18 -0500 Subject: [PATCH 1/3] Add watching-subheader to user-info class --- assets/views/embed.html | 1 + 1 file changed, 1 insertion(+) diff --git a/assets/views/embed.html b/assets/views/embed.html index 20f96e01..b4ef0041 100644 --- a/assets/views/embed.html +++ b/assets/views/embed.html @@ -255,6 +255,7 @@
Users
User Info
+
Watching:
Flairs:
From fd3be680b5b3ab56ea2bbfe27a7ad47cd3d2a0ca Mon Sep 17 00:00:00 2001 From: KyrunaKJ <144215395+KyrunaKJ@users.noreply.github.com> Date: Tue, 19 Dec 2023 03:34:21 -0500 Subject: [PATCH 2/3] Update ChatUserInfoMenu.js for watching subheader --- assets/chat/js/menus/ChatUserInfoMenu.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/assets/chat/js/menus/ChatUserInfoMenu.js b/assets/chat/js/menus/ChatUserInfoMenu.js index 39fb8ec0..a687380f 100644 --- a/assets/chat/js/menus/ChatUserInfoMenu.js +++ b/assets/chat/js/menus/ChatUserInfoMenu.js @@ -13,6 +13,8 @@ export default class ChatUserInfoMenu extends ChatMenuFloating { this.header = this.ui.find('.toolbar span'); + this.watchingSubheader = this.ui.find('.user-info h5.watching-subheader')[0]; + this.createdDateSubheader = this.ui.find('.user-info h5.date-subheader')[0]; this.tagSubheader = this.ui.find('.user-info h5.tag-subheader')[0]; @@ -237,6 +239,15 @@ export default class ChatUserInfoMenu extends ChatMenuFloating { const tagNote = this.chat.taggednotes.get(this.clickedNick); const usernameFeatures = selectedUser.classList.value; + const watchingEmbed = this.buildWatchingEmbed(this.clickedNick); + if (watchingEmbed !== '') { + this.watchingSubheader.style.display = ''; + this.watchingSubheader.replaceChildren('Watching: ', watchingEmbed); + } else { + this.watchingSubheader.style.display = 'none'; + this.watchingSubheader.replaceChildren(); + } + const formattedDate = this.buildCreatedDate(this.clickedNick); if (formattedDate) { this.createdDateSubheader.style.display = ''; @@ -292,6 +303,14 @@ export default class ChatUserInfoMenu extends ChatMenuFloating { this.redraw(); } + buildWatchingEmbed(nick) { + const user = this.chat.users.get(nick); + if (!user?.watching) { + return ''; + } + return `${user.watching.id} on ${user.watching.platform}`; + } + buildCreatedDate(nick) { const user = this.chat.users.get(nick.toLowerCase()); if (!user?.createdDate) { From 948e1ee8af952d842255f5a6d5160a42cea8ac71 Mon Sep 17 00:00:00 2001 From: KyrunaKJ Date: Tue, 19 Dec 2023 04:08:42 -0500 Subject: [PATCH 3/3] linted --- assets/chat/js/menus/ChatUserInfoMenu.js | 8 +++++--- assets/views/embed.html | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets/chat/js/menus/ChatUserInfoMenu.js b/assets/chat/js/menus/ChatUserInfoMenu.js index a687380f..088f16d1 100644 --- a/assets/chat/js/menus/ChatUserInfoMenu.js +++ b/assets/chat/js/menus/ChatUserInfoMenu.js @@ -13,7 +13,9 @@ export default class ChatUserInfoMenu extends ChatMenuFloating { this.header = this.ui.find('.toolbar span'); - this.watchingSubheader = this.ui.find('.user-info h5.watching-subheader')[0]; + this.watchingSubheader = this.ui.find( + '.user-info h5.watching-subheader', + )[0]; this.createdDateSubheader = this.ui.find('.user-info h5.date-subheader')[0]; @@ -240,7 +242,7 @@ export default class ChatUserInfoMenu extends ChatMenuFloating { const usernameFeatures = selectedUser.classList.value; const watchingEmbed = this.buildWatchingEmbed(this.clickedNick); - if (watchingEmbed !== '') { + if (watchingEmbed !== '') { this.watchingSubheader.style.display = ''; this.watchingSubheader.replaceChildren('Watching: ', watchingEmbed); } else { @@ -305,7 +307,7 @@ export default class ChatUserInfoMenu extends ChatMenuFloating { buildWatchingEmbed(nick) { const user = this.chat.users.get(nick); - if (!user?.watching) { + if (!user?.watching) { return ''; } return `${user.watching.id} on ${user.watching.platform}`; diff --git a/assets/views/embed.html b/assets/views/embed.html index b4ef0041..9665edd7 100644 --- a/assets/views/embed.html +++ b/assets/views/embed.html @@ -255,7 +255,7 @@
Users
User Info
-
Watching:
+
Watching:
Flairs: