Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 72111a1

Browse files
authored
UX: add disclosure for topic list gists (#861)
1 parent 96f5f8c commit 72111a1

File tree

5 files changed

+71
-0
lines changed

5 files changed

+71
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Component from "@glimmer/component";
2+
import { service } from "@ember/service";
3+
import icon from "discourse-common/helpers/d-icon";
4+
import i18n from "discourse-common/helpers/i18n";
5+
6+
export default class AiGistDisclosure extends Component {
7+
@service router;
8+
9+
get shouldShow() {
10+
return this.router.currentRoute.attributes.list?.topics?.some(
11+
(topic) => topic.ai_topic_gist
12+
);
13+
}
14+
15+
<template>
16+
{{#if this.shouldShow}}
17+
<span class="ai-topic-gist__disclosure">
18+
{{icon "discourse-sparkles"}}
19+
{{i18n "discourse_ai.summarization.disclosure"}}
20+
</span>
21+
{{/if}}
22+
</template>
23+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import Component from "@glimmer/component";
2+
import AiGistDisclosure from "../../components/ai-gist-disclosure";
3+
4+
export default class AiTopicGistDisclosure extends Component {
5+
static shouldRender(outletArgs, helper) {
6+
const isMobileView = helper.site.mobileView;
7+
return isMobileView;
8+
}
9+
10+
<template>
11+
<AiGistDisclosure />
12+
</template>
13+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Component from "@glimmer/component";
2+
import AiGistDisclosure from "../../components/ai-gist-disclosure";
3+
4+
export default class AiTopicGist extends Component {
5+
static shouldRender(outletArgs) {
6+
return (
7+
// "default" can be removed after the glimmer topic list is rolled out
8+
(outletArgs?.name === "default" || outletArgs?.name === "topic.title") &&
9+
!outletArgs.bulkSelectEnabled
10+
);
11+
}
12+
13+
<template>
14+
<AiGistDisclosure />
15+
</template>
16+
}

assets/stylesheets/modules/summarization/common/ai-summary.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,22 @@
235235
color: var(--primary-medium);
236236
}
237237
}
238+
239+
&__disclosure {
240+
font-size: var(--font-down-1);
241+
color: var(--primary-600);
242+
.desktop-view & {
243+
margin-left: 0.5em;
244+
}
245+
.mobile-view & {
246+
display: block;
247+
margin-top: -0.5em;
248+
margin-bottom: 0.5em;
249+
}
250+
.d-icon {
251+
font-size: var(--font-down-1);
252+
position: relative;
253+
top: -0.05em; // improve vertical alignment
254+
}
255+
}
238256
}

config/locales/client.en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ en:
464464
topic:
465465
title: "Topic summary"
466466
close: "Close summary panel"
467+
disclosure: "Summaries generated by AI"
467468
review:
468469
types:
469470
reviewable_ai_post:

0 commit comments

Comments
 (0)