Skip to content

Commit 9ae38b8

Browse files
[mirotalk] - feat(ui): theme-aware active state for chat & participants toolbar buttons
1 parent 5eb43b8 commit 9ae38b8

8 files changed

Lines changed: 56 additions & 23 deletions

File tree

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ====================================================
2-
# MiroTalk P2P v.1.8.51 - Environment Configuration
2+
# MiroTalk P2P v.1.8.52 - Environment Configuration
33
# ====================================================
44

55
# App environment

app/src/config.template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/**
44
* ==============================================
5-
* MiroTalk P2P v.1.8.51 - Configuration File
5+
* MiroTalk P2P v.1.8.52 - Configuration File
66
* ==============================================
77
*
88
* This file is the central configuration source.

app/src/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies: {
4545
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
4646
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
4747
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
48-
* @version 1.8.51
48+
* @version 1.8.52
4949
*
5050
*/
5151

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mirotalk",
3-
"version": "1.8.51",
3+
"version": "1.8.52",
44
"description": "A free WebRTC browser-based video call",
55
"main": "server.js",
66
"scripts": {

public/css/client.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,18 @@ body {
508508
transition: all 0.3s ease-in-out;
509509
}
510510

511+
/* Active state for chat / participants toolbar buttons (theme-aware) */
512+
#bottomButtons #chatRoomBtn.is-active,
513+
#bottomButtons #participantsBtn.is-active {
514+
background: color-mix(in srgb, var(--dd-color, #4678f9) 18%, transparent) !important;
515+
box-shadow: inset 0 0 0 1px var(--dd-color, #4678f9);
516+
color: var(--dd-color, #4678f9) !important;
517+
}
518+
#bottomButtons #chatRoomBtn.is-active:hover,
519+
#bottomButtons #participantsBtn.is-active:hover {
520+
background: color-mix(in srgb, var(--dd-color, #4678f9) 28%, transparent) !important;
521+
}
522+
511523
/* Quick device picker (Start Audio/Video) */
512524
#bottomButtons .device-dropdown-toggle {
513525
width: 35px;

public/js/brand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ let brand = {
109109
},
110110
about: {
111111
imageUrl: '../images/mirotalk-logo.gif',
112-
title: 'WebRTC P2P v1.8.51',
112+
title: 'WebRTC P2P v1.8.52',
113113
html: `
114114
<button
115115
id="support-button"

public/js/client.js

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* @license For commercial use or closed source, contact us at license.mirotalk@gmail.com or purchase directly from CodeCanyon
1616
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-p2p-webrtc-realtime-video-conferences/38376661
1717
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
18-
* @version 1.8.51
18+
* @version 1.8.52
1919
*
2020
*/
2121

@@ -80,7 +80,7 @@ const className = {
8080
shareVideoAudio: 'fab fa-youtube',
8181
kickOut: 'fas fa-sign-out-alt',
8282
chatOn: 'fas fa-comment',
83-
chatOff: 'fas fa-comment-slash',
83+
chatOff: 'fas fa-comment',
8484
ghost: 'fas fa-ghost',
8585
undo: 'fas fa-undo',
8686
captionOn: 'fas fa-closed-captioning',
@@ -688,6 +688,7 @@ let isCaptionPinned = false;
688688
let isChatRoomVisible = false;
689689
let isParticipantsVisible = false;
690690
let isChatOpenedByParticipantsBtn = false;
691+
let isOpeningParticipants = false;
691692
let isCaptionBoxVisible = false;
692693
let isChatEmojiVisible = false;
693694
let isChatMarkdownOn = false;
@@ -6324,13 +6325,15 @@ function setChatRoomBtn() {
63246325
setActiveConversation('public');
63256326
msgerDraggable.classList.remove('msger-pinned-sidebar-open');
63266327
msgerCPBtn.classList.remove('active');
6328+
syncChatToolbarButtons();
63276329
msgerInput.focus();
63286330
msgerChat.scrollTop = msgerChat.scrollHeight;
63296331
});
63306332

63316333
msgerSidebarCloseBtn?.addEventListener('click', () => {
63326334
msgerDraggable.classList.remove('msger-pinned-sidebar-open');
63336335
msgerCPBtn.classList.remove('active');
6336+
syncChatToolbarButtons();
63346337
closeAllMsgerParticipantDropdownMenus();
63356338
});
63366339

@@ -6361,12 +6364,7 @@ function setChatRoomBtn() {
63616364

63626365
// open hide chat room
63636366
chatRoomBtn.addEventListener('click', (e) => {
6364-
if (!isChatRoomVisible) {
6365-
showChatRoomDraggable();
6366-
} else {
6367-
hideChatRoomAndEmojiPicker();
6368-
e.target.className = className.chatOn;
6369-
}
6367+
!isChatRoomVisible ? showChatRoomDraggable() : hideChatRoomAndEmojiPicker();
63706368
});
63716369

63726370
// pin/unpin
@@ -6404,6 +6402,7 @@ function setChatRoomBtn() {
64046402
if (isChatPinned) {
64056403
const isOpen = msgerDraggable.classList.toggle('msger-pinned-sidebar-open');
64066404
msgerCPBtn.classList.toggle('active', isOpen);
6405+
syncChatToolbarButtons();
64076406
if (isOpen) {
64086407
searchPeerBarName?.focus();
64096408
} else {
@@ -6570,16 +6569,18 @@ function setParticipantsBtn() {
65706569

65716570
msgerDraggable.classList.remove('msger-pinned-sidebar-open');
65726571
msgerCPBtn.classList.remove('active');
6572+
syncChatToolbarButtons();
65736573
closeAllMsgerParticipantDropdownMenus();
65746574
screenReaderAccessibility.announceMessage('Participants list closed');
65756575
return;
65766576
}
65776577

65786578
msgerDraggable.classList.add('msger-pinned-sidebar-open');
65796579

6580-
if (!isChatRoomVisible) {
6581-
showChatRoomDraggable();
6582-
}
6580+
isOpeningParticipants = true;
6581+
msgerCPBtn.classList.add('active');
6582+
6583+
!isChatRoomVisible ? showChatRoomDraggable() : syncChatToolbarButtons();
65836584

65846585
isChatOpenedByParticipantsBtn = openedChatForParticipants;
65856586

@@ -6591,6 +6592,8 @@ function setParticipantsBtn() {
65916592
await sleep(500);
65926593

65936594
msgerCPBtn.classList.add('active');
6595+
isOpeningParticipants = false;
6596+
syncChatToolbarButtons();
65946597
searchPeerBarName?.focus();
65956598
screenReaderAccessibility.announceMessage('Participants list opened');
65966599
return;
@@ -9911,20 +9914,37 @@ function showChatRoomDraggable() {
99119914
//chatLeftCenter();
99129915
chatCenter();
99139916

9914-
chatRoomBtn.className = className.chatOff;
99159917
isChatRoomVisible = true;
99169918

99179919
if (!isMobileDevice && canBePinned() && pinChatByDefault && !isChatPinned && !isCaptionPinned) {
99189920
chatPin();
99199921
}
99209922

99219923
syncParticipantsPanelVisibility();
9924+
syncChatToolbarButtons();
99229925

99239926
setTippy(chatRoomBtn, 'Close the chat (C)', bottomButtonsPlacement);
9924-
if (chatRoomBtn && chatRoomBtn.setAttribute) chatRoomBtn.setAttribute('aria-pressed', 'true');
99259927
screenReaderAccessibility.announceMessage('Chat opened');
99269928
}
99279929

9930+
/**
9931+
* Sync the active visual state of the chat / participants toolbar buttons
9932+
* with the current chat & participants panel visibility.
9933+
*/
9934+
function syncChatToolbarButtons() {
9935+
const participantsActive = isOpeningParticipants || !!(msgerCPBtn && msgerCPBtn.classList.contains('active'));
9936+
const chatActive = !!isChatRoomVisible && !participantsActive;
9937+
if (chatRoomBtn) {
9938+
chatRoomBtn.classList.toggle('is-active', chatActive);
9939+
chatRoomBtn.setAttribute('aria-pressed', chatActive ? 'true' : 'false');
9940+
}
9941+
if (participantsBtn) {
9942+
participantsBtn.classList.toggle('is-active', participantsActive);
9943+
participantsBtn.setAttribute('aria-pressed', participantsActive ? 'true' : 'false');
9944+
participantsBtn.setAttribute('aria-expanded', participantsActive ? 'true' : 'false');
9945+
}
9946+
}
9947+
99289948
function shouldDockParticipantsPanel() {
99299949
return !isMobileDevice && window.innerWidth > 1200;
99309950
}
@@ -9966,6 +9986,7 @@ function syncParticipantsPanelVisibility(forceVisible = null) {
99669986
msgerCPBtn.classList.remove('active');
99679987
closeAllMsgerParticipantDropdownMenus();
99689988
isParticipantsVisible = false;
9989+
syncChatToolbarButtons();
99699990
return;
99709991
}
99719992

@@ -9987,6 +10008,7 @@ function syncParticipantsPanelVisibility(forceVisible = null) {
998710008
}
998810009

998910010
isParticipantsVisible = shouldShow;
10011+
syncChatToolbarButtons();
999010012
toggleMsgerParticipantsEmptyNotice();
999110013
}
999210014

@@ -10418,13 +10440,12 @@ function hideChatRoomAndEmojiPicker() {
1041810440
elemDisplay(msgerCP, false);
1041910441
elemDisplay(msgerEmojiPicker, false);
1042010442
setColor(msgerEmojiBtn, '#FFFFFF');
10421-
chatRoomBtn.className = className.chatOn;
1042210443
isChatRoomVisible = false;
1042310444
isParticipantsVisible = false;
1042410445
isChatOpenedByParticipantsBtn = false;
1042510446
isChatEmojiVisible = false;
1042610447
setTippy(chatRoomBtn, 'Open the chat (C)', bottomButtonsPlacement);
10427-
if (chatRoomBtn && chatRoomBtn.setAttribute) chatRoomBtn.setAttribute('aria-pressed', 'false');
10448+
syncChatToolbarButtons();
1042810449
screenReaderAccessibility.announceMessage('Chat closed');
1042910450
}
1043010451

@@ -15873,7 +15894,7 @@ function showAbout() {
1587315894
Swal.fire({
1587415895
background: swBg,
1587515896
position: 'center',
15876-
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.51',
15897+
title: brand.about?.title && brand.about.title.trim() !== '' ? brand.about.title : 'WebRTC P2P v1.8.52',
1587715898
imageUrl: brand.about?.imageUrl && brand.about.imageUrl.trim() !== '' ? brand.about.imageUrl : images.about,
1587815899
customClass: { image: 'img-about' },
1587915900
html: renderRoomTemplate('tpl-about-modal', {

0 commit comments

Comments
 (0)