This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +56
-57
lines changed
assets/javascripts/discourse/connectors/topic-more-content Expand file tree Collapse file tree 3 files changed +56
-57
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ <div
2+ id =" related-topics"
3+ class =" more-topics__list {{ if this.hidden ' hidden' }} "
4+ role =" complementary"
5+ aria-labelledby =" related-topics-title"
6+ {{ did-insert this.registerList }}
7+ {{ will-destroy this.removeList }}
8+ >
9+ <h3 id =" related-topics-title" class =" more-topics__list-title" >
10+ {{ i18n " discourse_ai.related_topics.title" }}
11+ </h3 >
12+ <div class =" topics" >
13+ <BasicTopicList @topics ={{ this.relatedTopics }} />
14+ </div >
15+ </div >
Original file line number Diff line number Diff line change 1+ import Component from "@glimmer/component" ;
2+ import { action , computed } from "@ember/object" ;
3+ import { inject as service } from "@ember/service" ;
4+ import I18n from "I18n" ;
5+
6+ export default class extends Component {
7+ static shouldRender ( args ) {
8+ return ( args . model . related_topics ?. length || 0 ) > 0 ;
9+ }
10+
11+ @service store ;
12+ @service site ;
13+ @service moreTopicsPreferenceTracking ;
14+
15+ listId = "related-topics" ;
16+
17+ @computed ( "moreTopicsPreferenceTracking.selectedTab" )
18+ get hidden ( ) {
19+ return this . moreTopicsPreferenceTracking . selectedTab !== this . listId ;
20+ }
21+
22+ get relatedTopics ( ) {
23+ return this . args . outletArgs . model . related_topics . map ( ( topic ) =>
24+ this . store . createRecord ( "topic" , topic )
25+ ) ;
26+ }
27+
28+ @action
29+ registerList ( ) {
30+ this . moreTopicsPreferenceTracking . registerTopicList ( {
31+ name : I18n . t ( "discourse_ai.related_topics.pill" ) ,
32+ id : this . listId ,
33+ icon : "discourse-sparkles" ,
34+ } ) ;
35+ }
36+
37+ @action
38+ removeList ( ) {
39+ this . moreTopicsPreferenceTracking . removeTopicList ( this . listId ) ;
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments