Skip to content

Commit 5d74bdc

Browse files
committed
fix: position glossary icons in card corners, fix popover rendering
Move info icons from inline-after-text to absolute top-right corner of metric cards. Use position:fixed for popovers to escape overflow:hidden containers. Reset text-transform inheritance.
1 parent d8c5571 commit 5d74bdc

File tree

3 files changed

+46
-23
lines changed

3 files changed

+46
-23
lines changed

app/static/css/glossary.css

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,34 @@
44
display: inline-flex;
55
align-items: center;
66
cursor: pointer;
7-
position: relative;
87
margin-left: 4px;
98
vertical-align: middle;
109
}
1110

11+
/* Inside metric cards: position in top-right corner */
12+
.metric-card .glossary-hint {
13+
position: absolute;
14+
top: 10px;
15+
right: 10px;
16+
margin: 0;
17+
z-index: 2;
18+
}
19+
20+
/* Inside modulation KPI cards: top-right corner */
21+
.modulation-kpi-card .glossary-hint {
22+
position: absolute;
23+
top: 10px;
24+
right: 10px;
25+
margin: 0;
26+
z-index: 2;
27+
}
28+
1229
.glossary-hint > i,
1330
.glossary-hint > svg {
1431
width: 13px;
1532
height: 13px;
1633
color: var(--text-muted);
17-
opacity: 0.6;
34+
opacity: 0.45;
1835
transition: opacity 0.2s, color 0.2s;
1936
}
2037

@@ -26,10 +43,7 @@
2643

2744
.glossary-popover {
2845
display: none;
29-
position: absolute;
30-
left: 50%;
31-
top: calc(100% + 8px);
32-
transform: translateX(-50%);
46+
position: fixed;
3347
width: max-content;
3448
max-width: 320px;
3549
padding: 12px 16px;
@@ -44,12 +58,9 @@
4458
z-index: 500;
4559
pointer-events: auto;
4660
white-space: normal;
47-
}
48-
49-
/* Flip above when near bottom */
50-
.glossary-popover.above {
51-
top: auto;
52-
bottom: calc(100% + 8px);
61+
text-transform: none;
62+
letter-spacing: normal;
63+
text-align: left;
5364
}
5465

5566
/* Arrow */
@@ -80,15 +91,13 @@
8091
display: block;
8192
}
8293

83-
/* Mobile: full width */
94+
/* Mobile: full width bottom sheet */
8495
@media (max-width: 768px) {
8596
.glossary-popover {
86-
position: fixed;
87-
left: 16px;
97+
left: 16px !important;
8898
right: 16px;
89-
top: auto;
99+
top: auto !important;
90100
bottom: calc(var(--bottom-nav-h) + 16px);
91-
transform: none;
92101
width: auto;
93102
max-width: none;
94103
}

app/static/js/glossary.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@
1313
var pop = hint.querySelector('.glossary-popover');
1414
if (!pop) return;
1515
pop.classList.remove('above');
16-
var rect = pop.getBoundingClientRect();
17-
if (rect.bottom > window.innerHeight - 80) {
16+
var r = hint.getBoundingClientRect();
17+
// Position below the icon, centered
18+
var top = r.bottom + 8;
19+
var left = r.left + r.width / 2;
20+
pop.style.left = left + 'px';
21+
pop.style.top = top + 'px';
22+
pop.style.transform = 'translateX(-50%)';
23+
// Flip above if near bottom
24+
var popRect = pop.getBoundingClientRect();
25+
if (popRect.bottom > window.innerHeight - 20) {
1826
pop.classList.add('above');
27+
pop.style.top = (r.top - 8) + 'px';
28+
pop.style.transform = 'translateX(-50%) translateY(-100%)';
1929
}
2030
}
2131

app/templates/index.html

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -389,8 +389,9 @@ <h1 class="hero-title">
389389
<div class="metrics-grid">
390390
{# Card 1: DS Power #}
391391
<div class="metric-card glass">
392+
<span class="glossary-hint"><i data-lucide="info"></i><div class="glossary-popover">{{ t.glossary_power }}</div></span>
392393
<div class="metric-header">
393-
<span class="metric-label">{{ t.signal_ds_power }} <span class="glossary-hint"><i data-lucide="info"></i><div class="glossary-popover">{{ t.glossary_power }}</div></span></span>
394+
<span class="metric-label">{{ t.signal_ds_power }}</span>
394395
<div class="metric-icon purple"><i data-lucide="arrow-down"></i></div>
395396
</div>
396397
<div class="metric-value-row">
@@ -405,8 +406,9 @@ <h1 class="hero-title">
405406

406407
{# Card 2: US Power #}
407408
<div class="metric-card glass">
409+
<span class="glossary-hint"><i data-lucide="info"></i><div class="glossary-popover">{{ t.glossary_power }}</div></span>
408410
<div class="metric-header">
409-
<span class="metric-label">{{ t.signal_us_power }} <span class="glossary-hint"><i data-lucide="info"></i><div class="glossary-popover">{{ t.glossary_power }}</div></span></span>
411+
<span class="metric-label">{{ t.signal_us_power }}</span>
410412
<div class="metric-icon blue"><i data-lucide="arrow-up"></i></div>
411413
</div>
412414
<div class="metric-value-row">
@@ -421,8 +423,9 @@ <h1 class="hero-title">
421423

422424
{# Card 3: SNR #}
423425
<div class="metric-card glass">
426+
<span class="glossary-hint"><i data-lucide="info"></i><div class="glossary-popover">{{ t.glossary_snr }}</div></span>
424427
<div class="metric-header">
425-
<span class="metric-label">SNR <span class="glossary-hint"><i data-lucide="info"></i><div class="glossary-popover">{{ t.glossary_snr }}</div></span></span>
428+
<span class="metric-label">SNR</span>
426429
<div class="metric-icon green"><i data-lucide="signal"></i></div>
427430
</div>
428431
<div class="metric-value-row">
@@ -437,8 +440,9 @@ <h1 class="hero-title">
437440

438441
{# Card 4: Errors #}
439442
<div class="metric-card glass">
443+
<span class="glossary-hint"><i data-lucide="info"></i><div class="glossary-popover">{{ t.glossary_correctable }} {{ t.glossary_uncorrectable }}</div></span>
440444
<div class="metric-header">
441-
<span class="metric-label">{{ t.card_errors }} <span class="glossary-hint"><i data-lucide="info"></i><div class="glossary-popover">{{ t.glossary_correctable }} {{ t.glossary_uncorrectable }}</div></span></span>
445+
<span class="metric-label">{{ t.card_errors }}</span>
442446
<div class="metric-icon amber"><i data-lucide="alert-triangle"></i></div>
443447
</div>
444448
<div class="metric-value-row">

0 commit comments

Comments
 (0)