diff --git a/public/index.html b/public/index.html index 50dc335..7a7af90 100644 --- a/public/index.html +++ b/public/index.html @@ -1074,19 +1074,19 @@ function setupEditable(elId, section) { } // ── Tags ── -const TAG_TYPES = ['ambiance', 'epoque', 'rythme', 'genre', 'theme']; - function renderTags() { const container = document.getElementById('v-tags'); const row = visionData['tags']; let tags = []; try { tags = JSON.parse(row?.Contenu || '[]'); } catch { tags = []; } + // Normalize: old format {label, type} → just strings + tags = tags.map(t => typeof t === 'string' ? t : t.label || ''); container.innerHTML = ''; - tags.forEach((t, i) => { + tags.forEach((label, i) => { const span = document.createElement('span'); - span.className = `tag ${t.type || 'ambiance'}`; - span.innerHTML = `${esc(t.label)}×`; + span.className = 'tag ambiance'; + span.innerHTML = `${esc(label)}×`; container.appendChild(span); }); @@ -1096,8 +1096,7 @@ function renderTags() { addBtn.onclick = () => { const label = prompt('Nouveau tag :'); if (!label) return; - const type = prompt('Type (ambiance, epoque, rythme, genre, theme) :', 'genre') || 'genre'; - tags.push({ label, type }); + tags.push(label); saveVisionSection('tags', JSON.stringify(tags)); renderTags(); }; @@ -1108,6 +1107,7 @@ function removeTag(index) { const row = visionData['tags']; let tags = []; try { tags = JSON.parse(row?.Contenu || '[]'); } catch { return; } + tags = tags.map(t => typeof t === 'string' ? t : t.label || ''); tags.splice(index, 1); saveVisionSection('tags', JSON.stringify(tags)); renderTags();