Skip to content

Commit

Permalink
[mirotalksfu] - improve real-time polls
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Jul 19, 2024
1 parent 48106e5 commit 9006ec9
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 287 deletions.
2 changes: 1 addition & 1 deletion app/src/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies: {
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - [email protected]
* @version 1.5.15
* @version 1.5.16
*
*/

Expand Down
5 changes: 5 additions & 0 deletions app/src/config.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ module.exports = {
chatSpeechStartButton: true,
chatGPT: true,
},
poll: {
pollPinButton: true,
pollMaxButton: true,
pollSaveButton: true,
},
participantsList: {
saveInfoButton: true, // presenter
sendFileAllButton: true, // presenter
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mirotalksfu",
"version": "1.5.15",
"version": "1.5.16",
"description": "WebRTC SFU browser-based video calls",
"main": "Server.js",
"scripts": {
Expand Down
11 changes: 5 additions & 6 deletions public/css/Polls.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
position: absolute;
background: var(--body-bg);
padding: 20px;
border-radius: var(--border-radius);
border-radius: 10px;
border: var(--border);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 100%;
Expand Down Expand Up @@ -41,6 +41,10 @@
color: #fff !important;
}

.poll-question {
font-weight: bold;
}

.form {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -73,8 +77,6 @@
.poll-btns {
display: flex;
gap: 10px;
margin-top: 15px;
margin-bottom: 15px;
}

.poll-btn {
Expand Down Expand Up @@ -174,10 +176,7 @@
.poll-header-btns {
display: flex;
gap: 10px;
margin-top: 15px;
margin-bottom: 15px;
position: absolute;
float: right;
right: 20px;
font-size: 1.3rem;
}
50 changes: 27 additions & 23 deletions public/js/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (location.href.substr(0, 5) !== 'https') location.href = 'https' + location.h
* @license For commercial or closed source, contact us at [email protected] or purchase directly via CodeCanyon
* @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970
* @author Miroslav Pejic - [email protected]
* @version 1.5.15
* @version 1.5.16
*
*/

Expand Down Expand Up @@ -176,19 +176,6 @@ const initMicrophoneSelect = getId('initMicrophoneSelect');
const speakerSelect = getId('speakerSelect');
const initSpeakerSelect = getId('initSpeakerSelect');

// ####################################################
// POLLS
// ####################################################

const createPollForm = getId('createPollForm');
const pollsContainer = getId('pollsContainer');
const addOptionButton = getId('addOptionButton');
const delOptionButton = getId('delOptionButton');
const optionsContainer = getId('optionsContainer');
const pollSaveResultsButton = getId('pollSaveResultsButton');
const selectedOptions = {};
let pollOpen = false;

// ####################################################
// DYNAMIC SETTINGS
// ####################################################
Expand Down Expand Up @@ -346,10 +333,11 @@ function initClient() {
setTippy('chatShowParticipantsList', 'Toggle participants list', 'bottom');
setTippy('chatMaxButton', 'Maximize', 'bottom');
setTippy('chatMinButton', 'Minimize', 'bottom');
setTippy('pollSaveResultsButton', 'Save results', 'left');
setTippy('pollTogglePin', 'Toggle pin', 'bottom');
setTippy('pollSaveButton', 'Save results', 'left');
setTippy('pollCloseBtn', 'Close', 'bottom');
setTippy('addOptionButton', 'Add option', 'top');
setTippy('delOptionButton', 'Delete option', 'top');
setTippy('pollAddOptionBtn', 'Add option', 'top');
setTippy('pollDelOptionBtn', 'Delete option', 'top');
setTippy('participantsSaveBtn', 'Save participants info', 'bottom');
setTippy('participantsRaiseHandBtn', 'Toggle raise hands', 'bottom');
setTippy('participantsUnreadMessagesBtn', 'Toggle unread messages', 'bottom');
Expand Down Expand Up @@ -1292,6 +1280,8 @@ function roomIsReady() {
BUTTONS.chat.chatEmojiButton && show(chatEmojiButton);
BUTTONS.chat.chatMarkdownButton && show(chatMarkdownButton);

!BUTTONS.poll.pollSaveButton && hide(pollSaveButton);

isWebkitSpeechRecognitionSupported && BUTTONS.chat.chatSpeechStartButton
? show(chatSpeechStartButton)
: (BUTTONS.chat.chatSpeechStartButton = false);
Expand All @@ -1315,11 +1305,14 @@ function roomIsReady() {
hide(chatTogglePin);
hide(chatMaxButton);
hide(chatMinButton);
rc.pollMaximize();
hide(pollTogglePin);
hide(pollMaxButton);
hide(pollMinButton);
transcription.maximize();
hide(transcriptionTogglePinBtn);
hide(transcriptionMaxBtn);
hide(transcriptionMinBtn);
rc.pollMaximize();
} else {
rc.makeDraggable(emojiPickerContainer, emojiPickerHeader);
rc.makeDraggable(chatRoom, chatHeader);
Expand All @@ -1338,6 +1331,8 @@ function roomIsReady() {
}
BUTTONS.chat.chatPinButton && show(chatTogglePin);
BUTTONS.chat.chatMaxButton && show(chatMaxButton);
BUTTONS.poll.pollPinButton && show(pollTogglePin);
BUTTONS.poll.pollMaxButton && show(pollMaxButton);
BUTTONS.settings.pushToTalk && show(pushToTalkDiv);
BUTTONS.settings.tabRTMPStreamingBtn &&
show(tabRTMPStreamingBtn) &&
Expand Down Expand Up @@ -1580,20 +1575,29 @@ function handleButtons() {
pollButton.onclick = () => {
rc.togglePoll();
};
pollMaxButton.onclick = () => {
rc.pollMaximize();
};
pollMinButton.onclick = () => {
rc.pollMinimize();
};
pollCloseBtn.onclick = () => {
rc.togglePoll();
};
pollSaveResultsButton.onclick = () => {
pollTogglePin.onclick = () => {
rc.togglePollPin();
};
pollSaveButton.onclick = () => {
rc.pollSaveResults();
};
addOptionButton.onclick = () => {
pollAddOptionBtn.onclick = () => {
rc.pollAddOptions();
};
delOptionButton.onclick = () => {
pollDelOptionBtn.onclick = () => {
rc.pollDeleteOptions();
};
createPollForm.onsubmit = (e) => {
rc.pollCreateForm(e);
pollCreateForm.onsubmit = (e) => {
rc.pollCreateNewForm(e);
};
transcriptionButton.onclick = () => {
transcription.toggle();
Expand Down
Loading

0 comments on commit 9006ec9

Please sign in to comment.