Files
meshcore-bot/modules/web_viewer/static/css/dashboard.css
T
agessaman f68da5287c fix(web-viewer): derive neighbours and hop distance from path evidence
307 direct neighbours was not plausible, and it was not real.

complete_contact_tracking.hop_count claims 800 zero-hop contacts. Only
68 of them have any one-hop path in observed_paths to corroborate that.
Their stored SNR piles up in a 1.5 dB band — 655 of 800 between 11.25
and 12.75 dB — and their RSSI clusters at -39..-48 dBm. Hundreds of
radios at different distances and terrain cannot land in a 10 dB window.
That is the signature of one strong local link being recorded against
every node whose traffic happened to arrive through it. Their return
paths agree: these "direct" contacts have out_path_len of 3 to 11.

The writer's intent is sound — repeater_manager only stores RSSI/SNR
when signal_info reports hops == 0 — so the field being fed to it does
not mean what the surrounding code assumes. Left as is; this change
stops the dashboard depending on it.

Neighbour membership now comes from path evidence: an advert whose
path_length equals its bytes_per_hop travelled exactly one hop. That
yields 38 nodes in 24h and 124 in 7d, with a plausible spread. Signal is
shown only where the path evidence and the stored hop count agree, which
is 5 and 12 nodes respectively; the rest read "no signal reading" rather
than borrowing a measurement taken on somebody else's link. A 24h/7d
selector bounds the window, capped well under observed_paths' 90-day
retention because a month-old link says nothing about today.

Separately, this fixes a bug I introduced. path_length is a BYTE count,
and with 2- or 3-byte hop encoding a 3-hop path is 6 or 9 bytes long. The
path-length histogram plotted that raw value on an axis readers would
take as hops, overstating distance two- to threefold on a mesh that is
~95% multibyte. It is replaced by a single hops-away chart computed as
path_length / bytes_per_hop, which also retires the histogram built on
the untrustworthy stored hop count. The result is unimodal, peaking at 3
hops and decaying — the shape a mesh should have, and not the bimodal
one the old chart drew.
2026-07-29 22:23:43 -07:00

414 lines
9.4 KiB
CSS

/* Dashboard (landing page) styles.
*
* Only the theme tokens declared in base.html are used (--bg-*, --text-*,
* --border-color, --card-*, --shadow-color), and every rule that hard-codes a
* colour has a matching [data-theme="dark"] override — Bootstrap 5.1.3 has no
* native dark theme here, so nothing inherits one for free.
*/
/* ── Health strip ──────────────────────────────────────────────────────── */
.health-strip {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.25rem 1.5rem;
min-height: 56px;
padding: 0.5rem 1rem;
margin-bottom: 1.25rem;
background-color: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 10px;
box-shadow: 0 1px 3px var(--shadow-color);
}
.health-strip__item {
display: flex;
align-items: center;
gap: 0.45rem;
font-size: 0.875rem;
color: var(--text-color);
white-space: nowrap;
}
.health-strip__label {
color: var(--text-muted);
text-transform: uppercase;
font-size: 0.7rem;
letter-spacing: 0.04em;
}
.health-strip__spacer {
flex: 1 1 auto;
}
.health-strip .btn-refresh {
padding: 0.1rem 0.4rem;
line-height: 1;
border: none;
background: transparent;
color: var(--text-muted);
cursor: pointer;
}
.health-strip .btn-refresh:hover,
.health-strip .btn-refresh:focus {
color: #0d6efd;
}
.health-strip .btn-refresh[disabled] {
opacity: 0.5;
cursor: progress;
}
/* ── Section headings ──────────────────────────────────────────────────── */
.dashboard-section-title {
display: flex;
align-items: baseline;
gap: 0.6rem;
margin: 1.75rem 0 0.75rem;
font-size: 0.8rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-muted);
}
.dashboard-section-title::after {
content: "";
flex: 1 1 auto;
height: 1px;
background-color: var(--border-color);
}
/* ── Stat tiles ────────────────────────────────────────────────────────── */
.stat-tile {
display: flex;
flex-direction: column;
height: 100%;
padding: 0.75rem 0.9rem 0.5rem;
background-color: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 10px;
box-shadow: 0 1px 3px var(--shadow-color);
}
.stat-tile__label {
font-size: 0.7rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
color: var(--text-muted);
margin-bottom: 0.2rem;
}
.stat-tile__row {
display: flex;
align-items: baseline;
gap: 0.5rem;
flex-wrap: wrap;
}
.stat-tile__value {
font-size: 1.6rem;
font-weight: 700;
line-height: 1.1;
color: var(--text-color);
font-variant-numeric: tabular-nums;
}
.stat-tile__value--muted {
color: var(--text-muted);
}
.stat-tile__sub {
font-size: 0.75rem;
color: var(--text-muted);
}
.stat-tile__spark {
position: relative;
height: 48px;
margin-top: auto;
}
/* Sparkline canvases are sized by their container, not by their attributes. */
.stat-tile__spark canvas {
width: 100% !important;
height: 48px !important;
}
/* ── Delta chips ───────────────────────────────────────────────────────── */
.delta-chip {
display: inline-flex;
align-items: center;
gap: 0.15rem;
padding: 0.05rem 0.35rem;
border-radius: 999px;
font-size: 0.72rem;
font-weight: 600;
font-variant-numeric: tabular-nums;
background-color: var(--bg-tertiary);
color: var(--text-muted);
}
.delta-chip--up {
background-color: rgba(25, 135, 84, 0.12);
color: #146c43;
}
.delta-chip--down {
background-color: rgba(220, 53, 69, 0.12);
color: #b02a37;
}
[data-theme="dark"] .delta-chip--up {
background-color: rgba(25, 135, 84, 0.22);
color: #75b798;
}
[data-theme="dark"] .delta-chip--down {
background-color: rgba(220, 53, 69, 0.22);
color: #ea868f;
}
/* ── Stacked route-mix bar ─────────────────────────────────────────────── */
.stacked-bar {
display: flex;
height: 26px;
width: 100%;
border-radius: 6px;
overflow: hidden;
background-color: var(--bg-tertiary);
}
.stacked-bar__segment {
display: flex;
align-items: center;
justify-content: center;
font-size: 0.72rem;
font-weight: 600;
color: #fff;
white-space: nowrap;
overflow: hidden;
min-width: 0;
}
.stacked-bar__legend {
display: flex;
flex-wrap: wrap;
gap: 0.25rem 1rem;
margin-top: 0.5rem;
font-size: 0.78rem;
color: var(--text-muted);
}
.stacked-bar__swatch {
display: inline-block;
width: 10px;
height: 10px;
border-radius: 2px;
margin-right: 0.35rem;
vertical-align: baseline;
}
/* ── Horizontal mix rows (role / device) ───────────────────────────────── */
.mix-row {
display: grid;
grid-template-columns: minmax(5.5rem, 8rem) 1fr auto;
align-items: center;
gap: 0.6rem;
margin-bottom: 0.35rem;
font-size: 0.82rem;
}
.mix-row__name {
color: var(--text-color);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.mix-row__track {
height: 10px;
border-radius: 5px;
background-color: var(--bg-tertiary);
overflow: hidden;
}
.mix-row__fill {
height: 100%;
border-radius: 5px;
}
.mix-row__count {
color: var(--text-muted);
font-variant-numeric: tabular-nums;
}
/* ── Direct-neighbour signal rows ──────────────────────────────────────── */
.neighbor-row {
display: grid;
grid-template-columns: minmax(6rem, 11rem) 1fr auto;
align-items: center;
gap: 0.6rem;
padding: 0.2rem 0;
font-size: 0.82rem;
}
.neighbor-row + .neighbor-row {
border-top: 1px solid var(--border-color);
}
.neighbor-row__name {
color: var(--text-color);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Fixed -12..+14 dB scale, so a bar means the same thing on every refresh. */
.neighbor-row__track {
height: 10px;
min-width: 3rem;
border-radius: 5px;
background-color: var(--bg-tertiary);
overflow: hidden;
}
.neighbor-row__fill {
height: 100%;
border-radius: 5px;
}
/* Hatched, not empty: "we have no reading" reads differently from "zero". */
.neighbor-row__track--unknown {
background-image: repeating-linear-gradient(
45deg,
var(--bg-tertiary),
var(--bg-tertiary) 3px,
transparent 3px,
transparent 6px
);
opacity: 0.6;
}
.neighbor-row__values {
color: var(--text-muted);
font-variant-numeric: tabular-nums;
white-space: nowrap;
}
.neighbor-row__snr {
color: var(--text-color);
font-weight: 600;
}
/* ── Leaderboard rows ──────────────────────────────────────────────────── */
.top-list-row {
display: flex;
justify-content: space-between;
align-items: center;
gap: 0.5rem;
padding: 0.25rem 0;
}
.top-list-row + .top-list-row {
border-top: 1px solid var(--border-color);
}
.top-list-row__name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* ── Chart wrappers ────────────────────────────────────────────────────── */
.chart-box {
position: relative;
width: 100%;
height: 200px;
}
.chart-box--tall {
height: 240px;
}
.doughnut-box {
position: relative;
max-width: 190px;
width: 100%;
margin: 0 auto;
}
.dashboard-note {
font-size: 0.75rem;
color: var(--text-muted);
}
.dashboard-empty {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
min-height: 100px;
color: var(--text-muted);
font-size: 0.85rem;
font-style: italic;
}
/* Info affordance shared by tooltip triggers in card headers. */
.dashboard-info-btn {
padding: 0;
border: 0;
background: none;
color: var(--text-muted);
line-height: 1;
}
.dashboard-info-btn:hover,
.dashboard-info-btn:focus {
color: #0dcaf0;
text-decoration: none;
}
.tooltip.dashboard-hint .tooltip-inner {
max-width: min(22rem, 92vw);
text-align: left;
}
/* ── Live activity feed ────────────────────────────────────────────────── */
.live-feed {
height: 260px;
overflow-y: auto;
background-color: var(--bg-secondary);
padding: 0.5rem;
}
.live-feed__entry {
padding: 3px 8px;
margin-bottom: 3px;
font-size: 0.82rem;
border-radius: 2px;
border-left: 3px solid var(--border-color);
}
@media (max-width: 575.98px) {
.stat-tile__value {
font-size: 1.35rem;
}
.health-strip {
gap: 0.25rem 1rem;
}
}