2024-10-28 14:15:53 -04:00
|
|
|
import Component from "@glimmer/component";
|
|
|
|
import { service } from "@ember/service";
|
2024-11-19 15:33:34 -05:00
|
|
|
import { htmlSafe } from "@ember/template";
|
2024-10-28 14:15:53 -04:00
|
|
|
|
|
|
|
export default class AiTopicGist extends Component {
|
2024-11-19 15:33:34 -05:00
|
|
|
@service gists;
|
2024-10-29 11:59:41 -04:00
|
|
|
|
2024-11-19 15:33:34 -05:00
|
|
|
get shouldShow() {
|
|
|
|
return this.gists.preference === "table-ai" && this.gists.shouldShow;
|
2024-10-29 11:59:41 -04:00
|
|
|
}
|
2024-10-28 14:15:53 -04:00
|
|
|
|
2024-11-19 18:54:49 -05:00
|
|
|
get hasGist() {
|
|
|
|
return !!this.gist;
|
|
|
|
}
|
|
|
|
|
|
|
|
get gist() {
|
|
|
|
return this.args.topic.get("ai_topic_gist");
|
|
|
|
}
|
2024-11-19 15:33:34 -05:00
|
|
|
|
2024-12-05 08:03:08 -05:00
|
|
|
get escapedExcerpt() {
|
2024-11-19 18:54:49 -05:00
|
|
|
return this.args.topic.get("escapedExcerpt");
|
2024-10-28 14:15:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
<template>
|
2024-11-19 15:33:34 -05:00
|
|
|
{{#if this.shouldShow}}
|
2024-11-19 18:54:49 -05:00
|
|
|
{{#if this.hasGist}}
|
2024-11-19 15:33:34 -05:00
|
|
|
<div class="excerpt">
|
2024-11-20 09:33:49 -05:00
|
|
|
<div class="excerpt__contents">{{this.gist}}</div>
|
2024-10-28 14:15:53 -04:00
|
|
|
</div>
|
2024-11-19 18:54:49 -05:00
|
|
|
{{else}}
|
2024-12-05 08:03:08 -05:00
|
|
|
{{#if this.escapedExcerpt}}
|
2024-11-19 18:54:49 -05:00
|
|
|
<div class="excerpt">
|
2024-11-20 09:33:49 -05:00
|
|
|
<div class="excerpt__contents">
|
2024-12-05 08:03:08 -05:00
|
|
|
{{htmlSafe this.escapedExcerpt}}
|
2024-11-20 09:33:49 -05:00
|
|
|
</div>
|
2024-11-19 18:54:49 -05:00
|
|
|
</div>
|
|
|
|
{{/if}}
|
2024-11-19 15:33:34 -05:00
|
|
|
{{/if}}
|
2024-10-28 14:15:53 -04:00
|
|
|
{{/if}}
|
|
|
|
</template>
|
|
|
|
}
|