diff --git a/utils/renderer/FileListManager.js b/utils/renderer/FileListManager.js index 38eaf82..1969e39 100644 --- a/utils/renderer/FileListManager.js +++ b/utils/renderer/FileListManager.js @@ -97,7 +97,7 @@ class FileListManager {
${fps}
🏷️ - 🎥 + 🎥 🗑️ 🎬 diff --git a/utils/renderer/UIManager.js b/utils/renderer/UIManager.js index 37105ce..d1a13ef 100644 --- a/utils/renderer/UIManager.js +++ b/utils/renderer/UIManager.js @@ -65,11 +65,13 @@ class UIManager { // Search input with debounce this.searchInput.addEventListener('input', this._debounce(() => this.searchShows(), 300)); - // Add click handler for episode number editing (ranges) + // Add click handler for episode number editing (ranges) and tags document.addEventListener('click', (e) => { + // Handle episode number editing if (e.target.classList.contains('episode-number')) { e.stopPropagation(); this.episodeManager.makeEpisodeRangeEditable(e.target); + return; } // Handle episode arrow buttons @@ -77,6 +79,20 @@ class UIManager { e.stopPropagation(); const direction = e.target.classList.contains('episode-arrow-left') ? 'left' : 'right'; this.handleEpisodeArrowClick(e.target, direction); + return; + } + + // Handle tag icon clicks + if (e.target.classList.contains('tag-icon')) { + e.stopPropagation(); + const tagIcon = e.target; + const tagType = tagIcon.classList.contains('extra-tag') ? 'extra' : + tagIcon.classList.contains('behind-the-scenes-tag') ? 'behind-the-scenes' : + tagIcon.classList.contains('delete-tag') ? 'delete' : null; + + if (tagType) { + this.handleTagClick(tagIcon, tagType); + } } }); @@ -785,6 +801,35 @@ class UIManager { this.updateEpisodeNumbers(); } + /** + * Handle tag icon clicks + * @param {HTMLElement} tagIcon - The clicked tag icon element + * @param {string} tagType - The tag type (extra, behind-the-scenes, delete) + */ + handleTagClick(tagIcon, tagType) { + console.log(`Tag click: ${tagType}`); + + // Get the file name element from the tag icon's parent + const fileItem = tagIcon.closest('.file-item'); + const fileNameEl = fileItem.querySelector('.file-name'); + + if (!fileNameEl) return; + + const filePath = fileNameEl.dataset.filePath; + console.log(`Tagging file: ${filePath} as ${tagType}`); + + // Add or remove the tag + if (fileItem.hasAttribute(`data-tagged-${tagType}`)) { + // Untag if already tagged + console.log(`Untagging file: ${filePath} from ${tagType}`); + this.untagFile(filePath, tagType); + } else { + // Tag the file + console.log(`Tagging file: ${filePath} as ${tagType}`); + this.addTagToEpisode(filePath, tagType); + } + } + /** * Function to handle tagging */