mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-25 00:52:14 +00:00
FIX: always render "today" on top of conversation sidebar (#1400)
This commit is contained in:
parent
59f4b66ede
commit
4f980d5514
@ -216,6 +216,13 @@ export default class AiConversationsSidebarManager extends Service {
|
||||
const now = Date.now();
|
||||
const fresh = [];
|
||||
|
||||
const todaySection = {
|
||||
name: "today",
|
||||
title: i18n("discourse_ai.ai_bot.conversations.today"),
|
||||
links: new TrackedArray(),
|
||||
};
|
||||
fresh.push(todaySection);
|
||||
|
||||
this.topics.forEach((t) => {
|
||||
const postedAtMs = new Date(t.last_posted_at || now).valueOf();
|
||||
const diffDays = Math.floor((now - postedAtMs) / 86400000);
|
||||
@ -233,13 +240,16 @@ export default class AiConversationsSidebarManager extends Service {
|
||||
dateGroup = key;
|
||||
}
|
||||
|
||||
let sec = fresh.find((s) => s.name === dateGroup);
|
||||
let sec;
|
||||
if (dateGroup === "today") {
|
||||
sec = todaySection;
|
||||
} else {
|
||||
sec = fresh.find((s) => s.name === dateGroup);
|
||||
}
|
||||
|
||||
if (!sec) {
|
||||
let title;
|
||||
switch (dateGroup) {
|
||||
case "today":
|
||||
title = i18n("discourse_ai.ai_bot.conversations.today");
|
||||
break;
|
||||
case "last-7-days":
|
||||
title = i18n("discourse_ai.ai_bot.conversations.last_7_days");
|
||||
break;
|
||||
|
@ -23,6 +23,11 @@ body.has-ai-conversations-sidebar {
|
||||
}
|
||||
}
|
||||
|
||||
// we always have the "today" section rendered at the top of the sidebar but hide it when empty
|
||||
.sidebar-section[data-section-name="today"]:has(.ai-bot-sidebar-empty-state) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidebar-toggle-all-sections {
|
||||
display: none;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user