[call-me] - add chat
This commit is contained in:
@@ -356,6 +356,11 @@ function handleConnection(socket) {
|
||||
case 'remoteVideo':
|
||||
handleSignalingMessage(data);
|
||||
break;
|
||||
case 'chat':
|
||||
data.from = socket.username || 'Anonymous';
|
||||
handleChatMessage(data);
|
||||
log.debug('Chat message:', data);
|
||||
break;
|
||||
case 'pong':
|
||||
log.debug('Client response:', data.message);
|
||||
break;
|
||||
@@ -455,6 +460,20 @@ function handleConnection(socket) {
|
||||
}
|
||||
}
|
||||
|
||||
// Function to handle chat messages
|
||||
function handleChatMessage(data) {
|
||||
const { text, from } = data;
|
||||
log.debug('Chat message from', from, ':', text);
|
||||
|
||||
// Broadcast the chat message to all connected clients
|
||||
broadcastMsgExpectSender(socket, {
|
||||
type: 'chat',
|
||||
from: from || 'Anonymous',
|
||||
text: text,
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
}
|
||||
|
||||
// Function to handle the closing of a connection
|
||||
function handleClose() {
|
||||
const name = socket.username;
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "call-me",
|
||||
"version": "1.1.12",
|
||||
"version": "1.2.13",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "call-me",
|
||||
"version": "1.1.12",
|
||||
"version": "1.2.13",
|
||||
"license": "AGPLv3",
|
||||
"dependencies": {
|
||||
"@ngrok/ngrok": "1.5.2",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "call-me",
|
||||
"version": "1.1.12",
|
||||
"version": "1.2.13",
|
||||
"description": "Your Go-To for Instant Video Calls",
|
||||
"author": "Miroslav Pejic - miroslav.pejic.85@gmail.com",
|
||||
"license": "AGPLv3",
|
||||
|
||||
@@ -25,6 +25,14 @@ const userSidebar = document.getElementById('userSidebar');
|
||||
const userSearchInput = document.getElementById('userSearchInput');
|
||||
const userList = document.getElementById('userList');
|
||||
const sidebarBtn = document.getElementById('sidebarBtn');
|
||||
const usersTab = document.getElementById('usersTab');
|
||||
const chatTab = document.getElementById('chatTab');
|
||||
const usersContent = document.getElementById('usersContent');
|
||||
const chatContent = document.getElementById('chatContent');
|
||||
const chatNotification = document.getElementById('chatNotification');
|
||||
const chatMessages = document.getElementById('chatMessages');
|
||||
const chatForm = document.getElementById('chatForm');
|
||||
const chatInput = document.getElementById('chatInput');
|
||||
const shareRoomBtn = document.getElementById('shareRoomBtn');
|
||||
const hideBtn = document.getElementById('hideBtn');
|
||||
const swapCameraBtn = document.getElementById('swapCameraBtn');
|
||||
@@ -55,6 +63,10 @@ let allConnectedUsers = [];
|
||||
let filteredUsers = [];
|
||||
let selectedUser = null;
|
||||
|
||||
// Chat state
|
||||
let unreadMessages = 0;
|
||||
let currentTab = 'users';
|
||||
|
||||
// Variable to store the interval ID
|
||||
let sessionTimerId = null;
|
||||
|
||||
@@ -368,6 +380,9 @@ function handleMessage(data) {
|
||||
case 'remoteVideo':
|
||||
handleRemoteVideo(data);
|
||||
break;
|
||||
case 'chat':
|
||||
addChatMessage(data, false);
|
||||
break;
|
||||
case 'leave':
|
||||
handleLeave(false);
|
||||
break;
|
||||
@@ -407,6 +422,8 @@ function handleListeners() {
|
||||
localVideoContainer.addEventListener('click', toggleFullScreen);
|
||||
remoteVideo.addEventListener('click', toggleFullScreen);
|
||||
usernameIn.addEventListener('keyup', (e) => handleKeyUp(e, handleSignInClick));
|
||||
usersTab.addEventListener('click', () => switchTab('users'));
|
||||
chatTab.addEventListener('click', () => switchTab('chat'));
|
||||
|
||||
// Sidebar toggle
|
||||
if (sidebarBtn && userSidebar) {
|
||||
@@ -1117,6 +1134,100 @@ userSearchInput?.addEventListener('input', (e) => {
|
||||
filterUserList(e.target.value);
|
||||
});
|
||||
|
||||
// Tab switching function
|
||||
function switchTab(tabName) {
|
||||
currentTab = tabName;
|
||||
|
||||
// Update tab buttons
|
||||
if (usersTab && chatTab) {
|
||||
usersTab.classList.remove('active');
|
||||
chatTab.classList.remove('active');
|
||||
|
||||
if (tabName === 'users') {
|
||||
usersTab.classList.add('active');
|
||||
} else {
|
||||
chatTab.classList.add('active');
|
||||
// Clear unread messages when switching to chat
|
||||
unreadMessages = 0;
|
||||
updateChatNotification();
|
||||
}
|
||||
}
|
||||
|
||||
// Update tab content
|
||||
if (usersContent && chatContent) {
|
||||
usersContent.classList.remove('active');
|
||||
chatContent.classList.remove('active');
|
||||
tabName === 'users' ? usersContent.classList.add('active') : chatContent.classList.add('active');
|
||||
}
|
||||
}
|
||||
|
||||
// Update chat notification badge
|
||||
function updateChatNotification() {
|
||||
if (chatNotification) {
|
||||
if (unreadMessages > 0) {
|
||||
chatNotification.textContent = unreadMessages > 99 ? '99+' : unreadMessages.toString();
|
||||
chatNotification.classList.remove('hidden');
|
||||
} else {
|
||||
chatNotification.classList.add('hidden');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Chat form handler
|
||||
if (chatForm && chatInput) {
|
||||
chatForm.addEventListener('submit', (e) => {
|
||||
e.preventDefault();
|
||||
const text = chatInput.value.trim();
|
||||
if (text.length > 0) {
|
||||
socket.emit('message', { type: 'chat', text });
|
||||
addChatMessage({ from: userName || 'Me', text, timestamp: Date.now() }, true);
|
||||
chatInput.value = '';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addChatMessage(msg, isSelf = false) {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'chat-message';
|
||||
if (isSelf) {
|
||||
div.classList.add('own-message');
|
||||
}
|
||||
|
||||
const userSpan = document.createElement('span');
|
||||
userSpan.className = 'chat-user';
|
||||
userSpan.textContent = isSelf ? 'Me' : msg.from;
|
||||
|
||||
const textSpan = document.createElement('span');
|
||||
textSpan.className = 'chat-text';
|
||||
textSpan.textContent = ': ' + msg.text;
|
||||
|
||||
const timeSpan = document.createElement('span');
|
||||
timeSpan.className = 'chat-time';
|
||||
timeSpan.textContent = formatChatTime(msg.timestamp);
|
||||
|
||||
div.appendChild(userSpan);
|
||||
div.appendChild(textSpan);
|
||||
div.appendChild(timeSpan);
|
||||
chatMessages.appendChild(div);
|
||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
||||
|
||||
// Handle unread message counter
|
||||
if (!isSelf && currentTab !== 'chat') {
|
||||
unreadMessages++;
|
||||
updateChatNotification();
|
||||
|
||||
// Show toast notification for new messages only if sidebar is not opened
|
||||
if (!userSidebar.classList.contains('active')) {
|
||||
toast(`New message from ${msg.from}`, 'info', 'top-end', 2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function formatChatTime(ts) {
|
||||
const d = new Date(ts);
|
||||
return d.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
||||
}
|
||||
|
||||
// Clean up before window close or reload
|
||||
window.onbeforeunload = () => {
|
||||
handleHangUpClick();
|
||||
|
||||
+28
-5
@@ -58,18 +58,41 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Sidebar for user list -->
|
||||
<!-- Sidebar with tabs for users and chat -->
|
||||
<div id="userSidebar" class="user-sidebar">
|
||||
<div class="user-sidebar-header">
|
||||
<span class="user-sidebar-title"> <i class="fas fa-users"></i> Users</span>
|
||||
<div class="sidebar-tabs">
|
||||
<button id="usersTab" class="sidebar-tab active" data-tab="users">
|
||||
<i class="fas fa-users"></i> Users
|
||||
</button>
|
||||
<button id="chatTab" class="sidebar-tab" data-tab="chat">
|
||||
<i class="fas fa-comments"></i> Chat
|
||||
<span id="chatNotification" class="chat-notification hidden">0</span>
|
||||
</button>
|
||||
</div>
|
||||
<button id="exitSidebarBtn" class="btn btn-exit-sidebar" title="Close sidebar">
|
||||
<i class="fas fa-times"></i>
|
||||
</button>
|
||||
</div>
|
||||
<div class="user-search-bar">
|
||||
<input type="text" id="userSearchInput" placeholder="Search users..." autocomplete="off" />
|
||||
|
||||
<!-- Users Tab Content -->
|
||||
<div id="usersContent" class="tab-content active">
|
||||
<div class="user-search-bar">
|
||||
<input type="text" id="userSearchInput" placeholder="Search users..." autocomplete="off" />
|
||||
</div>
|
||||
<ul id="userList" class="user-list"></ul>
|
||||
</div>
|
||||
|
||||
<!-- Chat Tab Content -->
|
||||
<div id="chatContent" class="tab-content">
|
||||
<div id="chatMessages" class="chat-messages"></div>
|
||||
<form id="chatForm" class="chat-form" autocomplete="off">
|
||||
<input id="chatInput" type="text" placeholder="Type a message..." autocomplete="off" />
|
||||
<button type="submit" class="btn btn-primary btn-send-chat">
|
||||
<i class="fas fa-paper-plane"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<ul id="userList" class="user-list"></ul>
|
||||
</div>
|
||||
|
||||
<!-- Sign-in Page -->
|
||||
|
||||
+398
-41
@@ -137,8 +137,10 @@ video {
|
||||
height: auto;
|
||||
border: none;
|
||||
border-radius: var(--border-radius);
|
||||
object-fit: contain;
|
||||
object-fit: cover;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
video:hover {
|
||||
@@ -161,29 +163,69 @@ video::-webkit-media-controls {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 20px;
|
||||
width: 15vw;
|
||||
height: 15vh;
|
||||
width: 200px;
|
||||
height: 150px;
|
||||
border-radius: var(--border-radius);
|
||||
border: none;
|
||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||
overflow: hidden;
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
#localVideoContainer:hover {
|
||||
border-color: rgba(255, 255, 255, 0.6);
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
#localVideo {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
border-radius: calc(var(--border-radius) - 2px);
|
||||
}
|
||||
|
||||
#localUsername {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 4px;
|
||||
left: 8px;
|
||||
color: var(--text-color);
|
||||
font-size: x-small;
|
||||
border-radius: 5px;
|
||||
margin: 5px;
|
||||
background: rgba(0, 0, 0, 0.7);
|
||||
padding: 2px 6px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
border-radius: 4px;
|
||||
backdrop-filter: blur(4px);
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
/* Remote Video Styles */
|
||||
#remoteVideoContainer {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 80vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
border-radius: var(--border-radius);
|
||||
overflow: hidden;
|
||||
margin: 10px auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
#remoteVideo {
|
||||
z-index: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
border-radius: var(--border-radius);
|
||||
border: none;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
#remoteVideo:hover {
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
#streamStatusContainer {
|
||||
@@ -203,15 +245,105 @@ video::-webkit-media-controls {
|
||||
|
||||
/* Hide Local Video on Mobile */
|
||||
@media (max-width: 768px) {
|
||||
#localUsername {
|
||||
font-size: 8px;
|
||||
#localVideoContainer {
|
||||
width: 120px;
|
||||
height: 90px;
|
||||
top: 15px;
|
||||
left: 15px;
|
||||
}
|
||||
|
||||
#localVideoContainer:hover {
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
#localUsername {
|
||||
font-size: 0.65rem;
|
||||
padding: 1px 4px;
|
||||
bottom: 2px;
|
||||
left: 4px;
|
||||
}
|
||||
|
||||
#remoteVideoContainer {
|
||||
height: 75vh;
|
||||
}
|
||||
|
||||
#remoteVideo {
|
||||
height: 70vh;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tablet responsive */
|
||||
@media (min-width: 769px) and (max-width: 1024px) {
|
||||
#localVideoContainer {
|
||||
width: 160px;
|
||||
height: 120px;
|
||||
}
|
||||
|
||||
#remoteVideoContainer {
|
||||
height: 75vh;
|
||||
}
|
||||
}
|
||||
|
||||
/* Desktop responsive */
|
||||
@media (min-width: 1025px) {
|
||||
#localVideoContainer {
|
||||
width: 200px;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
#remoteVideoContainer {
|
||||
height: 80vh;
|
||||
}
|
||||
}
|
||||
|
||||
/* Large screens */
|
||||
@media (min-width: 1440px) {
|
||||
#localVideoContainer {
|
||||
width: 240px;
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
#remoteVideoContainer {
|
||||
height: 85vh;
|
||||
}
|
||||
}
|
||||
|
||||
/* Landscape orientation for mobile */
|
||||
@media (max-width: 768px) and (orientation: landscape) {
|
||||
#localVideoContainer {
|
||||
width: 100px;
|
||||
height: 75px;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
#remoteVideoContainer {
|
||||
height: 90vh;
|
||||
}
|
||||
}
|
||||
|
||||
/* Very small screens */
|
||||
@media (max-width: 480px) {
|
||||
#localVideoContainer {
|
||||
width: 100px;
|
||||
height: 75px;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
}
|
||||
|
||||
#localUsername {
|
||||
font-size: 0.6rem;
|
||||
padding: 1px 3px;
|
||||
}
|
||||
|
||||
#remoteVideoContainer {
|
||||
height: 70vh;
|
||||
margin: 5px auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hidden Elements */
|
||||
.hide {
|
||||
visibility: hidden;
|
||||
@@ -281,12 +413,12 @@ input {
|
||||
|
||||
/* User Sidebar Styles */
|
||||
.user-sidebar {
|
||||
z-index: 5;
|
||||
z-index: 1000;
|
||||
position: fixed;
|
||||
display: flex;
|
||||
top: 0;
|
||||
right: 0;
|
||||
width: 320px;
|
||||
width: 350px;
|
||||
height: 100vh;
|
||||
background: rgba(30, 32, 36, 0.98);
|
||||
flex-direction: column;
|
||||
@@ -297,6 +429,7 @@ input {
|
||||
transform: translateX(100%);
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.user-sidebar.active {
|
||||
@@ -307,74 +440,298 @@ input {
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
/* User Sidebar Header */
|
||||
/* User Sidebar Header with Tabs */
|
||||
.user-sidebar-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0.5rem 1rem 0.5rem 1rem;
|
||||
background: rgba(30, 32, 36, 0.98);
|
||||
padding: 0.5rem 1rem;
|
||||
background: rgba(24, 25, 28, 0.95);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
.user-sidebar-title {
|
||||
font-weight: bold;
|
||||
font-size: 1rem;
|
||||
color: #fff;
|
||||
|
||||
.sidebar-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.sidebar-tab {
|
||||
background: none;
|
||||
border: none;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
font-size: 0.9rem;
|
||||
padding: 8px 12px;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
transition: all 0.2s ease;
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.sidebar-tab:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
}
|
||||
|
||||
.sidebar-tab.active {
|
||||
background: rgba(0, 123, 255, 0.2);
|
||||
color: #007bff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.chat-notification {
|
||||
background: #dc3545;
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 0.7rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-left: 4px;
|
||||
animation: pulse 2s infinite;
|
||||
}
|
||||
|
||||
.chat-notification.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
transform: scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.btn-exit-sidebar {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #fff;
|
||||
font-size: 1.3rem;
|
||||
padding: 0.2rem 0.5rem;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
font-size: 1.2rem;
|
||||
padding: 0.3rem 0.6rem;
|
||||
cursor: pointer;
|
||||
transition: color 0.2s;
|
||||
border-radius: 6px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.btn-exit-sidebar:hover {
|
||||
color: #d9534f;
|
||||
color: #dc3545;
|
||||
background: rgba(220, 53, 69, 0.1);
|
||||
}
|
||||
|
||||
/* Tab Content */
|
||||
.tab-content {
|
||||
display: none;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
height: calc(100vh - 60px);
|
||||
}
|
||||
|
||||
.tab-content.active {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
/* User Search Bar */
|
||||
.user-search-bar {
|
||||
padding: 16px 16px 16px 16px;
|
||||
background: #23242a;
|
||||
padding: 16px;
|
||||
background: rgba(35, 36, 42, 0.8);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
#userSearchInput {
|
||||
width: 100%;
|
||||
padding: 8px 12px;
|
||||
border-radius: 6px;
|
||||
border: none;
|
||||
background: #18191c;
|
||||
padding: 10px 14px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
background: rgba(24, 25, 28, 0.8);
|
||||
color: #fff;
|
||||
font-size: 1em;
|
||||
font-size: 0.95em;
|
||||
outline: none;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
#userSearchInput:focus {
|
||||
border-color: #007bff;
|
||||
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
|
||||
}
|
||||
|
||||
#userSearchInput::placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
/* User List Styles */
|
||||
.user-list {
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
padding: 0 0 16px 0;
|
||||
padding: 8px 0;
|
||||
list-style: none;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.user-list li {
|
||||
padding: 12px 20px;
|
||||
color: #fff;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background 0.15s,
|
||||
color 0.15s;
|
||||
transition: all 0.15s ease;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 1.05em;
|
||||
font-size: 0.95em;
|
||||
border-left: 3px solid transparent;
|
||||
}
|
||||
|
||||
.user-list li:hover {
|
||||
background: #2a2b31;
|
||||
background: rgba(42, 43, 49, 0.8);
|
||||
color: #ffd700;
|
||||
border-left-color: #ffd700;
|
||||
}
|
||||
|
||||
.user-list li.selected {
|
||||
background: rgba(0, 123, 255, 0.15);
|
||||
color: #007bff;
|
||||
border-left-color: #007bff;
|
||||
}
|
||||
|
||||
/* Chat Messages */
|
||||
.chat-messages {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 16px;
|
||||
background: rgba(24, 25, 28, 0.6);
|
||||
}
|
||||
|
||||
.chat-message {
|
||||
margin-bottom: 12px;
|
||||
padding: 8px 12px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-radius: 8px;
|
||||
border-left: 3px solid transparent;
|
||||
}
|
||||
|
||||
.chat-message:hover {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.chat-message.own-message {
|
||||
background: rgba(0, 123, 255, 0.1);
|
||||
border-left-color: #007bff;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.chat-message .chat-user {
|
||||
font-weight: 600;
|
||||
color: #007bff;
|
||||
margin-right: 0.5em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.chat-message.own-message .chat-user {
|
||||
color: #28a745;
|
||||
}
|
||||
|
||||
.chat-message .chat-text {
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
line-height: 1.4;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.chat-message .chat-time {
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
font-size: 0.75em;
|
||||
margin-left: 0.5em;
|
||||
float: right;
|
||||
}
|
||||
|
||||
/* Chat Form */
|
||||
.chat-form {
|
||||
display: flex;
|
||||
padding: 16px;
|
||||
background: rgba(35, 36, 42, 0.9);
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
#chatInput {
|
||||
flex: 1;
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
border-radius: 8px;
|
||||
padding: 10px 14px;
|
||||
background: rgba(24, 25, 28, 0.8);
|
||||
color: #fff;
|
||||
font-size: 0.95em;
|
||||
outline: none;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
#chatInput:focus {
|
||||
border-color: #007bff;
|
||||
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
|
||||
}
|
||||
|
||||
#chatInput::placeholder {
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
|
||||
.btn-send-chat {
|
||||
background: #007bff;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 10px 16px;
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
.btn-send-chat:hover {
|
||||
background: #0056b3;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
|
||||
}
|
||||
|
||||
.btn-send-chat:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* Mobile Responsive Styles */
|
||||
@media (max-width: 768px) {
|
||||
.user-sidebar {
|
||||
width: 100vw;
|
||||
max-width: 100vw;
|
||||
}
|
||||
|
||||
.sidebar-tabs {
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.sidebar-tab {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 10px 8px;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.chat-messages {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.chat-form {
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
#chatInput {
|
||||
font-size: 16px; /* Prevent zoom on iOS */
|
||||
}
|
||||
}
|
||||
|
||||
.user-list li.selected {
|
||||
background: #444;
|
||||
color: #ffd700;
|
||||
|
||||
Reference in New Issue
Block a user