Skip to content

Commit 5495a8d

Browse files
committed
webui: add Yesterday chat group
1 parent e539f3e commit 5495a8d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tools/server/webui/src/components/Sidebar.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default function Sidebar() {
110110
{group.title ? (
111111
// we use btn class here to make sure that the padding/margin are aligned with the other items
112112
<b
113-
className="btn btn-ghost btn-xs bg-none btn-disabled block text-xs text-base-content text-start px-2 mb-0 mt-6 font-bold"
113+
className="btn btn-ghost btn-xs bg-none btn-disabled block text-xs text-base-content text-start px-2 mb-0 mt-6 font-bold opacity-50"
114114
role="note"
115115
aria-description={group.title}
116116
tabIndex={0}
@@ -287,6 +287,9 @@ export function groupConversationsByDate(
287287
const now = new Date();
288288
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()); // Start of today
289289

290+
const yesterday = new Date(today);
291+
yesterday.setDate(today.getDate() - 1);
292+
290293
const sevenDaysAgo = new Date(today);
291294
sevenDaysAgo.setDate(today.getDate() - 7);
292295

@@ -295,6 +298,7 @@ export function groupConversationsByDate(
295298

296299
const groups: { [key: string]: Conversation[] } = {
297300
Today: [],
301+
Yesterday: [],
298302
'Previous 7 Days': [],
299303
'Previous 30 Days': [],
300304
};
@@ -311,6 +315,8 @@ export function groupConversationsByDate(
311315

312316
if (convDate >= today) {
313317
groups['Today'].push(conv);
318+
} else if (convDate >= yesterday) {
319+
groups['Yesterday'].push(conv);
314320
} else if (convDate >= sevenDaysAgo) {
315321
groups['Previous 7 Days'].push(conv);
316322
} else if (convDate >= thirtyDaysAgo) {
@@ -335,6 +341,13 @@ export function groupConversationsByDate(
335341
});
336342
}
337343

344+
if (groups['Yesterday'].length > 0) {
345+
result.push({
346+
title: 'Yesterday',
347+
conversations: groups['Yesterday'],
348+
});
349+
}
350+
338351
if (groups['Previous 7 Days'].length > 0) {
339352
result.push({
340353
title: 'Previous 7 Days',

0 commit comments

Comments
 (0)