mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-06 18:01:11 +02:00
refactor: Unify channel and DM interface styling
- Change DM message input from input to textarea (rows=2) for consistency - Increase DM form padding (p-2 → p-3) to match channel view - Increase DM status bar padding (p-1 → p-2) with larger font - Replace "Last refresh:" with "Updated:" in both views - Update DM status to show connection states (Connected/Connecting/Disconnected) instead of "Ready" - Add loadStatus() function to DM page for proper connection monitoring - Unify message input area height and status bar appearance across both pages 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -574,7 +574,7 @@ function updateStatus(status) {
|
|||||||
function updateLastRefresh() {
|
function updateLastRefresh() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const timeStr = now.toLocaleTimeString();
|
const timeStr = now.toLocaleTimeString();
|
||||||
document.getElementById('lastRefresh').textContent = `Last refresh: ${timeStr}`;
|
document.getElementById('lastRefresh').textContent = `Updated: ${timeStr}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+29
-9
@@ -36,6 +36,9 @@ document.addEventListener('DOMContentLoaded', async function() {
|
|||||||
// Load conversations into dropdown
|
// Load conversations into dropdown
|
||||||
await loadConversations();
|
await loadConversations();
|
||||||
|
|
||||||
|
// Load connection status
|
||||||
|
await loadStatus();
|
||||||
|
|
||||||
// Check for initial conversation from URL parameter
|
// Check for initial conversation from URL parameter
|
||||||
if (window.MC_CONFIG && window.MC_CONFIG.initialConversation) {
|
if (window.MC_CONFIG && window.MC_CONFIG.initialConversation) {
|
||||||
const convId = window.MC_CONFIG.initialConversation;
|
const convId = window.MC_CONFIG.initialConversation;
|
||||||
@@ -45,8 +48,6 @@ document.addEventListener('DOMContentLoaded', async function() {
|
|||||||
|
|
||||||
// Setup auto-refresh
|
// Setup auto-refresh
|
||||||
setupAutoRefresh();
|
setupAutoRefresh();
|
||||||
|
|
||||||
updateStatus('connected', 'Ready');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle page restoration from cache (PWA back/forward navigation)
|
// Handle page restoration from cache (PWA back/forward navigation)
|
||||||
@@ -484,6 +485,9 @@ function setupAutoRefresh() {
|
|||||||
// Reload conversations to update unread indicators
|
// Reload conversations to update unread indicators
|
||||||
await loadConversations();
|
await loadConversations();
|
||||||
|
|
||||||
|
// Update connection status
|
||||||
|
await loadStatus();
|
||||||
|
|
||||||
// If viewing a conversation, check for new messages
|
// If viewing a conversation, check for new messages
|
||||||
if (currentConversationId) {
|
if (currentConversationId) {
|
||||||
await checkForNewMessages();
|
await checkForNewMessages();
|
||||||
@@ -659,21 +663,37 @@ async function markAsRead(conversationId, timestamp) {
|
|||||||
populateConversationSelector();
|
populateConversationSelector();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load connection status
|
||||||
|
*/
|
||||||
|
async function loadStatus() {
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/status');
|
||||||
|
const data = await response.json();
|
||||||
|
|
||||||
|
if (data.success) {
|
||||||
|
updateStatus(data.connected ? 'connected' : 'disconnected');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error loading status:', error);
|
||||||
|
updateStatus('disconnected');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update status indicator
|
* Update status indicator
|
||||||
*/
|
*/
|
||||||
function updateStatus(status, message) {
|
function updateStatus(status) {
|
||||||
const statusEl = document.getElementById('dmStatusText');
|
const statusEl = document.getElementById('dmStatusText');
|
||||||
if (!statusEl) return;
|
if (!statusEl) return;
|
||||||
|
|
||||||
const statusColors = {
|
const icons = {
|
||||||
'connected': 'success',
|
connected: '<i class="bi bi-circle-fill status-connected"></i> Connected',
|
||||||
'disconnected': 'danger',
|
disconnected: '<i class="bi bi-circle-fill status-disconnected"></i> Disconnected',
|
||||||
'connecting': 'warning'
|
connecting: '<i class="bi bi-circle-fill status-connecting"></i> Connecting...'
|
||||||
};
|
};
|
||||||
|
|
||||||
const color = statusColors[status] || 'secondary';
|
statusEl.innerHTML = icons[status] || icons.connecting;
|
||||||
statusEl.innerHTML = `<i class="bi bi-circle-fill text-${color}"></i> ${message}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+12
-10
@@ -109,15 +109,17 @@
|
|||||||
<!-- Send Message Form -->
|
<!-- Send Message Form -->
|
||||||
<div class="row border-top bg-light">
|
<div class="row border-top bg-light">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<form id="dmSendForm" class="p-2">
|
<form id="dmSendForm" class="p-3">
|
||||||
<div class="emoji-picker-container">
|
<div class="emoji-picker-container">
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input type="text"
|
<textarea
|
||||||
id="dmMessageInput"
|
id="dmMessageInput"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
placeholder="Type a message..."
|
placeholder="Type a message..."
|
||||||
maxlength="200"
|
rows="2"
|
||||||
disabled>
|
maxlength="500"
|
||||||
|
disabled
|
||||||
|
></textarea>
|
||||||
<button type="button" class="btn btn-outline-secondary" id="dmEmojiBtn" title="Insert emoji">
|
<button type="button" class="btn btn-outline-secondary" id="dmEmojiBtn" title="Insert emoji">
|
||||||
<i class="bi bi-emoji-smile"></i>
|
<i class="bi bi-emoji-smile"></i>
|
||||||
</button>
|
</button>
|
||||||
@@ -138,11 +140,11 @@
|
|||||||
<!-- Status Bar -->
|
<!-- Status Bar -->
|
||||||
<div class="row border-top">
|
<div class="row border-top">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="p-1 small text-muted d-flex justify-content-between align-items-center">
|
<div class="p-2 small text-muted d-flex justify-content-between align-items-center">
|
||||||
<span id="dmStatusText">
|
<span id="dmStatusText">
|
||||||
<i class="bi bi-circle-fill text-secondary"></i> Ready
|
<i class="bi bi-circle-fill text-secondary"></i> Connecting...
|
||||||
</span>
|
</span>
|
||||||
<span id="dmLastRefresh">-</span>
|
<span id="dmLastRefresh">Updated: Never</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
<span id="statusText">
|
<span id="statusText">
|
||||||
<i class="bi bi-circle-fill text-secondary"></i> Connecting...
|
<i class="bi bi-circle-fill text-secondary"></i> Connecting...
|
||||||
</span>
|
</span>
|
||||||
<span id="lastRefresh">Last refresh: Never</span>
|
<span id="lastRefresh">Updated: Never</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user