Skip to content

Commit 1295442

Browse files
hhkaosclaude
andcommitted
Fix duplicate empty-results message, add removable filter chips
The widget's own empty-message and the app's message box were both rendering the same "No hay eventos con esos filtros" text. Now a single message shows the active filters as removable chips plus a bulk clear shortcut, release 0.6.0. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent e760ffc commit 1295442

3 files changed

Lines changed: 104 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# OTE Reader changelog
22

3+
## 0.6.0 - 2026-08-13
4+
5+
### Changed
6+
7+
- Fixed the empty-results message showing twice (once from the events
8+
widget, once above it) when filters matched no events. It's replaced
9+
with a single message that lists the active filters as removable
10+
chips, plus a "Limpiar filtros" shortcut when more than one is
11+
applied, so you can fix the filters without opening the filters panel.
12+
313
## 0.5.0 - 2026-08-13
414

515
### Added

app.js

Lines changed: 93 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function () {
22
'use strict';
33

4-
var APP_VERSION = '0.5.0';
4+
var APP_VERSION = '0.6.0';
55
var DEMO_MODE = new URLSearchParams(location.search).get('demo') === '1' || location.pathname.replace(/\/+$/, '').endsWith('/demo');
66
var STORAGE = DEMO_MODE ? 'ote-reader-demo-state-v1' : 'ote-reader-state-v1';
77
var INSTALL_DISMISSED = 'ote-reader-install-dismissed-v1';
@@ -1158,12 +1158,13 @@
11581158
$('result-count').textContent = sourceLabel() + ' · ' + events.length + (events.length === 1 ? ' evento' : ' eventos');
11591159
if (!events.length) {
11601160
widget.events = [];
1161-
widget.setAttribute('empty-message', 'No hay eventos con esos filtros.');
1161+
widget.style.display = 'none';
11621162
if (previewMode) showMessage('Este feed no tiene eventos.', 'warn', true);
11631163
else if (!state.feeds.length) showEmptyState();
1164-
else showMessage('No hay eventos con esos filtros.', 'warn', true);
1164+
else showFilteredEmptyState();
11651165
return;
11661166
}
1167+
widget.style.display = '';
11671168
clearMessages();
11681169
if (!embedReady) {
11691170
showMessage('El visor de eventos se está cargando...', 'warn', true);
@@ -1180,7 +1181,6 @@
11801181
widget.setAttribute('show-past', 'true');
11811182
widget.setAttribute('sort', 'none');
11821183
widget.setAttribute('event-actions', 'none');
1183-
widget.setAttribute('empty-message', 'No hay eventos con esos filtros.');
11841184
widget.events = events;
11851185
widget.eventActions = function (context) {
11861186
var event = context.originalEvent;
@@ -1460,6 +1460,95 @@
14601460
box.appendChild(empty);
14611461
}
14621462

1463+
function showFilteredEmptyState() {
1464+
var box = $('messages');
1465+
box.replaceChildren();
1466+
var empty = document.createElement('section');
1467+
empty.className = 'empty-state';
1468+
var active = activeFilterChips();
1469+
1470+
var title = document.createElement('h3');
1471+
title.textContent = active.length ? 'No hay eventos con esos filtros' : 'No hay eventos en este apartado';
1472+
empty.appendChild(title);
1473+
1474+
if (active.length) {
1475+
var copy = document.createElement('p');
1476+
copy.textContent = 'Quita alguno para ver resultados:';
1477+
empty.appendChild(copy);
1478+
var chips = document.createElement('div');
1479+
chips.className = 'chips';
1480+
chips.style.maxHeight = 'none';
1481+
active.forEach(function (item) {
1482+
var chip = document.createElement('button');
1483+
chip.type = 'button';
1484+
chip.className = 'chip is-active';
1485+
chip.textContent = item.label + ' ×';
1486+
chip.setAttribute('aria-label', 'Quitar filtro: ' + item.label);
1487+
chip.addEventListener('click', function () {
1488+
item.clear();
1489+
persist();
1490+
render();
1491+
});
1492+
chips.appendChild(chip);
1493+
});
1494+
empty.appendChild(chips);
1495+
1496+
if (active.length > 1) {
1497+
var actions = document.createElement('div');
1498+
actions.className = 'empty-actions';
1499+
var clearAll = document.createElement('button');
1500+
clearAll.type = 'button';
1501+
clearAll.className = 'ghost';
1502+
clearAll.textContent = 'Limpiar filtros';
1503+
clearAll.addEventListener('click', function () {
1504+
resetFilters();
1505+
persist();
1506+
render();
1507+
});
1508+
actions.appendChild(clearAll);
1509+
empty.appendChild(actions);
1510+
}
1511+
}
1512+
1513+
box.appendChild(empty);
1514+
}
1515+
1516+
function activeFilterChips() {
1517+
var list = [];
1518+
queryTerms(state.filters.q).forEach(function (term) {
1519+
list.push({ label: '#' + term, clear: function () { toggleQueryTerm(term); } });
1520+
});
1521+
var modeLabels = { online: 'Online', 'in-person': 'Presencial', hybrid: 'Híbrido' };
1522+
if (state.filters.mode) {
1523+
list.push({
1524+
label: 'Formato: ' + (modeLabels[state.filters.mode] || state.filters.mode),
1525+
clear: function () { state.filters.mode = ''; }
1526+
});
1527+
}
1528+
if (state.filters.language) {
1529+
list.push({ label: 'Idioma: ' + state.filters.language, clear: function () { state.filters.language = ''; } });
1530+
}
1531+
if (state.filters.country) {
1532+
list.push({ label: 'País: ' + state.filters.country, clear: function () { state.filters.country = ''; } });
1533+
}
1534+
if (state.filters.cfp) {
1535+
list.push({ label: 'CFP abierto', clear: function () { state.filters.cfp = false; } });
1536+
}
1537+
if (state.filters.future) {
1538+
list.push({ label: 'Solo futuros', clear: function () { state.filters.future = false; } });
1539+
}
1540+
return list;
1541+
}
1542+
1543+
function resetFilters() {
1544+
state.filters.q = '';
1545+
state.filters.mode = '';
1546+
state.filters.language = '';
1547+
state.filters.country = '';
1548+
state.filters.cfp = false;
1549+
state.filters.future = false;
1550+
}
1551+
14631552
function subscribe(rawUrl, categoryId) {
14641553
var url;
14651554
try { url = normaliseUrl(rawUrl); } catch (e) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ote-reader",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"private": true,
55
"type": "module",
66
"description": "Attendee-facing PWA for subscribing to OpenTechEvents feeds.",

0 commit comments

Comments
 (0)