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

Commit 9b1015b

Browse files
committed
FIX: Bring back empty state message when appropriate
1 parent cea8fd4 commit 9b1015b

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

assets/javascripts/discourse/services/ai-conversations-sidebar-manager.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,13 @@ export default class AiConversationsSidebarManager extends Service {
8484
);
8585
}
8686

87+
addEmptyStateClass() {
88+
document.body.classList.toggle(
89+
"has-empty-ai-conversations-sidebar",
90+
!this.topics.length
91+
);
92+
}
93+
8794
forceCustomSidebar() {
8895
document.body.classList.add("has-ai-conversations-sidebar");
8996
if (!this.sidebarState.isForcingSidebar) {
@@ -100,13 +107,15 @@ export default class AiConversationsSidebarManager extends Service {
100107

101108
// don't render sidebar multiple times
102109
if (this._didInit) {
110+
this.addEmptyStateClass();
103111
return true;
104112
}
105113

106114
this._didInit = true;
107115

108116
this.fetchMessages().then(() => {
109117
this.sidebarState.setPanel(AI_CONVERSATIONS_PANEL);
118+
this.addEmptyStateClass();
110119
});
111120

112121
return true;
@@ -140,6 +149,7 @@ export default class AiConversationsSidebarManager extends Service {
140149

141150
stopForcingCustomSidebar() {
142151
document.body.classList.remove("has-ai-conversations-sidebar");
152+
document.body.classList.remove("has-empty-ai-conversations-sidebar");
143153

144154
const isAdmin = this.sidebarState.currentPanel?.key === ADMIN_PANEL;
145155
if (this.sidebarState.isForcingSidebar && !isAdmin) {

assets/stylesheets/modules/ai-bot-conversations/common.scss

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,18 @@ body.has-ai-conversations-sidebar {
2323
}
2424
}
2525

26-
// we always have the "today" section rendered at the top of the sidebar but hide it when empty
27-
.sidebar-section[data-section-name="today"]:has(.ai-bot-sidebar-empty-state) {
26+
// we always have the "today" section rendered at the top of the sidebar.
27+
// Hide the "today" header when the section is empty
28+
&:not(.has-empty-ai-conversations-sidebar)
29+
.sidebar-section[data-section-name="today"]:has(
30+
.ai-bot-sidebar-empty-state
31+
) {
32+
display: none;
33+
}
34+
35+
&.has-empty-ai-conversations-sidebar
36+
.sidebar-section[data-section-name="today"]
37+
.sidebar-section-header-wrapper {
2838
display: none;
2939
}
3040

0 commit comments

Comments
 (0)