From d17bbc2dc442fc3b3ca0c98402087f053daf92f7 Mon Sep 17 00:00:00 2001 From: chapoi <101828855+chapoi@users.noreply.github.com> Date: Mon, 5 Aug 2024 17:39:08 +0200 Subject: [PATCH] UX: summary fixed positioning (#740) Co-authored-by: Rafael Silva --- .../ai-summary-box.gjs | 30 ++++++++++++- .../summarization/desktop/ai-summary.scss | 45 +++++++++++++++++++ config/locales/client.en.yml | 3 ++ plugin.rb | 1 + 4 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 assets/stylesheets/modules/summarization/desktop/ai-summary.scss diff --git a/assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-box.gjs b/assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-box.gjs index 69b2ac3e..878f27cd 100644 --- a/assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-box.gjs +++ b/assets/javascripts/discourse/connectors/topic-map-expanded-after/ai-summary-box.gjs @@ -21,6 +21,7 @@ export default class AiSummaryBox extends Component { @service siteSettings; @service messageBus; @service currentUser; + @service site; @tracked text = ""; @tracked summarizedOn = null; @@ -123,7 +124,9 @@ export default class AiSummaryBox extends Component { }) .then(() => { if (update.done) { - this.summarizedOn = shortDateNoYear(topicSummary.updated_at); + this.summarizedOn = shortDateNoYear( + moment(topicSummary.updated_at, "YYYY-MM-DD HH:mm:ss Z") + ); this.summarizedBy = topicSummary.algorithm; this.newPostsSinceSummary = topicSummary.new_posts_since_summary; this.outdated = topicSummary.outdated; @@ -134,6 +137,17 @@ export default class AiSummaryBox extends Component { }); } + @action + onRegisterApi(api) { + this.dMenu = api; + } + + @action + async onClose() { + await this.dMenu.close(); + this.unsubscribe(); + } +