2024-10-28 14:15:53 -04:00
|
|
|
import Component from "@glimmer/component";
|
|
|
|
import { service } from "@ember/service";
|
2024-11-07 08:35:05 -05:00
|
|
|
import bodyClass from "discourse/helpers/body-class";
|
2024-10-28 14:15:53 -04:00
|
|
|
|
|
|
|
export default class AiTopicGist extends Component {
|
|
|
|
@service router;
|
2024-10-29 11:59:41 -04:00
|
|
|
@service gistPreference;
|
|
|
|
|
|
|
|
get prefersGist() {
|
|
|
|
return this.gistPreference.preference === "gists_enabled";
|
|
|
|
}
|
2024-10-28 14:15:53 -04:00
|
|
|
|
|
|
|
get showGist() {
|
|
|
|
return (
|
|
|
|
this.args.topic?.ai_topic_gist &&
|
2024-10-29 11:59:41 -04:00
|
|
|
this.prefersGist &&
|
2024-10-28 14:15:53 -04:00
|
|
|
!this.args.topic?.excerpt
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
<template>
|
|
|
|
{{#if this.showGist}}
|
2024-11-07 08:35:05 -05:00
|
|
|
{{bodyClass "--topic-list-with-gist"}}
|
2024-10-28 14:15:53 -04:00
|
|
|
<div class="ai-topic-gist">
|
|
|
|
<div class="ai-topic-gist__text">
|
|
|
|
{{@topic.ai_topic_gist}}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</template>
|
|
|
|
}
|