Properly handle viewMoreUrl for Spotlight sections

This commit is contained in:
HighImKevin
2025-12-05 19:07:40 -05:00
parent 3734398c28
commit e8db352803
2 changed files with 45 additions and 4 deletions
+40 -3
View File
@@ -659,9 +659,46 @@
// Add section title in top left corner (absolute positioning, aligned with controls)
if (title) {
const sectionTitleEl = document.createElement('div');
sectionTitleEl.className = 'spotlight-section-title';
sectionTitleEl.textContent = title;
let sectionTitleEl;
if (viewMoreUrl) {
// Create clickable title
const titleLink = document.createElement('a');
titleLink.className = 'spotlight-section-title spotlight-title-link';
titleLink.textContent = title;
titleLink.title = 'See All';
titleLink.style.textDecoration = 'none';
const cssStyle = document.createElement('style');
cssStyle.textContent = `
.spotlight-title-link:hover {
text-decoration: underline !important;
}
`;
titleLink.appendChild(cssStyle);
// Handle both URL and function
if (typeof viewMoreUrl === 'function') {
titleLink.addEventListener('click', (e) => {
e.preventDefault();
e.stopPropagation();
viewMoreUrl();
});
} else {
titleLink.href = viewMoreUrl;
titleLink.addEventListener('click', (e) => {
e.stopPropagation();
});
}
sectionTitleEl = titleLink;
} else {
// Regular non-clickable title
sectionTitleEl = document.createElement('div');
sectionTitleEl.className = 'spotlight-section-title';
sectionTitleEl.textContent = title;
}
bannerContainer.appendChild(sectionTitleEl);
}
+5 -1
View File
@@ -5649,6 +5649,9 @@
case 'Parent':
viewMoreUrl = `#/list.html?parentId=${source}&serverId=${ApiClient.serverId()}`;
break;
case 'Tag':
viewMoreUrl = `#/list.html?type=tag&tag=${source}&serverId=${ApiClient.serverId()}`;
break;
default:
viewMoreUrl = null;
break;
@@ -5671,7 +5674,8 @@
interval: 5000,
showDots: true,
showNavButtons: true,
showClearArt: true
showClearArt: true,
viewMoreUrl: viewMoreUrl
}
);
} else {