Skip to content

Commit aeede78

Browse files
committed
fix breadcrumbs not rendering
1 parent 0ac0c8f commit aeede78

3 files changed

Lines changed: 41 additions & 15 deletions

File tree

dataBrowser/dataBrowser.css

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,41 @@ grid-template-rows: repeat(4, 1fr);
153153
background: rgba(255, 255, 255, 0.35);
154154
}
155155

156-
/* Breadcrumb link: take remaining space and truncate instead of overflowing */
157-
.panel-controls > a {
156+
/* Breadcrumb: take the remaining space in the controls bar, single line, centered */
157+
.panel-controls .breadcrumb {
158158
flex: 1 1 auto;
159159
min-width: 0;
160+
display: flex;
161+
align-items: center;
162+
justify-content: center;
163+
gap: 4px;
160164
overflow: hidden;
161-
text-overflow: ellipsis;
162165
white-space: nowrap;
163-
text-align: center;
164166
}
165167

166-
.panel-controls a {
168+
/* Individual crumb: subtle pill, truncates if the id is long, underlines on hover */
169+
.panel-controls .crumb {
167170
color: #ffffff;
168171
font-size: 0.8rem;
172+
text-decoration: none;
173+
padding: 2px 8px;
174+
border-radius: 10px;
175+
background: rgba(255, 255, 255, 0.18);
176+
overflow: hidden;
177+
text-overflow: ellipsis;
178+
max-width: 14ch;
179+
transition: background 0.15s ease;
180+
}
181+
182+
.panel-controls .crumb:hover {
183+
background: rgba(255, 255, 255, 0.35);
184+
text-decoration: underline;
185+
}
186+
187+
.panel-controls .crumb-sep {
188+
flex: 0 0 auto;
189+
color: rgba(255, 255, 255, 0.7);
190+
font-size: 0.85rem;
169191
}
170192

171193
.date-controls {

dataBrowser/dataBrowser.js.temp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,16 @@ async function populateTile(plotId, panel, changeUrlParams=true){
328328
window.history.pushState({}, '', newUrl);
329329
}
330330
const header = document.getElementById(`header${parseInt(panel[1])}`);
331-
header.innerHTML = openPlots[parseInt(panel[1]) -1].map((item, i) => {
332-
if (i<=1) {
333-
const url = 'https://browser.herz-campaigns.de/?ms=' + openPlots[parseInt(panel[1]) -1].slice(0, i + 1).join('%2C');
334-
return `<a href="${url}">${item}</a>`;
335-
}
336-
}).join('\t');
331+
const tree = openPlots[parseInt(panel[1]) -1];
332+
header.innerHTML = tree
333+
.slice(0, 2) // site + instrument levels
334+
.map((item, i) => {
335+
if (!item) return ''; // skip empty levels (e.g. search-opened plots)
336+
const url = 'https://browser.herz-campaigns.de/?ms=' + tree.slice(0, i + 1).join('%2C');
337+
return `<a class="crumb" href="${url}" title="${item}">${item}</a>`;
338+
})
339+
.filter(Boolean)
340+
.join('<span class="crumb-sep">›</span>');
337341
// console.log('$APIURL/instruments/'+openPlots[parseInt(panel[1]) -1][1]);
338342
// const response = await fetch('$APIURL/instruments/'+openPlots[parseInt(panel[1]) -1][1]);
339343
// const data = await response.json();

dataBrowser/index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<div class="panel" id="p1">
3333
<div class="panel-controls">
3434
<button type="button" class="changeButton" id="select1" onclick="changePlot('p1')">Change Plot</button>
35-
<a id="header1"></a>
35+
<div id="header1" class="breadcrumb"></div>
3636
<button type="button" id="b1" onclick="closePanel('b1')">X</button>
3737

3838
</div>
@@ -41,23 +41,23 @@
4141
<div class="panel" id="p2">
4242
<div class="panel-controls">
4343
<button type="button" class="changeButton" id="select2" onclick="changePlot('p2')">Change Plot</button>
44-
<a id="header2"></a>
44+
<div id="header2" class="breadcrumb"></div>
4545
<button type="button" id="b2" onclick="closePanel('b2')">X</button>
4646
</div>
4747
<img src="./img/placeholder.svg">
4848
</div>
4949
<div class="panel" id="p3">
5050
<div class="panel-controls">
5151
<button type="button" class="changeButton" id="select3" onclick="changePlot('p3')">Change Plot</button>
52-
<a id="header3"></a>
52+
<div id="header3" class="breadcrumb"></div>
5353
<button type="button" id="b3" onclick="closePanel('b3')">X</button>
5454
</div>
5555
<img src="./img/placeholder.svg">
5656
</div>
5757
<div class="panel" id="p4">
5858
<div class="panel-controls">
5959
<button type="button" class="changeButton" id="select4" onclick="changePlot('p4')">Change Plot</button>
60-
<a id="header4"></a>
60+
<div id="header4" class="breadcrumb"></div>
6161
<button type="button" id="b4" onclick="closePanel('b4')">X</button>
6262
</div>
6363
<img src="./img/placeholder.svg">

0 commit comments

Comments
 (0)