Skip to content

Commit e1e5371

Browse files
committed
style: show creation timestamps on all recent chat sidebar entries
Display timestamps on all chat entries in Today and Yesterday groups for consistent visual rhythm, not just on duplicate-label entries.
1 parent 4026be2 commit e1e5371

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

apps/desktop/src/app/shell/AppSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ export function AppSidebar({
397397
markActionSession(session.id); // backfill localStorage
398398
}
399399
const label = formatSessionLabel(session);
400-
const timestamp = duplicateLabels.has(baseLabel(label))
400+
const timestamp = (isRecent || duplicateLabels.has(baseLabel(label)))
401401
? formatShortTime(session.createdAt)
402402
: undefined;
403403
return (
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { describe, expect, it } from "vitest";
2+
import { readFileSync } from "node:fs";
3+
import { resolve } from "node:path";
4+
5+
const sidebarSrc = readFileSync(
6+
resolve(__dirname, "../../apps/desktop/src/app/shell/AppSidebar.tsx"),
7+
"utf-8",
8+
);
9+
10+
describe("Chat sidebar – uniform timestamps", () => {
11+
// AC1 & AC2: All chat entries in "Today" and "Yesterday" groups show creation timestamps
12+
it("shows timestamps for recent entries (Today/Yesterday) regardless of duplicates", () => {
13+
// The timestamp assignment should include isRecent as a condition
14+
// so entries in Today/Yesterday always get a timestamp
15+
expect(sidebarSrc).toMatch(/isRecent\s*\|\|\s*duplicateLabels\.has/);
16+
});
17+
18+
// AC3: Entries in older date groups show timestamps only for duplicate labels
19+
it("preserves duplicate-only timestamp logic for older groups via duplicateLabels.has", () => {
20+
// duplicateLabels.has should still be present (not removed)
21+
expect(sidebarSrc).toContain("duplicateLabels.has(baseLabel(label))");
22+
});
23+
24+
// AC4: Timestamps use the existing formatShortTime format
25+
it("uses formatShortTime for timestamp value", () => {
26+
// The timestamp value is derived from formatShortTime(session.createdAt)
27+
expect(sidebarSrc).toContain("formatShortTime(session.createdAt)");
28+
});
29+
30+
// AC5: Timestamp styling uses the existing muted style
31+
it("renders timestamps with muted sidebar-foreground/40 styling", () => {
32+
expect(sidebarSrc).toContain("text-sidebar-foreground/40");
33+
// timestamp rendering should include the dot separator
34+
expect(sidebarSrc).toMatch(/·\s*\{timestamp\}/);
35+
});
36+
37+
// AC6: isRecent is defined based on Today/Yesterday group labels
38+
it("defines isRecent from Today and Yesterday group labels", () => {
39+
expect(sidebarSrc).toMatch(
40+
/isRecent\s*=\s*group\.label\s*===\s*["']Today["']\s*\|\|\s*group\.label\s*===\s*["']Yesterday["']/,
41+
);
42+
});
43+
});

0 commit comments

Comments
 (0)