diff --git a/src/api/dashboard/static/js/ui/indicators-panel-new.js b/src/api/dashboard/static/js/ui/indicators-panel-new.js index 8e78cb5..85f560a 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -148,10 +148,10 @@ export function renderIndicatorPanel() { - ${favoriteIds.size > 0 ? ` + ${[...favoriteIds].length > 0 ? `
★ Favorites
- ${favoriteIds.map(id => { + ${[...favoriteIds].map(id => { const ind = available.find(a => { // Find matching indicator by type return a.type === id || (activeIndicators.find(ai => ai.id === id)?.type === ''); @@ -200,11 +200,9 @@ function renderIndicatorItem(indicator, isFavorite) { ${indicator.description || ''}
- + ${isFavorite ? '' : ` - `} @@ -362,6 +360,43 @@ function renderIndicatorPresets(indicator, meta) { // Event listeners function setupEventListeners() { + // Event delegation for dynamically created elements + const container = document.getElementById('indicatorPanel'); + if (container) { + // Add button + container.addEventListener('click', (e) => { + const addBtn = e.target.closest('.indicator-btn.add'); + if (addBtn) { + const type = addBtn.dataset.type; + if (type && window.addIndicator) { + window.addIndicator(type); + } + } + }); + + // Config / expand button + container.addEventListener('click', (e) => { + const expandBtn = e.target.closest('.indicator-btn.expand'); + if (expandBtn) { + const id = expandBtn.dataset.id; + if (id && window.toggleIndicatorExpand) { + window.toggleIndicatorExpand(id); + } + } + }); + + // Remove button + container.addEventListener('click', (e) => { + const removeBtn = e.target.closest('.indicator-btn.remove'); + if (removeBtn) { + const id = removeBtn.dataset.id; + if (id && window.removeIndicatorById) { + window.removeIndicatorById(id); + } + } + }); + } + // Search const searchInput = document.getElementById('indicatorSearch'); if (searchInput) {