mirror of
https://github.com/discourse/discourse.git
synced 2025-02-08 20:34:52 +00:00
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) {
|
if (attrs.summarizable) {
|
||||||
const expandTitle = I18n.t("summary.strategy.button_title");
|
const expandTitle = I18n.t("summary.strategy.button_title");
|
||||||
const collapseTitle = I18n.t("summary.strategy.hide_button_title");
|
const collapseTitle = I18n.t("summary.strategy.hide_button_title");
|
||||||
|
const canCollapse = !this.loadingSummary() && this.summaryBoxVisble();
|
||||||
|
|
||||||
summarizationButtons.push(
|
summarizationButtons.push(
|
||||||
this.attach("button", {
|
this.attach("button", {
|
||||||
className: "btn btn-primary topic-strategy-summarization",
|
className: "btn btn-primary topic-strategy-summarization",
|
||||||
icon: this.summaryBoxVisble() ? "chevron-up" : "magic",
|
icon: canCollapse ? "chevron-up" : "magic",
|
||||||
translatedTitle: this.summaryBoxVisble()
|
translatedTitle: canCollapse ? collapseTitle : expandTitle,
|
||||||
? collapseTitle
|
translatedLabel: canCollapse ? collapseTitle : expandTitle,
|
||||||
: expandTitle,
|
|
||||||
translatedLabel: this.summaryBoxVisble()
|
|
||||||
? collapseTitle
|
|
||||||
: expandTitle,
|
|
||||||
action: state.expandSummaryBox
|
action: state.expandSummaryBox
|
||||||
? "toggleSummaryBox"
|
? "toggleSummaryBox"
|
||||||
: "expandSummaryBox",
|
: "expandSummaryBox",
|
||||||
|
disabled: this.loadingSummary(),
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -98,6 +96,10 @@ export default createWidget("toggle-topic-summary", {
|
|||||||
return html;
|
return html;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
loadingSummary() {
|
||||||
|
return this.summaryBoxVisble() && !this.state.summary;
|
||||||
|
},
|
||||||
|
|
||||||
summaryUpdatedEvent(update) {
|
summaryUpdatedEvent(update) {
|
||||||
this.state.summary = update.summary;
|
this.state.summary = update.summary;
|
||||||
this.state.summarizedOn = update.summarizedOn;
|
this.state.summarizedOn = update.summarizedOn;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user