From ca2e2178c98234c9d8de7bd0bb18e2bd554cfcf5 Mon Sep 17 00:00:00 2001 From: MarekWo Date: Thu, 1 Jan 2026 16:35:59 +0100 Subject: [PATCH] refactor: Unify channel and DM interface styling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- app/static/js/app.js | 2 +- app/static/js/dm.js | 38 +++++++++++++++++++++++++++++--------- app/templates/dm.html | 22 ++++++++++++---------- app/templates/index.html | 2 +- 4 files changed, 43 insertions(+), 21 deletions(-) diff --git a/app/static/js/app.js b/app/static/js/app.js index 795bca6..8af400d 100644 --- a/app/static/js/app.js +++ b/app/static/js/app.js @@ -574,7 +574,7 @@ function updateStatus(status) { function updateLastRefresh() { const now = new Date(); const timeStr = now.toLocaleTimeString(); - document.getElementById('lastRefresh').textContent = `Last refresh: ${timeStr}`; + document.getElementById('lastRefresh').textContent = `Updated: ${timeStr}`; } /** diff --git a/app/static/js/dm.js b/app/static/js/dm.js index 7497b65..5b055a2 100644 --- a/app/static/js/dm.js +++ b/app/static/js/dm.js @@ -36,6 +36,9 @@ document.addEventListener('DOMContentLoaded', async function() { // Load conversations into dropdown await loadConversations(); + // Load connection status + await loadStatus(); + // Check for initial conversation from URL parameter if (window.MC_CONFIG && window.MC_CONFIG.initialConversation) { const convId = window.MC_CONFIG.initialConversation; @@ -45,8 +48,6 @@ document.addEventListener('DOMContentLoaded', async function() { // Setup auto-refresh setupAutoRefresh(); - - updateStatus('connected', 'Ready'); }); // Handle page restoration from cache (PWA back/forward navigation) @@ -484,6 +485,9 @@ function setupAutoRefresh() { // Reload conversations to update unread indicators await loadConversations(); + // Update connection status + await loadStatus(); + // If viewing a conversation, check for new messages if (currentConversationId) { await checkForNewMessages(); @@ -659,21 +663,37 @@ async function markAsRead(conversationId, timestamp) { 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 */ -function updateStatus(status, message) { +function updateStatus(status) { const statusEl = document.getElementById('dmStatusText'); if (!statusEl) return; - const statusColors = { - 'connected': 'success', - 'disconnected': 'danger', - 'connecting': 'warning' + const icons = { + connected: ' Connected', + disconnected: ' Disconnected', + connecting: ' Connecting...' }; - const color = statusColors[status] || 'secondary'; - statusEl.innerHTML = ` ${message}`; + statusEl.innerHTML = icons[status] || icons.connecting; } /** diff --git a/app/templates/dm.html b/app/templates/dm.html index ef158ad..fee0afe 100644 --- a/app/templates/dm.html +++ b/app/templates/dm.html @@ -109,15 +109,17 @@
-
+
- + @@ -138,11 +140,11 @@
-
+
- Ready + Connecting... - - + Updated: Never
diff --git a/app/templates/index.html b/app/templates/index.html index 94d62a6..ca0a0f0 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -100,7 +100,7 @@ Connecting... - Last refresh: Never + Updated: Never