Conversation
There was a problem hiding this comment.
Pull request overview
This PR rewrites src/mindcraft/public/index.html, aiming to modernize the Mindcraft web dashboard UI with theming and multi-language support.
Changes:
- Replaced the previous dashboard layout/styles with a new “card/grid” UI, sticky header, fixed footer, and toast styling.
- Added language selection + theme toggle with persistence via
localStorage. - Removed most of the prior client-side functionality (agent rendering, create-agent flow, settings modals, and live state subscriptions).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| socket.on('connect', () => updateStatus(true)); | ||
| socket.on('disconnect', () => updateStatus(false)); | ||
|
|
There was a problem hiding this comment.
The dashboard no longer subscribes to agent updates: there’s no socket.emit('listen-to-agents') on connect and no handlers for agents-status / state-update. As a result, #agents will never render and #noAgents will never be updated, effectively breaking the UI. Reintroduce the subscription and rendering logic (or equivalent) tied to these existing server events.
| </div> | ||
| </div> | ||
| <footer class="footer"> | ||
| <div><button id="openCreateAgentBtn"><span data-lang="en">➕ New Agent</span></button></div> |
There was a problem hiding this comment.
openCreateAgentBtn is still rendered, but the Create Agent modal and all related JS (fetching /settings_spec.json, profile upload, emitting create-agent, etc.) were removed. This leaves a dead control and removes the ability to create agents from the web UI even though the server still supports create-agent. Either restore the create-agent flow or remove the button to avoid a broken UX.
| <div><button id="openCreateAgentBtn"><span data-lang="en">➕ New Agent</span></button></div> |
| function updateStatus(connected) { | ||
| const statusEl = document.getElementById('msStatus'); | ||
| statusEl.classList.remove('offline', 'online'); | ||
| statusEl.classList.add(connected ? 'online' : 'offline'); |
There was a problem hiding this comment.
updateStatus() only toggles the online/offline classes but never updates the status text, and the markup hard-codes every language string as “Offline”. After a successful connect the badge will still say “Offline”. Consider updating the visible [data-lang] span text (or swapping between separate online/offline spans) when connection state changes.
| statusEl.classList.add(connected ? 'online' : 'offline'); | |
| statusEl.classList.add(connected ? 'online' : 'offline'); | |
| // Update visible status text for all localized spans within the status element | |
| const statusText = connected ? 'Online' : 'Offline'; | |
| const localizedSpans = statusEl.querySelectorAll('[data-lang]'); | |
| if (localizedSpans.length > 0) { | |
| localizedSpans.forEach(span => { | |
| span.textContent = statusText; | |
| }); | |
| } else { | |
| statusEl.textContent = statusText; | |
| } |
| } | ||
| .status-badge.online { color: var(--success); border-color: var(--success); } | ||
| .status-badge.offline { color: var(--danger); border-color: var(--danger); } | ||
| .status-dot { width: 8px; height: 8px; border-radius: 50%; animation: pulse 2s infinite; } |
There was a problem hiding this comment.
.status-dot has size/animation but no background-color, so it will likely be invisible. If the intent is a colored status indicator, set background (e.g., currentColor) and/or override it in .status-badge.online/.offline.
| .status-dot { width: 8px; height: 8px; border-radius: 50%; animation: pulse 2s infinite; } | |
| .status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; } |
| <body data-theme="dark"> | ||
| <header class="header"> | ||
| <div class="header-title"> |
There was a problem hiding this comment.
Theme initialization is inconsistent: <body data-theme="dark"> sets a data-theme attribute on body, but the CSS and setTheme() both use html[data-theme]. This body attribute is unused and can be misleading; consider removing it or switching to a single source of truth.
| <span data-lang="id" style="display:none;">Offline</span> | ||
| <span data-lang="uk" style="display:none;">Автономний</span> | ||
| <span data-lang="cs" style="display:none;">Offline</span> | ||
| <span data-lang="el" style="display:none;">Σύνδεση</span> |
There was a problem hiding this comment.
Greek translation for the offline status appears incorrect: Σύνδεση means “connection/connected”, not “offline”. If this badge is meant to indicate offline, use the appropriate Greek phrase (e.g., “Εκτός σύνδεσης”).
| <span data-lang="el" style="display:none;">Σύνδεση</span> | |
| <span data-lang="el" style="display:none;">Εκτός σύνδεσης</span> |
| .modal-backdrop.active { display: flex; } | ||
| .modal { background: var(--bg-surface); border-radius: 12px; width: 90vw; max-width: 600px; max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); padding: 20px; } | ||
| [data-lang] { display: none; } | ||
| [data-lang="en"] { display: auto; } |
There was a problem hiding this comment.
CSS uses display: auto for language toggling ([data-lang="en"] { display: auto; }), but auto is not a valid value for display. Because [data-lang] { display: none; } hides everything, this rule won’t re-enable English content. Use a valid display value (e.g., inline/block) or toggle a class/hidden attribute instead.
| [data-lang="en"] { display: auto; } | |
| [data-lang="en"] { display: inline; } |
| currentLang = lang; | ||
| localStorage.setItem('mindcraft-lang', lang); | ||
| document.querySelectorAll('[data-lang]').forEach(el => { | ||
| el.style.display = el.getAttribute('data-lang') === lang ? 'auto' : 'none'; |
There was a problem hiding this comment.
setLanguage() assigns el.style.display = 'auto', but auto is not a valid display value. For elements that start with style="display:none", setting an invalid value can leave them hidden, so language switching won’t work. Set to a valid value (e.g., '', inline, block) or use hidden/CSS classes for toggling.
| el.style.display = el.getAttribute('data-lang') === lang ? 'auto' : 'none'; | |
| el.style.display = el.getAttribute('data-lang') === lang ? '' : 'none'; |
No description provided.