Major feature update: Add IRC-style chat, performance optimizations, and mobile support

🚀 New Features:
- Real-time IRC-style text chat with commands (/me, /clear, /help, etc.)
- Full mobile optimization with responsive design and touch controls
- Performance monitoring and adaptive video quality
- Configuration-driven settings with config.json

💬 Chat System:
- IRC-style formatting with timestamps and usernames
- Mobile full-screen chat overlay
- Join/leave notifications and system messages
- Message history with automatic cleanup
- Desktop side panel + mobile overlay sync

📱 Mobile Optimizations:
- Touch-friendly controls with emoji icons
- Progressive Web App meta tags
- Orientation change handling
- Mobile-optimized video constraints
- Dedicated mobile chat interface

 Performance Improvements:
- Adaptive video quality based on network conditions
- Video element pooling and efficient DOM operations
- Connection quality monitoring with visual indicators
- Enhanced peer connection management and cleanup
- SDP optimization for better codec preferences

🔧 Technical Changes:
- Renamed main.js to script.js for better organization
- Added comprehensive configuration system
- Fixed port mismatch (3232) and dynamic connection handling
- Improved ICE candidate routing and WebRTC stability
- Enhanced error handling and resource cleanup

🎨 UI/UX Improvements:
- Modern responsive design with light/dark themes
- Connection quality indicator in header
- Better button styling with icons and text
- Mobile-first responsive breakpoints
- Smooth animations and touch feedback
This commit is contained in:
2025-10-02 20:01:03 +01:00
parent 209c690413
commit 357ed5798e
7 changed files with 2051 additions and 441 deletions

View File

@@ -435,4 +435,542 @@ body {
.control-btn span {
font-size: 0.8rem;
}
}
/* Connection Quality Indicator */
.connection-quality {
display: inline-flex;
align-items: center;
gap: 0.25rem;
font-size: 0.8rem;
margin-left: 1rem;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
}
.quality-indicator {
font-size: 0.7rem;
animation: pulse 2s infinite;
}
.quality-indicator.good {
color: var(--success-color);
}
.quality-indicator.fair {
color: var(--warning-color);
}
.quality-indicator.poor {
color: var(--danger-color);
animation: pulse 1s infinite;
}
.quality-text {
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.05em;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
/* IRC-style Chat Panel */
.main-content {
display: flex;
height: 100%;
gap: 0.5rem;
}
.video-grid {
flex: 1;
min-width: 0; /* Allow flexbox to shrink */
}
.chat-panel {
width: 320px;
background: var(--bg-secondary);
border: 1px solid var(--border-color);
border-radius: 0.5rem;
display: flex;
flex-direction: column;
font-family: 'Courier New', 'Monaco', monospace;
font-size: 0.85rem;
transition: width 0.3s ease;
}
.chat-panel.collapsed {
width: 40px;
overflow: hidden;
}
.chat-header-bar {
background: var(--bg-tertiary);
padding: 0.5rem;
border-bottom: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 0.5rem 0.5rem 0 0;
}
.chat-title {
font-weight: bold;
color: var(--accent-color);
white-space: nowrap;
}
.chat-toggle-btn {
background: none;
border: none;
color: var(--text-secondary);
cursor: pointer;
padding: 0.25rem;
border-radius: 0.25rem;
font-size: 1rem;
transition: background-color 0.2s ease;
}
.chat-toggle-btn:hover {
background: var(--bg-primary);
}
.chat-messages {
flex: 1;
overflow-y: auto;
padding: 0.5rem;
background: var(--bg-primary);
line-height: 1.4;
max-height: 300px;
scrollbar-width: thin;
scrollbar-color: var(--border-color) transparent;
}
.chat-messages::-webkit-scrollbar {
width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
background: var(--border-color);
border-radius: 3px;
}
.message {
margin-bottom: 0.25rem;
word-wrap: break-word;
}
.message-timestamp {
color: var(--text-muted);
font-size: 0.75rem;
margin-right: 0.5rem;
}
.message-username {
color: var(--accent-color);
font-weight: bold;
margin-right: 0.5rem;
}
.message-text {
color: var(--text-primary);
}
.system-message {
color: var(--text-muted);
font-style: italic;
margin-bottom: 0.25rem;
}
.join-message {
color: var(--success-color);
}
.leave-message {
color: var(--danger-color);
}
.own-message .message-username {
color: var(--success-color);
}
.action-message {
font-style: italic;
}
.action-message .message-text {
color: var(--text-secondary);
}
.chat-input-container {
padding: 0.5rem;
border-top: 1px solid var(--border-color);
display: flex;
align-items: center;
gap: 0.5rem;
background: var(--bg-tertiary);
border-radius: 0 0 0.5rem 0.5rem;
}
.chat-prompt {
color: var(--accent-color);
font-weight: bold;
font-size: 1rem;
}
.chat-input {
flex: 1;
background: var(--bg-primary);
border: 1px solid var(--border-color);
border-radius: 0.25rem;
padding: 0.375rem 0.5rem;
color: var(--text-primary);
font-family: inherit;
font-size: 0.85rem;
}
.chat-input:focus {
outline: none;
border-color: var(--accent-color);
box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}
.send-button {
background: var(--accent-color);
color: white;
border: none;
border-radius: 0.25rem;
padding: 0.375rem 0.75rem;
cursor: pointer;
font-size: 0.8rem;
font-weight: 500;
transition: background-color 0.2s ease;
}
.send-button:hover {
background: #0056b3;
}
.send-button:disabled {
background: var(--text-muted);
cursor: not-allowed;
}
/* Mobile-specific styles */
.mobile-only {
display: none;
}
.mobile-chat-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: var(--bg-primary);
z-index: 1000;
display: flex;
flex-direction: column;
transition: transform 0.3s ease;
}
.mobile-chat-overlay.hidden {
transform: translateY(100%);
}
.mobile-chat-header {
background: var(--bg-tertiary);
padding: 1rem;
border-bottom: 1px solid var(--border-color);
display: flex;
justify-content: space-between;
align-items: center;
position: sticky;
top: 0;
z-index: 10;
}
.mobile-chat-header h3 {
color: var(--accent-color);
font-family: 'Courier New', 'Monaco', monospace;
font-size: 1.2rem;
margin: 0;
}
.close-chat-btn {
background: none;
border: none;
font-size: 1.5rem;
color: var(--text-secondary);
cursor: pointer;
padding: 0.5rem;
border-radius: 0.25rem;
transition: background-color 0.2s ease;
}
.close-chat-btn:hover {
background: var(--bg-secondary);
}
.mobile-chat-messages {
flex: 1;
overflow-y: auto;
padding: 1rem;
font-family: 'Courier New', 'Monaco', monospace;
font-size: 0.9rem;
line-height: 1.4;
-webkit-overflow-scrolling: touch;
}
.mobile-chat-input-container {
padding: 1rem;
border-top: 1px solid var(--border-color);
display: flex;
gap: 0.5rem;
background: var(--bg-secondary);
position: sticky;
bottom: 0;
}
.mobile-chat-input {
flex: 1;
background: var(--bg-primary);
border: 2px solid var(--border-color);
border-radius: 0.5rem;
padding: 0.75rem;
color: var(--text-primary);
font-family: 'Courier New', 'Monaco', monospace;
font-size: 1rem;
min-height: 44px; /* Touch-friendly size */
}
.mobile-chat-input:focus {
outline: none;
border-color: var(--accent-color);
box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}
.mobile-send-button {
background: var(--accent-color);
color: white;
border: none;
border-radius: 0.5rem;
padding: 0.75rem 1.5rem;
cursor: pointer;
font-weight: 600;
min-width: 80px;
min-height: 44px; /* Touch-friendly size */
transition: background-color 0.2s ease;
}
.mobile-send-button:hover {
background: #0056b3;
}
.mobile-send-button:active {
transform: scale(0.98);
}
/* Enhanced mobile responsive design */
@media (max-width: 768px) {
/* Hide desktop chat panel on mobile */
.chat-panel {
display: none;
}
/* Show mobile-only elements */
.mobile-only {
display: flex;
}
/* Adjust main content for full-screen video */
.main-content {
flex-direction: column;
height: 100%;
}
.video-grid {
flex: 1;
width: 100%;
padding: 0.5rem;
}
/* Mobile-optimized video containers */
.remoteVideoContainer {
border-radius: 0.75rem;
margin-bottom: 0.5rem;
}
.remoteVideo {
border-radius: 0.75rem;
}
/* Larger touch targets for controls */
.control-btn {
min-width: 60px;
min-height: 60px;
padding: 0.75rem;
border-radius: 50%;
flex-direction: column;
gap: 0.25rem;
font-size: 0.75rem;
}
.btn-icon {
font-size: 1.5rem;
line-height: 1;
}
.btn-text {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
/* Mobile chat controls styling */
.chat-controls {
padding: 1rem;
gap: 1rem;
background: var(--bg-secondary);
border-top: 1px solid var(--border-color);
}
/* Optimize header for mobile */
.chat-header {
padding: 0.75rem 1rem;
flex-wrap: wrap;
}
.header-left {
flex: 1;
min-width: 0;
}
.header-left h1 {
font-size: 1.2rem;
}
.connection-quality {
margin-left: 0.5rem;
font-size: 0.7rem;
padding: 0.2rem 0.4rem;
}
/* Mobile self-view positioning */
.self-view {
width: 100px;
height: 75px;
bottom: 7rem;
right: 1rem;
}
/* Mobile username modal */
.modal-content {
margin: 2rem 1rem;
padding: 2rem 1.5rem;
border-radius: 1rem;
}
.input-group input {
padding: 0.75rem;
font-size: 1rem;
border-radius: 0.5rem;
}
#joinButton {
padding: 0.75rem 2rem;
font-size: 1rem;
border-radius: 0.5rem;
}
/* Improve mobile message display */
.message {
padding: 0.25rem 0;
line-height: 1.5;
}
.message-timestamp {
font-size: 0.7rem;
}
.message-username {
font-size: 0.85rem;
}
.message-text {
font-size: 0.9rem;
word-break: break-word;
}
}
/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
.chat-controls {
gap: 0.75rem;
padding: 0.75rem;
}
.control-btn {
min-width: 50px;
min-height: 50px;
padding: 0.5rem;
}
.btn-icon {
font-size: 1.2rem;
}
.btn-text {
font-size: 0.6rem;
}
.modal-content {
margin: 1rem 0.5rem;
padding: 1.5rem 1rem;
}
}
/* Landscape orientation optimizations */
@media (max-width: 896px) and (orientation: landscape) {
.chat-header {
padding: 0.5rem 1rem;
}
.chat-controls {
padding: 0.75rem 1rem;
}
.control-btn {
min-height: 50px;
}
.self-view {
bottom: 5.5rem;
width: 80px;
height: 60px;
}
}
/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
.control-btn:active {
transform: scale(0.95);
background: var(--bg-tertiary);
}
.header-btn:active {
transform: scale(0.95);
}
.chat-toggle-btn:active {
transform: scale(0.95);
}
}