From b083c1d001e57d1a024723acb32189acdf318e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Fri, 20 Mar 2026 18:14:02 +0400 Subject: [PATCH] feat(search): add category search support and sync with chips --- app/components/app-header.gjs | 19 ++++--- app/components/search-box.gjs | 53 +++++++++++++++++-- release/assets/main-BOfcjRke.css | 1 - release/assets/main-C4F17h3W.js | 2 + release/assets/main-CKp1bFPU.css | 1 + release/assets/main-gEUnNw-L.js | 2 - ...2-DxsaKqmd.js => modules-4-12-BrC41u4L.js} | 2 +- release/index.html | 4 +- 8 files changed, 67 insertions(+), 17 deletions(-) delete mode 100644 release/assets/main-BOfcjRke.css create mode 100644 release/assets/main-C4F17h3W.js create mode 100644 release/assets/main-CKp1bFPU.css delete mode 100644 release/assets/main-gEUnNw-L.js rename release/assets/{modules-4-12-DxsaKqmd.js => modules-4-12-BrC41u4L.js} (98%) diff --git a/app/components/app-header.gjs b/app/components/app-header.gjs index 4cfcfb1..3748e1d 100644 --- a/app/components/app-header.gjs +++ b/app/components/app-header.gjs @@ -11,7 +11,11 @@ import CategoryChips from '#components/category-chips'; export default class AppHeaderComponent extends Component { @service storage; @tracked isUserMenuOpen = false; - @tracked hasQuery = false; + @tracked searchQuery = ''; + + get hasQuery() { + return !!this.searchQuery; + } @action toggleUserMenu() { @@ -25,22 +29,21 @@ export default class AppHeaderComponent extends Component { @action handleQueryChange(query) { - this.hasQuery = !!query; + this.searchQuery = query; } @action - handleChipSelect() { - // When a chip is selected, we might want to ensure the search box is cleared visually, - // although the route transition will happen. - // The SearchBox component manages its own state, so we rely on the route transition. - // However, if we want to clear the search box input from here, we'd need to control it. - // For now, let's just let the route change happen. + handleChipSelect(category) { + this.searchQuery = category.label; + // The existing logic in CategoryChips triggers the route transition. + // This update simply fills the search box. }