fix(repeater): keep the header path and location inside narrow screens

A multi-hop path is joined with '->' arrows and no spaces, which offers the
browser no break opportunity, so on a phone it ran off the right edge instead
of wrapping. Insert a zero-width space after each arrow so it wraps per hop,
with overflow-wrap as a fallback for a single unbreakable token.

The pin icon and the coordinates were separated by an ordinary space, so a
narrow line could break between them. Keep them together as one inline-block.

Verified at 320 and 360 px: the long-path card overflowed its box by 71 px and
31 px before, 0 after; the pin no longer parts from its coordinates.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
MarekWoandClaude Opus 5 committed 2026-08-08 15:40:32 +02:00
1 parent c96f1fd1d0
commit 31729fd3f3
2 files changed
+18 -2

No files matched your search

+5 -1
View File
@@ -157,7 +157,11 @@ function renderHeader() {
const r = _repeater;
document.getElementById('rptName').textContent = r.name || r.public_key.substring(0, 12);
document.getElementById('rptPubkey').textContent = `<${shortPubkey(r.public_key)}>`;
document.getElementById('rptPath').textContent = r.path_or_mode || '—';
// '→' offers no line-break opportunity, so a multi-hop path would run off
// a narrow screen; a zero-width space after each arrow lets it wrap by hop.
const path = r.path_or_mode || '—';
const ZWSP = String.fromCharCode(0x200B);
document.getElementById('rptPath').textContent = path.replace(/→/g, '→' + ZWSP);
const loc = (r.adv_lat != null && r.adv_lon != null && (r.adv_lat !== 0 || r.adv_lon !== 0))
? `${r.adv_lat.toFixed(4)}, ${r.adv_lon.toFixed(4)}`
+13 -1
View File
@@ -97,6 +97,18 @@
color: var(--text-secondary, #6c757d);
}
/* Long paths must wrap inside the card instead of overflowing the
screen; breaks are offered after each hop arrow (see renderHeader). */
#rptPath {
overflow-wrap: anywhere;
}
/* Pin icon + coordinates move to the next line as one unit. */
.rpt-header-loc {
display: inline-block;
white-space: nowrap;
}
.rpt-pubkey {
font-family: var(--bs-font-monospace, monospace);
font-size: 0.8rem;
@@ -322,7 +334,7 @@
</div>
<div class="rpt-header-meta mt-1">
<i class="bi bi-signpost-split"></i> <span class="font-monospace" id="rptPath">—</span>
<span class="ms-2"><i class="bi bi-geo-alt"></i> <span id="rptLocation">—</span></span>
<span class="rpt-header-loc ms-2"><i class="bi bi-geo-alt"></i> <span id="rptLocation">—</span></span>
</div>
</div>
</div>