UX: summary fixed positioning (#740)
Co-authored-by: Rafael Silva <xfalcox@gmail.com>
This commit is contained in:
parent
5c9f610fa4
commit
d17bbc2dc4
|
@ -21,6 +21,7 @@ export default class AiSummaryBox extends Component {
|
||||||
@service siteSettings;
|
@service siteSettings;
|
||||||
@service messageBus;
|
@service messageBus;
|
||||||
@service currentUser;
|
@service currentUser;
|
||||||
|
@service site;
|
||||||
|
|
||||||
@tracked text = "";
|
@tracked text = "";
|
||||||
@tracked summarizedOn = null;
|
@tracked summarizedOn = null;
|
||||||
|
@ -123,7 +124,9 @@ export default class AiSummaryBox extends Component {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (update.done) {
|
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.summarizedBy = topicSummary.algorithm;
|
||||||
this.newPostsSinceSummary = topicSummary.new_posts_since_summary;
|
this.newPostsSinceSummary = topicSummary.new_posts_since_summary;
|
||||||
this.outdated = topicSummary.outdated;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
{{#if @outletArgs.topic.summarizable}}
|
{{#if @outletArgs.topic.summarizable}}
|
||||||
<div
|
<div
|
||||||
|
@ -145,6 +159,7 @@ export default class AiSummaryBox extends Component {
|
||||||
@onShow={{this.generateSummary}}
|
@onShow={{this.generateSummary}}
|
||||||
@arrow={{true}}
|
@arrow={{true}}
|
||||||
@identifier="topic-map__ai-summary"
|
@identifier="topic-map__ai-summary"
|
||||||
|
@onRegisterApi={{this.onRegisterApi}}
|
||||||
@interactive={{true}}
|
@interactive={{true}}
|
||||||
@triggers="click"
|
@triggers="click"
|
||||||
@placement="left"
|
@placement="left"
|
||||||
|
@ -158,7 +173,18 @@ export default class AiSummaryBox extends Component {
|
||||||
>
|
>
|
||||||
<:content>
|
<:content>
|
||||||
<div class="ai-summary-container">
|
<div class="ai-summary-container">
|
||||||
<h3>Topic Summary</h3>
|
<header class="ai-summary__header">
|
||||||
|
<h3>{{i18n "discourse_ai.summarization.topic.title"}}</h3>
|
||||||
|
{{#if this.site.desktopView}}
|
||||||
|
<DButton
|
||||||
|
@title="discourse_ai.summarization.topic.close"
|
||||||
|
@action={{this.onClose}}
|
||||||
|
@icon="times"
|
||||||
|
@class="btn-transparent ai-summary__close"
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
|
</header>
|
||||||
|
|
||||||
<article class="ai-summary-box">
|
<article class="ai-summary-box">
|
||||||
{{#if this.loading}}
|
{{#if this.loading}}
|
||||||
<AiSummarySkeleton />
|
<AiSummarySkeleton />
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
.topic-map {
|
||||||
|
.ai-summarization-button {
|
||||||
|
.fk-d-menu {
|
||||||
|
position: fixed;
|
||||||
|
top: calc(var(--header-offset) + 1rem) !important;
|
||||||
|
left: unset !important;
|
||||||
|
right: 1rem !important;
|
||||||
|
width: 470px;
|
||||||
|
max-width: 470px !important; //overruling JS
|
||||||
|
max-height: calc(100vh - var(--header-offset) - 3rem);
|
||||||
|
|
||||||
|
&__inner-content {
|
||||||
|
max-height: unset;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-summary__header,
|
||||||
|
.ai-summary-box {
|
||||||
|
padding-inline: 1.5rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ai-summary {
|
||||||
|
&__header {
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding-block: 0.5rem;
|
||||||
|
padding-right: 0.5rem;
|
||||||
|
background: var(--secondary);
|
||||||
|
border-bottom: 1px solid var(--primary-low);
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-box {
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -404,6 +404,9 @@ en:
|
||||||
since:
|
since:
|
||||||
one: "Last hour"
|
one: "Last hour"
|
||||||
other: "Last %{count} hours"
|
other: "Last %{count} hours"
|
||||||
|
topic:
|
||||||
|
title: "Topic summary"
|
||||||
|
close: "Close summary panel"
|
||||||
review:
|
review:
|
||||||
types:
|
types:
|
||||||
reviewable_ai_post:
|
reviewable_ai_post:
|
||||||
|
|
|
@ -16,6 +16,7 @@ enabled_site_setting :discourse_ai_enabled
|
||||||
register_asset "stylesheets/modules/ai-helper/common/ai-helper.scss"
|
register_asset "stylesheets/modules/ai-helper/common/ai-helper.scss"
|
||||||
|
|
||||||
register_asset "stylesheets/modules/summarization/common/ai-summary.scss"
|
register_asset "stylesheets/modules/summarization/common/ai-summary.scss"
|
||||||
|
register_asset "stylesheets/modules/summarization/desktop/ai-summary.scss", :desktop
|
||||||
|
|
||||||
register_asset "stylesheets/modules/ai-bot/common/bot-replies.scss"
|
register_asset "stylesheets/modules/ai-bot/common/bot-replies.scss"
|
||||||
register_asset "stylesheets/modules/ai-bot/common/ai-persona.scss"
|
register_asset "stylesheets/modules/ai-bot/common/ai-persona.scss"
|
||||||
|
|
Loading…
Reference in New Issue