DEV: Add appEvents trigger when Ai search results toggled (#1052)
This PR adds appEvents triggers when Ai search results are toggled.
This commit is contained in:
parent
327adbde29
commit
404092a68c
|
@ -13,6 +13,8 @@ import { i18n } from "discourse-i18n";
|
|||
import DTooltip from "float-kit/components/d-tooltip";
|
||||
import AiIndicatorWave from "./ai-indicator-wave";
|
||||
|
||||
const AI_RESULTS_TOGGLED = "full-page-search:ai-results-toggled";
|
||||
|
||||
export default class AiFullPageSearch extends Component {
|
||||
@service appEvents;
|
||||
@service router;
|
||||
|
@ -131,6 +133,9 @@ export default class AiFullPageSearch extends Component {
|
|||
|
||||
@action
|
||||
toggleAiResults() {
|
||||
this.appEvents.trigger(AI_RESULTS_TOGGLED, {
|
||||
enabled: !this.showingAiResults,
|
||||
});
|
||||
if (this.showingAiResults) {
|
||||
this.args.addSearchResults([], "topic_id");
|
||||
} else {
|
||||
|
@ -144,6 +149,9 @@ export default class AiFullPageSearch extends Component {
|
|||
this.AiResults = [];
|
||||
this.showingAiResults = false;
|
||||
this.args.addSearchResults([], "topic_id");
|
||||
this.appEvents.trigger(AI_RESULTS_TOGGLED, {
|
||||
enabled: false,
|
||||
});
|
||||
}
|
||||
|
||||
performHyDESearch() {
|
||||
|
|
Loading…
Reference in New Issue