mirror of
https://github.com/smittix/intercept.git
synced 2026-07-25 01:08:11 -07:00
Merge pull request #223 from smittix/fix/meshcore-ux-feedback
fix(meshcore): layout height, connection polling, and modal visibility
This commit is contained in:
@@ -20,9 +20,13 @@
|
|||||||
max-width: 100% !important;
|
max-width: 100% !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Container overrides ── */
|
/* ── Visuals container (base rules duplicated from meshtastic.css — lazy-load safety) ── */
|
||||||
#meshcoreVisuals {
|
#meshcoreVisuals {
|
||||||
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
gap: 0;
|
gap: 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,9 +86,21 @@ const MeshCore = (function () {
|
|||||||
body.address = document.getElementById('meshcoreBleSelect').value || null;
|
body.address = document.getElementById('meshcoreBleSelect').value || null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await fetch('/meshcore/connect', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
|
||||||
_updateStatusUI('connecting');
|
_updateStatusUI('connecting');
|
||||||
} catch (e) { console.error('Connect failed:', e); }
|
await fetch('/meshcore/connect', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
||||||
|
_pollUntilConnected(0);
|
||||||
|
} catch (e) {
|
||||||
|
_updateStatusUI('error', 'Connection failed');
|
||||||
|
console.error('Connect failed:', e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _pollUntilConnected(attempts) {
|
||||||
|
if (_connected || attempts > 15) return;
|
||||||
|
setTimeout(async () => {
|
||||||
|
await _checkStatus();
|
||||||
|
if (!_connected) _pollUntilConnected(attempts + 1);
|
||||||
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function disconnect() {
|
async function disconnect() {
|
||||||
@@ -383,23 +395,32 @@ const MeshCore = (function () {
|
|||||||
container.appendChild(arrow);
|
container.appendChild(arrow);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
modal.style.display = 'flex';
|
_openModal(modal);
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeTraceroute() {
|
function closeTraceroute() {
|
||||||
const modal = document.getElementById('meshcoreTracerouteModal');
|
_closeModal(document.getElementById('meshcoreTracerouteModal'));
|
||||||
if (modal) modal.style.display = 'none';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Contacts ───────────────────────────────────────────────────────────
|
// ── Contacts ───────────────────────────────────────────────────────────
|
||||||
function showAddContact() {
|
function showAddContact() {
|
||||||
const modal = document.getElementById('meshcoreAddContactModal');
|
_openModal(document.getElementById('meshcoreAddContactModal'));
|
||||||
if (modal) modal.style.display = 'flex';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeAddContact() {
|
function closeAddContact() {
|
||||||
const modal = document.getElementById('meshcoreAddContactModal');
|
_closeModal(document.getElementById('meshcoreAddContactModal'));
|
||||||
if (modal) modal.style.display = 'none';
|
}
|
||||||
|
|
||||||
|
function _openModal(modal) {
|
||||||
|
if (!modal) return;
|
||||||
|
modal.style.display = '';
|
||||||
|
requestAnimationFrame(() => modal.classList.add('show'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function _closeModal(modal) {
|
||||||
|
if (!modal) return;
|
||||||
|
modal.classList.remove('show');
|
||||||
|
setTimeout(() => { modal.style.display = 'none'; }, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveContact() {
|
async function saveContact() {
|
||||||
|
|||||||
Reference in New Issue
Block a user