UX: Disable summarize button while generating summary (#22618)
This commit is contained in:
parent
3e6e33df35
commit
0a65b9f098
|
@ -52,20 +52,18 @@ export default createWidget("toggle-topic-summary", {
|
|||
if (attrs.summarizable) {
|
||||
const expandTitle = I18n.t("summary.strategy.button_title");
|
||||
const collapseTitle = I18n.t("summary.strategy.hide_button_title");
|
||||
const canCollapse = !this.loadingSummary() && this.summaryBoxVisble();
|
||||
|
||||
summarizationButtons.push(
|
||||
this.attach("button", {
|
||||
className: "btn btn-primary topic-strategy-summarization",
|
||||
icon: this.summaryBoxVisble() ? "chevron-up" : "magic",
|
||||
translatedTitle: this.summaryBoxVisble()
|
||||
? collapseTitle
|
||||
: expandTitle,
|
||||
translatedLabel: this.summaryBoxVisble()
|
||||
? collapseTitle
|
||||
: expandTitle,
|
||||
icon: canCollapse ? "chevron-up" : "magic",
|
||||
translatedTitle: canCollapse ? collapseTitle : expandTitle,
|
||||
translatedLabel: canCollapse ? collapseTitle : expandTitle,
|
||||
action: state.expandSummaryBox
|
||||
? "toggleSummaryBox"
|
||||
: "expandSummaryBox",
|
||||
disabled: this.loadingSummary(),
|
||||
})
|
||||
);
|
||||
}
|
||||
|
@ -98,6 +96,10 @@ export default createWidget("toggle-topic-summary", {
|
|||
return html;
|
||||
},
|
||||
|
||||
loadingSummary() {
|
||||
return this.summaryBoxVisble() && !this.state.summary;
|
||||
},
|
||||
|
||||
summaryUpdatedEvent(update) {
|
||||
this.state.summary = update.summary;
|
||||
this.state.summarizedOn = update.summarizedOn;
|
||||
|
|
Loading…
Reference in New Issue