import filter work and cleanup

This commit is contained in:
Bryan Van Deusen
2026-01-18 21:57:08 -05:00
parent b3331bad76
commit 482c5a8ead
6 changed files with 725 additions and 146 deletions
+6 -2
View File
@@ -159,8 +159,8 @@ document.addEventListener('DOMContentLoaded', () => {
async function fetchAutocomplete(query) {
try {
const url = query
? `/api/tags/search?q=${encodeURIComponent(query)}&limit=8`
: `/api/tags/search?limit=8`;
? `/api/tags/search?q=${encodeURIComponent(query)}&limit=8&exclude_kind=archive`
: `/api/tags/search?limit=8&exclude_kind=archive`;
const r = await fetch(url);
const j = await r.json();
renderAutocomplete(j.tags || []);
@@ -296,6 +296,10 @@ document.addEventListener('DOMContentLoaded', () => {
modal.classList.add('active');
updateImage(index);
history.replaceState({ modalIndex: index }, '', window.location.href);
// Focus the tag input after modal opens
if (tagInput) {
setTimeout(() => tagInput.focus(), 100);
}
}
function closeModal() {
+4 -2
View File
@@ -133,10 +133,12 @@
}
item.appendChild(imgEl);
if (img.tags && img.tags.length > 0) {
// Filter out archive tags from display (they're still visible in modal)
const visibleTags = (img.tags || []).filter(t => t.kind !== 'archive');
if (visibleTags.length > 0) {
const overlay = document.createElement('div');
overlay.className = 'tag-overlay';
img.tags.forEach(t => {
visibleTags.forEach(t => {
const chip = document.createElement('a');
chip.className = 'tag-chip';
chip.href = `/gallery?tag=${encodeURIComponent(t.name)}`;