Revert "feat(model-picker): add remove-from-recent button to Recent section rows (#2894)" (#3437)

This reverts commit 2a422c00ec.

Co-authored-by: pewdiepie-archdaemon <pewdiepie-archdaemon@users.noreply.github.com>
This commit is contained in:
PewDiePie
2026-06-08 21:41:25 +09:00
committed by GitHub
parent d6882a895e
commit 09565acc1e
2 changed files with 4 additions and 56 deletions
+4 -28
View File
@@ -35,11 +35,6 @@ function _pushRecent(mid) {
next.unshift(mid);
_saveList(RECENT_KEY, next.slice(0, RECENT_MAX));
}
function _removeRecent(mid) {
if (!mid) return;
const next = _loadRecent().filter(x => x !== mid);
_saveList(RECENT_KEY, next);
}
function _loadFavorites() { return _loadList(FAVORITES_KEY); }
function _toggleFavorite(mid) {
const favs = _loadFavorites();
@@ -309,7 +304,7 @@ function _initModelPickerDropdown() {
empty.textContent = text;
listEl.appendChild(empty);
}
function _addRow(m, onRemove) {
function _addRow(m) {
const row = document.createElement('div');
row.className = 'model-switch-item';
if (m.stale) {
@@ -381,20 +376,6 @@ function _initModelPickerDropdown() {
});
row.appendChild(favDot);
// Remove-from-recent button (shown only for Recent section items).
if (onRemove) {
const rmBtn = document.createElement('button');
rmBtn.type = 'button';
rmBtn.className = 'mp-remove-dot';
rmBtn.textContent = '×';
rmBtn.title = 'Remove from recent';
rmBtn.addEventListener('click', (e) => {
e.stopPropagation();
onRemove();
});
row.appendChild(rmBtn);
}
row.addEventListener('click', () => _pick(m));
listEl.appendChild(row);
}
@@ -411,7 +392,8 @@ function _initModelPickerDropdown() {
return;
}
// ── Browse mode: sections in order: Favorites → Recent (big catalogs only) → All / Providers ──
// ── Browse mode: Favorites (manual) + Recent (auto), with dedupe. ──
// Rules:
// 1. Never list the same model twice in the dropdown. Favorites
// win over Recent (if you favorited it, that's where it
// belongs — Recent shouldn't show it again as duplicate).
@@ -436,13 +418,7 @@ function _initModelPickerDropdown() {
.slice(0, RECENT_MAX);
if (recentModels.length) {
_addSection('Recent');
recentModels.forEach(m => {
shown.add(m.mid);
_addRow(m, () => {
_removeRecent(m.mid);
_populate('');
});
});
recentModels.forEach(m => { shown.add(m.mid); _addRow(m); });
}
}