Skip to content

Commit 3f7c2b6

Browse files
committed
Force tab-gallery section active display and add image load warning logs
1 parent 7e8cc24 commit 3f7c2b6

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

web_studio/static/app.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,9 +1091,9 @@ function initStudioApp() {
10911091
grid.innerHTML = data.images.map(img => {
10921092
const timeStr = img.mtime_str ? (img.mtime_str.split(' ')[1] || img.mtime_str) : '';
10931093
return `
1094-
<div class="gallery-card" style="background: rgba(30,30,40,0.7); border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; width: 100%; transition: transform 0.2s, border-color 0.2s;">
1094+
<div class="gallery-card" style="background: rgba(30,30,40,0.8); border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; width: 100%; transition: transform 0.2s, border-color 0.2s;">
10951095
<div style="width: 100%; height: 260px; overflow: hidden; background: #111; cursor: pointer; position: relative;" class="gallery-img-container" data-url="${img.url}" data-filename="${img.filename}" data-subfolder="${img.subfolder}">
1096-
<img src="${img.url}" alt="${img.filename}" loading="lazy" style="width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease;" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
1096+
<img src="${img.url}" alt="${img.filename}" loading="lazy" style="width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease;" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'" onerror="console.warn('[Studio UI] Image failed to load:', '${img.url}')">
10971097
</div>
10981098
<div style="padding: 10px 12px; font-size: 11px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(255,255,255,0.05);">
10991099
<div style="font-weight: 600; color: #e2e8f0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" title="${img.filename}">
@@ -1111,6 +1111,20 @@ function initStudioApp() {
11111111
</div>
11121112
`;
11131113
}).join('');
1114+
1115+
console.log(`[Studio UI] Rendered ${data.images.length} cards into #gallery-grid (innerHTML length: ${grid.innerHTML.length})`);
1116+
1117+
// Force parent tab section display if inactive
1118+
const gallerySec = document.getElementById('tab-gallery');
1119+
if (gallerySec && !gallerySec.classList.contains('active')) {
1120+
const navButtons = document.querySelectorAll('.nav-btn');
1121+
const tabContents = document.querySelectorAll('.tab-content');
1122+
navButtons.forEach(b => b.classList.remove('active'));
1123+
tabContents.forEach(t => t.classList.remove('active'));
1124+
const btn = document.querySelector('.nav-btn[data-tab="tab-gallery"]');
1125+
if (btn) btn.classList.add('active');
1126+
gallerySec.classList.add('active');
1127+
}
11141128
}
11151129
} catch (e) {
11161130
console.error("Gallery fetch error:", e);

0 commit comments

Comments
 (0)