UX: Hide AI summary box if no summary or summarize button

This commit is contained in:
carson chang 2024-07-22 15:13:03 -07:00 committed by GitHub
parent 6fb91b85ba
commit 0859989249
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 18 deletions

View File

@ -4,6 +4,7 @@ import { hash } from "@ember/helper";
import { action } from "@ember/object"; import { action } from "@ember/object";
import { service } from "@ember/service"; import { service } from "@ember/service";
import { htmlSafe } from "@ember/template"; import { htmlSafe } from "@ember/template";
import { or } from "truth-helpers";
import DButton from "discourse/components/d-button"; import DButton from "discourse/components/d-button";
import PluginOutlet from "discourse/components/plugin-outlet"; import PluginOutlet from "discourse/components/plugin-outlet";
import PrivateMessageMap from "discourse/components/topic-map/private-message-map"; import PrivateMessageMap from "discourse/components/topic-map/private-message-map";
@ -96,26 +97,28 @@ export default class TopicMap extends Component {
</section> </section>
{{/unless}} {{/unless}}
<section class="information toggle-summary"> {{#if (or @model.summarizable @model.has_summary)}}
{{#if @model.has_summary}} <section class="information toggle-summary">
<p>{{htmlSafe this.topRepliesSummaryInfo}}</p>
{{/if}}
<PluginOutlet
@name="topic-map-expanded-after"
@defaultGlimmer={{true}}
@outletArgs={{hash topic=@model postStream=@postStream}}
>
{{#if @model.has_summary}} {{#if @model.has_summary}}
<DButton <p>{{htmlSafe this.topRepliesSummaryInfo}}</p>
@action={{if @postStream.summary @cancelFilter @showTopReplies}}
@translatedTitle={{this.topRepliesTitle}}
@translatedLabel={{this.topRepliesLabel}}
@icon={{this.topRepliesIcon}}
class="top-replies"
/>
{{/if}} {{/if}}
</PluginOutlet> <PluginOutlet
</section> @name="topic-map-expanded-after"
@defaultGlimmer={{true}}
@outletArgs={{hash topic=@model postStream=@postStream}}
>
{{#if @model.has_summary}}
<DButton
@action={{if @postStream.summary @cancelFilter @showTopReplies}}
@translatedTitle={{this.topRepliesTitle}}
@translatedLabel={{this.topRepliesLabel}}
@icon={{this.topRepliesIcon}}
class="top-replies"
/>
{{/if}}
</PluginOutlet>
</section>
{{/if}}
{{#if @showPMMap}} {{#if @showPMMap}}
<section class="information private-message-map"> <section class="information private-message-map">