diff --git a/apps.html b/apps.html
index a27bf640..97f867cb 100644
--- a/apps.html
+++ b/apps.html
@@ -666,7 +666,7 @@
No matches. Try another word or choose All apps.
+ No matches.
@@ -1416,6 +1416,7 @@ Chaos - Stranger Missions
const buttons = Array.from(document.querySelectorAll('.finder-filters button'));
const count = document.getElementById('finder-count');
const empty = document.getElementById('finder-empty');
+ const reset = document.getElementById('finder-reset');
const groups = {
'quick-games': ['blur','instant-judge','twotaku','nodo','brain-burst','snap-judge','daily-duel','percent-pulse','two-truths','key-clash','tier-rank-me'],
habits: ['true-me','future-me','water-reminder','gratitude-log','gratitude-challenge','mood-log','sleep-prep','eye-break','stretch-reminder','win-log'],
@@ -1455,6 +1456,15 @@ Chaos - Stranger Missions
}
if (!input.value.trim()) loggedSearch = false;
});
+ reset.addEventListener('click', () => {
+ input.value = '';
+ goal = 'all';
+ loggedSearch = false;
+ buttons.forEach(button => button.setAttribute('aria-pressed', String(button.dataset.goal === 'all')));
+ render();
+ input.focus();
+ fire('catalog_search_reset', {source: 'empty_state'});
+ });
buttons.forEach(button => button.addEventListener('click', () => {
goal = button.dataset.goal;
buttons.forEach(b => b.setAttribute('aria-pressed', String(b === button)));
diff --git a/scripts/check_growth_live.py b/scripts/check_growth_live.py
index 24822797..a8264784 100644
--- a/scripts/check_growth_live.py
+++ b/scripts/check_growth_live.py
@@ -74,6 +74,13 @@ def check(path, key, valid):
check("/apps", "no_stale_live_store_claim", "92 free apps on Google Play" not in catalog)
check("/apps", "store_click_tracking", "catalog_store_click" in catalog and "download_click" in catalog)
check("/apps", "detail_click_tracking", "catalog_app_detail_click" in catalog)
+ check("/apps", "empty_search_reset",
+ 'id="finder-reset"' in catalog and
+ "reset.addEventListener('click'" in catalog and
+ "input.value = ''" in catalog and
+ "goal = 'all'" in catalog and
+ "render();" in catalog and
+ "catalog_search_reset" in catalog)
details = re.findall(
r']*\bhref="([^"]+)"[^>]*\bdata-detail-app="([^"]+)"', catalog
)
diff --git a/scripts/test_growth_live.py b/scripts/test_growth_live.py
index 267fba43..99de2cb8 100644
--- a/scripts/test_growth_live.py
+++ b/scripts/test_growth_live.py
@@ -26,6 +26,7 @@ def valid_pages():
pages["/apps"] = (
'' +
cards + " catalog_store_click download_click catalog_app_detail_click " +
+ 'id="finder-reset" reset.addEventListener(\'click\' input.value = \'\' goal = \'all\' render(); catalog_search_reset ' +
" ".join(f'' for slug in SLUGS)
)
related = {"debate-me": ("future-me", "tappitsu-battle"),
@@ -185,6 +186,16 @@ def test_store_schema_package_mismatch_fails(self):
"id=jp.appdevelopsk.testapp1", "id=jp.appdevelopsk.unlisted", 1)
self.assertFalse(inspect(data)["passed"])
+ def test_missing_empty_search_reset_fails(self):
+ data = valid_pages()
+ data["/apps"] = data["/apps"].replace('id="finder-reset"', 'id="missing-reset"')
+ self.assertFalse(inspect(data)["passed"])
+
+ def test_broken_empty_search_reset_handler_fails(self):
+ data = valid_pages()
+ data["/apps"] = data["/apps"].replace("goal = 'all'", "goal = 'habits'")
+ self.assertFalse(inspect(data)["passed"])
+
def test_stale_catalog_claim_fails(self):
data = valid_pages()
data["/apps"] += "92 free apps on Google Play"