From a4cde29a9e802f104228626c35d1de61ce2f4c62 Mon Sep 17 00:00:00 2001 From: Etienne Delvarre Date: Fri, 29 May 2026 12:56:45 +0200 Subject: [PATCH] Simplify tags: free text only, no categories Remove type system (ambiance/epoque/rythme/genre/theme). Tags are now plain strings. Old format auto-migrated. Co-Authored-By: Claude Opus 4.6 --- public/index.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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();