Skip to content

Commit

Permalink
DEV: Add no-results className to full page search toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
markvanlan committed Jan 10, 2025
1 parent b24669c commit fdd09e1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions assets/javascripts/discourse/components/ai-full-page-search.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,18 @@ export default class AiFullPageSearch extends Component {
}
}

get settled() {
return (
this.validSearchOrder &&
!this.searching &&
this.searchTerm === this.initialSearchTerm
);
}

get noResults() {
return this.settled && this.AiResults.length === 0;
}

get searchTerm() {
if (this.initialSearchTerm !== this.args.searchTerm) {
this.initialSearchTerm = undefined;
Expand Down Expand Up @@ -199,6 +211,7 @@ export default class AiFullPageSearch extends Component {
<div
class="semantic-search__searching
{{if this.searching 'in-progress'}}
{{if this.noResults 'no-results'}}
{{unless this.validSearchOrder 'unavailable'}}"
>
<DToggleSwitch
Expand Down

0 comments on commit fdd09e1

Please sign in to comment.