mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-11 11:12:55 +02:00
fix(ui): fix leading pipe separator when SNR is missing from message
Use array-based metaParts.join(' | ') instead of string concatenation
to avoid ugly leading "| Hops: 0" when meshcore lib doesn't provide SNR.
Also revert temporary INFO-level debug logging back to DEBUG.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -774,12 +774,12 @@ function createMessageElement(msg) {
|
||||
}));
|
||||
}
|
||||
|
||||
let metaInfo = '';
|
||||
let metaParts = [];
|
||||
if (msg.snr !== undefined && msg.snr !== null) {
|
||||
metaInfo += `SNR: ${msg.snr.toFixed(1)} dB`;
|
||||
metaParts.push(`SNR: ${msg.snr.toFixed(1)} dB`);
|
||||
}
|
||||
if (msg.path_len !== undefined && msg.path_len !== null) {
|
||||
metaInfo += ` | Hops: ${msg.path_len}`;
|
||||
metaParts.push(`Hops: ${msg.path_len}`);
|
||||
}
|
||||
if (msg.paths && msg.paths.length > 0) {
|
||||
// Show first path inline (shortest/first arrival)
|
||||
@@ -790,8 +790,9 @@ function createMessageElement(msg) {
|
||||
: segments.join('\u2192');
|
||||
const pathsData = encodeURIComponent(JSON.stringify(msg.paths));
|
||||
const routeLabel = msg.paths.length > 1 ? `Route (${msg.paths.length})` : 'Route';
|
||||
metaInfo += ` | <span class="path-info" onclick="showPathsPopup(this, '${pathsData}')">${routeLabel}: ${shortPath}</span>`;
|
||||
metaParts.push(`<span class="path-info" onclick="showPathsPopup(this, '${pathsData}')">${routeLabel}: ${shortPath}</span>`);
|
||||
}
|
||||
const metaInfo = metaParts.join(' | ');
|
||||
|
||||
if (msg.is_own) {
|
||||
// Own messages: right-aligned, no avatar
|
||||
|
||||
Reference in New Issue
Block a user