|
1809 | 1809 | background: var(--bg3); |
1810 | 1810 | border-color: var(--border2); |
1811 | 1811 | } |
1812 | | - |
| 1812 | + |
| 1813 | +/* Delete button */ |
| 1814 | + .delete-btn { |
| 1815 | + border: none; |
| 1816 | + outline: none; |
| 1817 | + box-shadow: none; |
| 1818 | + background: transparent; |
| 1819 | + color: var(--text-3); |
| 1820 | + cursor: pointer; |
| 1821 | + padding: 4px; |
| 1822 | + margin-left: 8px; |
| 1823 | + border-radius: 6px; |
| 1824 | + display: flex; |
| 1825 | + align-items: center; |
| 1826 | + justify-content: center; |
| 1827 | + transition: all var(--transition); |
| 1828 | + } |
| 1829 | + .delete-btn:focus, |
| 1830 | + .delete-btn:focus-visible { |
| 1831 | + outline: none; |
| 1832 | + box-shadow: none; |
| 1833 | + } |
| 1834 | + .delete-btn:hover { color: #ef4444; background: rgba(239, 68, 68, 0.12); |
| 1835 | + } |
| 1836 | + .delete-btn svg { width: 16px; height: 16px; |
| 1837 | + } |
1813 | 1838 | .history-thumb { |
1814 | 1839 | font-family: var(--font-mono); |
1815 | 1840 | font-size: 0.72rem; |
@@ -3422,6 +3447,7 @@ <h1 data-i18n="hero_title">Debug. Understand.<br><em>Ship faster.</em></h1> |
3422 | 3447 | return { response, baseUsed: normalizedBase, fallbackUsed: false }; |
3423 | 3448 | } catch (err) { |
3424 | 3449 | const fallbackBase = getApiFallbackBase(normalizedBase); |
| 3450 | + |
3425 | 3451 | if (!fallbackBase) throw err; |
3426 | 3452 | const response = await fetch(`${fallbackBase}${path}`, options); |
3427 | 3453 | return { response, baseUsed: fallbackBase, fallbackUsed: true }; |
@@ -3816,7 +3842,6 @@ <h1 data-i18n="hero_title">Debug. Understand.<br><em>Ship faster.</em></h1> |
3816 | 3842 | const err = await res.json().catch(() => ({})); |
3817 | 3843 | throw new Error(err.detail || `HTTP ${res.status}`); |
3818 | 3844 | } |
3819 | | - |
3820 | 3845 | const data = await res.json(); |
3821 | 3846 | currentResult = data; |
3822 | 3847 | renderZipResults(data); |
@@ -3871,6 +3896,7 @@ <h1 data-i18n="hero_title">Debug. Understand.<br><em>Ship faster.</em></h1> |
3871 | 3896 |
|
3872 | 3897 | } catch (err) { |
3873 | 3898 | toast(getTranslation('toast_analysis_failed').replace('{message}', err.message), 'error'); |
| 3899 | + |
3874 | 3900 | resetResults(); |
3875 | 3901 | } finally { |
3876 | 3902 | analyzeBtn.classList.remove('loading'); |
@@ -4498,6 +4524,22 @@ <h3>Project Health Score</h3> |
4498 | 4524 | loadLocalHistory(); |
4499 | 4525 | } |
4500 | 4526 |
|
| 4527 | + async function confirmDeleteHistory(id) { |
| 4528 | + |
| 4529 | + if(!confirm("Delete this history entry?")) return; |
| 4530 | + const apiBase = getApiBase(); |
| 4531 | + |
| 4532 | + const res = await fetch(`${apiBase}/history/${id}`,{ |
| 4533 | + method: "DELETE" |
| 4534 | + }); |
| 4535 | + |
| 4536 | + if(res.ok) { |
| 4537 | + fetchHistory(); |
| 4538 | + } else { |
| 4539 | + toast("Failed to delete entry","error"); |
| 4540 | + } |
| 4541 | + } |
| 4542 | + |
4501 | 4543 | function loadLocalHistory() { |
4502 | 4544 | let localHistory = JSON.parse(localStorage.getItem('qyx_history') || '[]'); |
4503 | 4545 |
|
@@ -4605,6 +4647,28 @@ <h3>Project Health Score</h3> |
4605 | 4647 | ${issuesHtml} |
4606 | 4648 | </div> |
4607 | 4649 | <span class="history-meta">${displayTime}</span> |
| 4650 | + <button |
| 4651 | + class="delete-btn" |
| 4652 | + onclick="event.stopPropagation(); confirmDeleteHistory('${h.id}')" |
| 4653 | + title="Delete entry" |
| 4654 | + aria-label="Delete entry"> |
| 4655 | + <svg |
| 4656 | + xmlns="http://www.w3.org/2000/svg" |
| 4657 | + width="16" |
| 4658 | + height="16" |
| 4659 | + viewBox=" 0 0 24 24" |
| 4660 | + fill="none" |
| 4661 | + stroke="currentColor" |
| 4662 | + stroke-width="2" |
| 4663 | + stroke-linecap="round" |
| 4664 | + stroke-linejoin="round"> |
| 4665 | + <polyline points="3 6 5 6 21 6"></polyline> |
| 4666 | + <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"></path> |
| 4667 | + <path d="M10 11v6"></path> |
| 4668 | + <path d="M14 11v6"></path> |
| 4669 | + <path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"></path> |
| 4670 | + </svg> |
| 4671 | + </button> |
4608 | 4672 | </div>`; |
4609 | 4673 | }).join(''); |
4610 | 4674 | } |
@@ -4840,10 +4904,42 @@ <h3>Project Health Score</h3> |
4840 | 4904 | ${issuesHtml} |
4841 | 4905 | </div> |
4842 | 4906 | <span class="history-meta" style="opacity:0.5"><svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true"><path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/></svg></span> |
| 4907 | + <button class="delete-btn" onclick="event.stopPropagation(); confirmDeleteFavorite('${f.id}')" |
| 4908 | + title="Delete favorite" aria-label="Delete favorite"> |
| 4909 | + <svg |
| 4910 | + xmlns="http://www.w3.org/2000/svg" |
| 4911 | + width="16" |
| 4912 | + height="16" |
| 4913 | + viewBox=" 0 0 24 24" |
| 4914 | + fill="none" |
| 4915 | + stroke="currentColor" |
| 4916 | + stroke-width="2" |
| 4917 | + stroke-linecap="round" |
| 4918 | + stroke-linejoin="round"> |
| 4919 | + <polyline points="3 6 5 6 21 6"></polyline> |
| 4920 | + <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"></path> |
| 4921 | + <path d="M10 11v6"></path> |
| 4922 | + <path d="M14 11v6"></path> |
| 4923 | + <path d="M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"></path> |
| 4924 | + </svg> |
| 4925 | + </button> |
4843 | 4926 | </div>`; |
4844 | 4927 | }).join(''); |
4845 | 4928 | } |
4846 | 4929 |
|
| 4930 | + async function confirmDeleteFavorite(id) { |
| 4931 | + if(!confirm("Delete this favorite?")) return; |
| 4932 | + |
| 4933 | + const normalizedId = Number(id); |
| 4934 | + |
| 4935 | + favorites = favorites.filter(f => f.id !== normalizedId); |
| 4936 | + localStorage.setItem("qyx_favorites", |
| 4937 | + JSON.stringify(favorites)); |
| 4938 | + |
| 4939 | + renderFavorites(); |
| 4940 | + |
| 4941 | + } |
| 4942 | + |
4847 | 4943 | document.getElementById('clearFavsBtn').addEventListener('click', () => { |
4848 | 4944 | if (!confirm(getTranslation('confirm_clear_favs'))) return; |
4849 | 4945 |
|
|
0 commit comments