Skip to content

Commit

Permalink
[mirotalkc2c] - improve chat UI
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpejic85 committed Oct 13, 2024
1 parent 5fc2ebd commit 51a13cc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
2 changes: 1 addition & 1 deletion backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license For private project or commercial purposes contact us at: license.mirotalk@gmail.com or purchase it directly via Code Canyon:
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.1.34
* @version 1.1.35
*/

require('dotenv').config();
Expand Down
28 changes: 27 additions & 1 deletion frontend/css/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
}

.chat .body .msg {
margin-bottom: 20px;
display: flex;
flex-direction: column;
}

.chat .body .msg .from {
Expand All @@ -77,6 +78,19 @@
color: var(--secondary-color);
border-bottom: 0.1px solid #439fff;
}

.chat .body .msg.sent .from {
align-self: flex-start;
text-align: left;
margin: 0;
}

.chat .body .msg.received .from {
align-self: flex-end;
text-align: right;
margin: 0;
}

.chat .body .msg .text {
padding: 5px;
border-radius: 10px;
Expand All @@ -87,6 +101,18 @@
user-select: text;
}

.chat .body .msg.sent .text {
background: #495057;
color: white;
border-radius: 10px 10px 10px 0;
}

.chat .body .msg.received .text {
background: #1c7ed6;
color: white;
border-radius: 10px 10px 0 10px;
}

.chat .body .msg .text:hover {
background-color: rgba(255, 255, 255, 0.05);
}
Expand Down
9 changes: 5 additions & 4 deletions frontend/js/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license For private project or commercial purposes contact us at: license.mirotalk@gmail.com or purchase it directly via Code Canyon:
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
* @version 1.1.34
* @version 1.1.35
*/

const roomId = new URLSearchParams(window.location.search).get('room');
Expand Down Expand Up @@ -1477,7 +1477,7 @@ function cleanChat() {
}
playSound('message');
Swal.fire({
position: 'center',
position: 'top',
title: 'Chat',
text: 'Clean up chat messages?',
showDenyButton: true,
Expand Down Expand Up @@ -1543,11 +1543,12 @@ function emitDcMsg(msg) {
}

function appendMessage(name, msg) {
const time = getTime();
const time = getTime(false);
const div = document.createElement('div');
const span = document.createElement('span');
const p = document.createElement('pre');
div.className = 'msg';
const messageClass = name === peerName ? 'sent' : 'received';
div.className = `msg ${messageClass}`;
span.className = 'from';
span.innerText = name + ' ' + time;
p.className = 'text';
Expand Down
4 changes: 2 additions & 2 deletions frontend/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ function secondsToHms(d) {
return hDisplay + ' ' + mDisplay + ' ' + sDisplay;
}

function getTime() {
function getTime(seconds = true) {
const date = new Date();
return date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
return date.getHours() + ':' + date.getMinutes() + (seconds ? ':' + date.getSeconds() : '');
}

function getDataTimeString() {
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": "mirotalkc2c",
"version": "1.1.34",
"version": "1.1.35",
"description": "A free WebRTC Cam-2-Cam browser-based video calls",
"main": "server.js",
"scripts": {
Expand Down

0 comments on commit 51a13cc

Please sign in to comment.