From 5701a7d60ad0e6b91aac8db7646c5033d504b15f Mon Sep 17 00:00:00 2001 From: dev Date: Fri, 15 May 2026 17:06:16 +0200 Subject: [PATCH] feat: allow re-downloading already-downloaded concerts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace disabled "Déjà téléchargé" with active "Re-télécharger" button (ghost style to distinguish from first download). Co-Authored-By: Claude Sonnet 4.6 --- static/app.js | 26 +++++++++++++------------- static/style.css | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/static/app.js b/static/app.js index d9c2934..8c50363 100644 --- a/static/app.js +++ b/static/app.js @@ -250,18 +250,15 @@ function openModal(concert) { const btnDl = $('btn-download'); const alreadyDone = state.downloadedUrls.has(concert.url); - btnDl.textContent = alreadyDone ? '✓ Déjà téléchargé' : 'Télécharger'; - btnDl.prepend((() => { - const s = document.createElementNS('http://www.w3.org/2000/svg','svg'); - s.setAttribute('viewBox','0 0 20 20'); s.setAttribute('fill','none'); - s.setAttribute('width','16'); s.setAttribute('height','16'); - if (!alreadyDone) { - s.innerHTML = ` - `; - } - return s; - })()); - btnDl.disabled = alreadyDone; + btnDl.textContent = alreadyDone ? 'Re-télécharger' : 'Télécharger'; + btnDl.classList.toggle('btn-redownload', alreadyDone); + const dlIcon = document.createElementNS('http://www.w3.org/2000/svg','svg'); + dlIcon.setAttribute('viewBox','0 0 20 20'); dlIcon.setAttribute('fill','none'); + dlIcon.setAttribute('width','16'); dlIcon.setAttribute('height','16'); + dlIcon.innerHTML = ` + `; + btnDl.prepend(dlIcon); + btnDl.disabled = false; $('dl-progress-wrap').hidden = true; $('dl-progress-fill').style.width = '0%'; @@ -342,7 +339,10 @@ function trackDownload(id, title, url) { $('dl-progress-label').textContent = `${Math.round(pct)}%`; if (s.state === 'done') { $('dl-progress-label').textContent = '✓ Terminé'; - $('btn-download').textContent = '✓ Téléchargé'; + const b = $('btn-download'); + b.textContent = 'Re-télécharger'; + b.classList.add('btn-redownload'); + b.disabled = false; } } diff --git a/static/style.css b/static/style.css index 770860d..fd409f4 100644 --- a/static/style.css +++ b/static/style.css @@ -629,6 +629,8 @@ body { .btn-download:hover { opacity: 0.88; transform: translateY(-1px); } .btn-download:active { transform: none; } .btn-download:disabled { opacity: 0.5; cursor: default; transform: none; } +.btn-download.btn-redownload { background: transparent; color: var(--text-muted); border: 1px solid var(--border); } +.btn-download.btn-redownload:hover { color: var(--text); border-color: var(--text-muted); opacity: 1; } .btn-watch { color: var(--text-dim);