@handled-ai/design-system 0.18.6 → 0.18.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,6 +4,24 @@ import * as React from "react"
4
4
  import { cn } from "../lib/utils"
5
5
  import { ChevronDown, ChevronUp, ExternalLink } from "lucide-react"
6
6
 
7
+ export type TimelineEventTone =
8
+ | "red"
9
+ | "amber"
10
+ | "emerald"
11
+ | "violet"
12
+ | "blue"
13
+ | "slate"
14
+ | "salesforce"
15
+ | "gmail"
16
+
17
+ export interface TimelineEventActor {
18
+ kind: "user" | "integration" | "system"
19
+ name?: string
20
+ initials?: string
21
+ avatarUrl?: string
22
+ verb?: string
23
+ }
24
+
7
25
  export interface TimelineEvent {
8
26
  id: string
9
27
  icon: React.ReactNode
@@ -28,8 +46,57 @@ export interface TimelineEvent {
28
46
  defaultExpanded?: boolean
29
47
  isInteractive?: boolean
30
48
  onSourceClick?: () => void
49
+ tone?: TimelineEventTone
50
+ actor?: TimelineEventActor
51
+ isSystemNoise?: boolean
52
+ }
53
+
54
+ // ---------------------------------------------------------------------------
55
+ // Tone class map — every class is a complete static string literal so
56
+ // Tailwind's JIT scanner can detect them. NO interpolation.
57
+ // ---------------------------------------------------------------------------
58
+
59
+ export const TONE_CLASSES: Record<
60
+ TimelineEventTone,
61
+ { dot: string; icon: string }
62
+ > = {
63
+ red: {
64
+ dot: "bg-red-50 border-red-200 dark:bg-red-950/30 dark:border-red-900/40",
65
+ icon: "text-red-600 dark:text-red-300",
66
+ },
67
+ amber: {
68
+ dot: "bg-amber-50 border-amber-200 dark:bg-amber-950/30 dark:border-amber-900/40",
69
+ icon: "text-amber-600 dark:text-amber-300",
70
+ },
71
+ emerald: {
72
+ dot: "bg-emerald-50 border-emerald-200 dark:bg-emerald-950/30 dark:border-emerald-900/40",
73
+ icon: "text-emerald-600 dark:text-emerald-300",
74
+ },
75
+ violet: {
76
+ dot: "bg-violet-50 border-violet-200 dark:bg-violet-950/30 dark:border-violet-900/40",
77
+ icon: "text-violet-600 dark:text-violet-300",
78
+ },
79
+ blue: {
80
+ dot: "bg-blue-50 border-blue-200 dark:bg-blue-950/30 dark:border-blue-900/40",
81
+ icon: "text-blue-600 dark:text-blue-300",
82
+ },
83
+ slate: {
84
+ dot: "bg-slate-100 border-slate-200 dark:bg-slate-800/50 dark:border-slate-700",
85
+ icon: "text-slate-500 dark:text-slate-300",
86
+ },
87
+ salesforce: {
88
+ dot: "bg-white border-[#00A1E0]/25 dark:bg-background dark:border-[#00A1E0]/25",
89
+ icon: "text-[#00A1E0]",
90
+ },
91
+ gmail: {
92
+ dot: "bg-white border-red-200 dark:bg-background dark:border-red-900/40",
93
+ icon: "text-red-500 dark:text-red-300",
94
+ },
31
95
  }
32
96
 
97
+ const NEUTRAL_DOT_CLASSES = "border-border/60 bg-background"
98
+ const NEUTRAL_ICON_CLASSES = "text-muted-foreground"
99
+
33
100
  export interface TimelineActivityProps {
34
101
  events: TimelineEvent[]
35
102
  className?: string
@@ -49,12 +116,54 @@ export function TimelineActivity({ events, className }: TimelineActivityProps) {
49
116
  )
50
117
  }
51
118
 
119
+ function ActorByline({ actor, time }: { actor: TimelineEventActor; time: string }) {
120
+ if (actor.kind === "system") return null
121
+
122
+ if (actor.kind === "integration") {
123
+ return (
124
+ <div className="mt-1 flex items-center gap-1.5 text-xs text-muted-foreground" data-testid="actor-byline">
125
+ <span>Integration</span>
126
+ <span className="text-muted-foreground/40">&middot;</span>
127
+ <span>{time}</span>
128
+ </div>
129
+ )
130
+ }
131
+
132
+ // actor.kind === "user"
133
+ const verb = actor.verb ?? "performed this action"
134
+ const displayInitials = actor.initials ?? (actor.name ? actor.name.charAt(0).toUpperCase() : "?")
135
+
136
+ return (
137
+ <div className="mt-1 flex items-center gap-1.5 text-xs text-muted-foreground" data-testid="actor-byline">
138
+ {actor.avatarUrl ? (
139
+ <img
140
+ src={actor.avatarUrl}
141
+ alt={actor.name ?? "User"}
142
+ className="h-4 w-4 rounded-full object-cover"
143
+ />
144
+ ) : (
145
+ <span className="flex h-4 w-4 items-center justify-center rounded-full bg-muted-foreground/10 text-[8px] font-semibold text-muted-foreground">
146
+ {displayInitials}
147
+ </span>
148
+ )}
149
+ {actor.name && <span className="text-foreground font-medium">{actor.name}</span>}
150
+ <span>{verb}</span>
151
+ <span className="text-muted-foreground/40">&middot;</span>
152
+ <span>{time}</span>
153
+ </div>
154
+ )
155
+ }
156
+
52
157
  function TimelineItem({ event, isLast }: { event: TimelineEvent; isLast: boolean }) {
53
158
  const [expanded, setExpanded] = React.useState(event.defaultExpanded ?? false)
54
159
  const [showAllRecipients, setShowAllRecipients] = React.useState(false)
55
160
  const hasContent = !!event.content
56
161
  const hasEmail = !!event.email
57
162
 
163
+ const toneStyle = event.tone ? TONE_CLASSES[event.tone] : null
164
+ const dotClasses = toneStyle ? toneStyle.dot : NEUTRAL_DOT_CLASSES
165
+ const iconClasses = toneStyle ? toneStyle.icon : NEUTRAL_ICON_CLASSES
166
+
58
167
  return (
59
168
  <div className="group relative flex gap-3.5">
60
169
  {!isLast && (
@@ -62,7 +171,7 @@ function TimelineItem({ event, isLast }: { event: TimelineEvent; isLast: boolean
62
171
  )}
63
172
 
64
173
  <div className="relative z-10 mt-1 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-background">
65
- <div className="flex h-4.5 w-4.5 items-center justify-center rounded-full border border-border/60 bg-background text-muted-foreground ring-4 ring-background">
174
+ <div className={cn("flex h-4.5 w-4.5 items-center justify-center rounded-full border ring-4 ring-background", dotClasses, iconClasses)} data-testid="timeline-dot">
66
175
  {event.icon}
67
176
  </div>
68
177
  </div>
@@ -77,6 +186,8 @@ function TimelineItem({ event, isLast }: { event: TimelineEvent; isLast: boolean
77
186
  </span>
78
187
  </div>
79
188
 
189
+ {event.actor && <ActorByline actor={event.actor} time={event.time} />}
190
+
80
191
  {(hasContent || hasEmail) && (
81
192
  <div className="mt-2">
82
193
  {event.isInteractive ? (
@@ -89,8 +89,8 @@ describe("DetailView attentionCount", () => {
89
89
  expect(pill).not.toBeNull();
90
90
  expect(pill!.textContent).toContain("5");
91
91
 
92
- // Click the timeline header button to expand
93
- const timelineButton = container.querySelector("button.group\\/timeline") as HTMLElement;
92
+ // Click the timeline collapse button to expand
93
+ const timelineButton = container.querySelector('[data-testid="timeline-collapse-btn"]') as HTMLElement;
94
94
  expect(timelineButton).not.toBeNull();
95
95
  fireEvent.click(timelineButton);
96
96
 
@@ -0,0 +1,409 @@
1
+ import { describe, it, expect, vi, beforeEach } from "vitest"
2
+ import React from "react"
3
+ import { render, fireEvent } from "@testing-library/react"
4
+ import { DetailView, type DetailViewProps } from "../prototype-inbox-view"
5
+ import type { QueueItem, SignalScoreData } from "../prototype-config"
6
+ import type { TimelineEvent } from "../../components/timeline-activity"
7
+
8
+ // ---------------------------------------------------------------------------
9
+ // Helpers
10
+ // ---------------------------------------------------------------------------
11
+
12
+ const baseItem: QueueItem = {
13
+ id: "1",
14
+ title: "Test Signal",
15
+ details: "Some details",
16
+ statusColor: "green",
17
+ time: "2h ago",
18
+ company: "Acme Inc",
19
+ tag1: "renewal",
20
+ }
21
+
22
+ function makeSignalScore(): SignalScoreData {
23
+ return {
24
+ score: 75,
25
+ factors: [
26
+ { key: "trigger", label: "Trigger strength", score: 70, why: "Strong signal" },
27
+ ],
28
+ whyNow: "Strong signals detected.",
29
+ evidence: ["Evidence line 1"],
30
+ confidence: 80,
31
+ }
32
+ }
33
+
34
+ const normalEvents: TimelineEvent[] = [
35
+ {
36
+ id: "t1",
37
+ icon: React.createElement("span", null, "📧"),
38
+ title: "Email sent",
39
+ time: "1h ago",
40
+ },
41
+ {
42
+ id: "t2",
43
+ icon: React.createElement("span", null, "📞"),
44
+ title: "Call logged",
45
+ time: "3h ago",
46
+ },
47
+ ]
48
+
49
+ const noiseEvents: TimelineEvent[] = [
50
+ {
51
+ id: "t3",
52
+ icon: React.createElement("span", null, "📊"),
53
+ title: "Score updated +3",
54
+ time: "2h ago",
55
+ isSystemNoise: true,
56
+ },
57
+ {
58
+ id: "t4",
59
+ icon: React.createElement("span", null, "📊"),
60
+ title: "Score updated -1",
61
+ time: "4h ago",
62
+ isSystemNoise: true,
63
+ },
64
+ ]
65
+
66
+ const mixedEvents: TimelineEvent[] = [...normalEvents, ...noiseEvents]
67
+
68
+ function baseProps(overrides: Partial<DetailViewProps> = {}): DetailViewProps {
69
+ return {
70
+ item: baseItem,
71
+ sections: { signalBrief: true, suggestedActions: false, timeline: true },
72
+ getSignalScore: () => makeSignalScore(),
73
+ buildSuggestedActions: () => [],
74
+ buildSourceItems: () => [],
75
+ getTimelineEvents: () => mixedEvents,
76
+ accountContacts: [],
77
+ emailSignature: "",
78
+ iconMap: {},
79
+ timelineSystemEventsConfig: {
80
+ toggleLabel: "Score changes",
81
+ storageKey: "test-show-score-changes",
82
+ hiddenHint: "Score changes are hidden.",
83
+ visibleHint: "Showing {count} score changes.",
84
+ },
85
+ ...overrides,
86
+ }
87
+ }
88
+
89
+ // Mock localStorage
90
+ let store: Record<string, string> = {}
91
+
92
+ const localStorageMock = {
93
+ getItem: vi.fn((key: string) => store[key] ?? null),
94
+ setItem: vi.fn((key: string, value: string) => {
95
+ store[key] = value
96
+ }),
97
+ removeItem: vi.fn((key: string) => {
98
+ delete store[key]
99
+ }),
100
+ clear: vi.fn(() => {
101
+ store = {}
102
+ }),
103
+ }
104
+
105
+ beforeEach(() => {
106
+ store = {}
107
+ localStorageMock.getItem.mockClear()
108
+ localStorageMock.setItem.mockClear()
109
+ localStorageMock.removeItem.mockClear()
110
+ localStorageMock.clear.mockClear()
111
+ // Reset getItem to default implementation
112
+ localStorageMock.getItem.mockImplementation((key: string) => store[key] ?? null)
113
+ Object.defineProperty(window, "localStorage", { value: localStorageMock, writable: true })
114
+ })
115
+
116
+ // ---------------------------------------------------------------------------
117
+ // Helper to expand the timeline
118
+ // ---------------------------------------------------------------------------
119
+
120
+ function expandTimeline(container: HTMLElement) {
121
+ const collapseBtn = container.querySelector(
122
+ '[data-testid="timeline-collapse-btn"]',
123
+ ) as HTMLElement
124
+ if (collapseBtn) fireEvent.click(collapseBtn)
125
+ }
126
+
127
+ // ---------------------------------------------------------------------------
128
+ // Tests
129
+ // ---------------------------------------------------------------------------
130
+
131
+ describe("DetailView timeline system-events toggle", () => {
132
+ it("hides events with isSystemNoise: true by default", () => {
133
+ const { container } = render(<DetailView {...baseProps()} />)
134
+ // Expand the timeline
135
+ expandTimeline(container)
136
+ // Should only show 2 normal events, not the 2 noise events
137
+ const eventCount = container.querySelector('[data-testid="event-count"]')
138
+ expect(eventCount?.textContent).toBe("2 events")
139
+ // Noise event titles should not appear
140
+ expect(container.textContent).not.toContain("Score updated +3")
141
+ expect(container.textContent).not.toContain("Score updated -1")
142
+ })
143
+
144
+ it("reveals system-noise events when toggle is clicked", () => {
145
+ const { container } = render(<DetailView {...baseProps()} />)
146
+ expandTimeline(container)
147
+ // Click the toggle
148
+ const toggle = container.querySelector(
149
+ '[data-testid="system-events-toggle"]',
150
+ ) as HTMLElement
151
+ expect(toggle).not.toBeNull()
152
+ fireEvent.click(toggle)
153
+ // Now all 4 events should be visible
154
+ const eventCount = container.querySelector('[data-testid="event-count"]')
155
+ expect(eventCount?.textContent).toBe("4 events")
156
+ expect(container.textContent).toContain("Score updated +3")
157
+ })
158
+
159
+ it("clicking the toggle does NOT collapse/expand the timeline", () => {
160
+ const { container } = render(<DetailView {...baseProps()} />)
161
+ expandTimeline(container)
162
+ // Timeline should be expanded — normal events visible
163
+ expect(container.textContent).toContain("Email sent")
164
+
165
+ // Click the system-events toggle
166
+ const toggle = container.querySelector(
167
+ '[data-testid="system-events-toggle"]',
168
+ ) as HTMLElement
169
+ fireEvent.click(toggle)
170
+
171
+ // Timeline should still be expanded
172
+ expect(container.textContent).toContain("Email sent")
173
+ })
174
+
175
+ it("clicking the collapse button does NOT toggle system-event visibility", () => {
176
+ const { container } = render(<DetailView {...baseProps()} />)
177
+ expandTimeline(container)
178
+
179
+ // Toggle system events on
180
+ const toggle = container.querySelector(
181
+ '[data-testid="system-events-toggle"]',
182
+ ) as HTMLElement
183
+ fireEvent.click(toggle)
184
+ expect(container.textContent).toContain("Score updated +3")
185
+
186
+ // Collapse the timeline
187
+ expandTimeline(container)
188
+ // Re-expand
189
+ expandTimeline(container)
190
+
191
+ // System events should still be visible (toggle didn't change)
192
+ expect(container.textContent).toContain("Score updated +3")
193
+ })
194
+
195
+ it("header event count reflects visible events, not total events", () => {
196
+ const { container } = render(<DetailView {...baseProps()} />)
197
+ const eventCount = container.querySelector('[data-testid="event-count"]')
198
+ expect(eventCount?.textContent).toBe("2 events")
199
+ })
200
+
201
+ it("hidden count badge shows the correct number", () => {
202
+ const { container } = render(<DetailView {...baseProps()} />)
203
+ const badge = container.querySelector('[data-testid="hidden-count-badge"]')
204
+ expect(badge).not.toBeNull()
205
+ expect(badge?.textContent).toBe("2")
206
+ })
207
+
208
+ it("calls localStorage.setItem when toggle changes", () => {
209
+ const { container } = render(<DetailView {...baseProps()} />)
210
+ expandTimeline(container)
211
+ const toggle = container.querySelector(
212
+ '[data-testid="system-events-toggle"]',
213
+ ) as HTMLElement
214
+ fireEvent.click(toggle)
215
+ expect(localStorageMock.setItem).toHaveBeenCalledWith(
216
+ "test-show-score-changes",
217
+ "true",
218
+ )
219
+ })
220
+
221
+ it("reads localStorage.getItem on mount and honors stored value", () => {
222
+ store["test-show-score-changes"] = "true"
223
+ const { container } = render(<DetailView {...baseProps()} />)
224
+ expandTimeline(container)
225
+ // With stored value "true", system events should be visible
226
+ const eventCount = container.querySelector('[data-testid="event-count"]')
227
+ expect(eventCount?.textContent).toBe("4 events")
228
+ expect(localStorageMock.getItem).toHaveBeenCalledWith(
229
+ "test-show-score-changes",
230
+ )
231
+ })
232
+
233
+ it("renders header and toggle when all events are system noise and toggle is off", () => {
234
+ const allNoiseProps = baseProps({
235
+ getTimelineEvents: () => noiseEvents,
236
+ })
237
+ const { container } = render(<DetailView {...allNoiseProps} />)
238
+ // Header should still be rendered
239
+ const header = container.querySelector('[data-testid="timeline-header"]')
240
+ expect(header).not.toBeNull()
241
+ // Toggle should be present
242
+ const toggle = container.querySelector(
243
+ '[data-testid="system-events-toggle"]',
244
+ )
245
+ expect(toggle).not.toBeNull()
246
+ // Event count should show 0 events
247
+ const eventCount = container.querySelector('[data-testid="event-count"]')
248
+ expect(eventCount?.textContent).toBe("0 events")
249
+ })
250
+
251
+ it("'Last activity' uses the first visible event's time, not a hidden system-noise event", () => {
252
+ // Arrange: first event is system noise (time "30m ago"),
253
+ // second event is normal (time "1h ago")
254
+ const orderedEvents: TimelineEvent[] = [
255
+ {
256
+ id: "noise-first",
257
+ icon: React.createElement("span", null, "📊"),
258
+ title: "Score change",
259
+ time: "30m ago",
260
+ isSystemNoise: true,
261
+ },
262
+ {
263
+ id: "normal-second",
264
+ icon: React.createElement("span", null, "📧"),
265
+ title: "Email sent",
266
+ time: "1h ago",
267
+ },
268
+ ]
269
+ const props = baseProps({ getTimelineEvents: () => orderedEvents })
270
+ const { container } = render(<DetailView {...props} />)
271
+ const hint = container.querySelector('[data-testid="last-activity-hint"]')
272
+ expect(hint).not.toBeNull()
273
+ // Should show "1h ago" (the first visible event), not "30m ago" (the hidden noise event)
274
+ expect(hint?.textContent).toContain("1h ago")
275
+ expect(hint?.textContent).not.toContain("30m ago")
276
+ })
277
+
278
+ it("uses singular grammar for 1 event and plural for multiple", () => {
279
+ const singleEvent: TimelineEvent[] = [
280
+ {
281
+ id: "s1",
282
+ icon: React.createElement("span", null, "📧"),
283
+ title: "Email sent",
284
+ time: "1h ago",
285
+ },
286
+ ]
287
+ const props = baseProps({ getTimelineEvents: () => singleEvent })
288
+ const { container } = render(<DetailView {...props} />)
289
+ const eventCount = container.querySelector('[data-testid="event-count"]')
290
+ expect(eventCount?.textContent).toBe("1 event")
291
+ })
292
+
293
+ it("does not render toggle when there are no system-noise events", () => {
294
+ const props = baseProps({
295
+ getTimelineEvents: () => normalEvents,
296
+ })
297
+ const { container } = render(<DetailView {...props} />)
298
+ const toggle = container.querySelector(
299
+ '[data-testid="system-events-toggle"]',
300
+ )
301
+ expect(toggle).toBeNull()
302
+ })
303
+
304
+ it("shows footer hint when timeline is expanded and system events are hidden", () => {
305
+ const { container } = render(<DetailView {...baseProps()} />)
306
+ expandTimeline(container)
307
+ const hint = container.querySelector('[data-testid="timeline-footer-hint"]')
308
+ expect(hint).not.toBeNull()
309
+ expect(hint?.textContent).toBe("Score changes are hidden.")
310
+ })
311
+
312
+ it("shows visible footer hint with count when system events are shown", () => {
313
+ const { container } = render(<DetailView {...baseProps()} />)
314
+ expandTimeline(container)
315
+ // Toggle on
316
+ const toggle = container.querySelector(
317
+ '[data-testid="system-events-toggle"]',
318
+ ) as HTMLElement
319
+ fireEvent.click(toggle)
320
+ const hint = container.querySelector('[data-testid="timeline-footer-hint"]')
321
+ expect(hint).not.toBeNull()
322
+ expect(hint?.textContent).toBe("Showing 2 score changes.")
323
+ })
324
+
325
+ // --- Toggle always renders when system-noise events exist (review fix #1) ---
326
+
327
+ it("renders toggle even when no config is provided, using default 'System events' label", () => {
328
+ const props = baseProps({
329
+ timelineSystemEventsConfig: undefined,
330
+ getTimelineEvents: () => mixedEvents,
331
+ })
332
+ const { container } = render(<DetailView {...props} />)
333
+ const toggle = container.querySelector(
334
+ '[data-testid="system-events-toggle"]',
335
+ )
336
+ expect(toggle).not.toBeNull()
337
+ expect(toggle?.textContent).toContain("System events")
338
+ })
339
+
340
+ // --- lastActivityTime derives from filtered visible events (review fix #2) ---
341
+
342
+ it("ignores lastActivityTime when system-noise events are hidden and uses first visible event time", () => {
343
+ // lastActivityTime says "5m ago" but that comes from a hidden score event
344
+ const orderedEvents: TimelineEvent[] = [
345
+ {
346
+ id: "noise-first",
347
+ icon: React.createElement("span", null, "📊"),
348
+ title: "Score change",
349
+ time: "5m ago",
350
+ isSystemNoise: true,
351
+ },
352
+ {
353
+ id: "normal-second",
354
+ icon: React.createElement("span", null, "📧"),
355
+ title: "Email sent",
356
+ time: "2h ago",
357
+ },
358
+ ]
359
+ const props = baseProps({
360
+ getTimelineEvents: () => orderedEvents,
361
+ lastActivityTime: "5m ago",
362
+ })
363
+ const { container } = render(<DetailView {...props} />)
364
+ const hint = container.querySelector('[data-testid="last-activity-hint"]')
365
+ expect(hint).not.toBeNull()
366
+ // Should show "2h ago" (first visible event), not "5m ago" (from lastActivityTime)
367
+ expect(hint?.textContent).toContain("2h ago")
368
+ expect(hint?.textContent).not.toContain("5m ago")
369
+ })
370
+
371
+ it("uses lastActivityTime when all events are visible (showSystemEvents is true or no noise)", () => {
372
+ const props = baseProps({
373
+ getTimelineEvents: () => normalEvents,
374
+ lastActivityTime: "5m ago",
375
+ })
376
+ const { container } = render(<DetailView {...props} />)
377
+ const hint = container.querySelector('[data-testid="last-activity-hint"]')
378
+ expect(hint).not.toBeNull()
379
+ expect(hint?.textContent).toContain("5m ago")
380
+ })
381
+
382
+ // --- Deprecated individual props backward compatibility ---
383
+
384
+ it("accepts deprecated individual props and renders toggle correctly", () => {
385
+ const props: DetailViewProps = {
386
+ item: baseItem,
387
+ sections: { signalBrief: true, suggestedActions: false, timeline: true },
388
+ getSignalScore: () => makeSignalScore(),
389
+ buildSuggestedActions: () => [],
390
+ buildSourceItems: () => [],
391
+ getTimelineEvents: () => mixedEvents,
392
+ accountContacts: [],
393
+ emailSignature: "",
394
+ iconMap: {},
395
+ timelineSystemEventsToggleLabel: "Legacy label",
396
+ timelineSystemEventsStorageKey: "legacy-key",
397
+ timelineSystemEventsHiddenHint: "Legacy hidden hint.",
398
+ }
399
+ const { container } = render(<DetailView {...props} />)
400
+ const toggle = container.querySelector('[data-testid="system-events-toggle"]')
401
+ expect(toggle).not.toBeNull()
402
+ expect(toggle?.textContent).toContain("Legacy label")
403
+ // Footer hint should work too
404
+ expandTimeline(container)
405
+ const hint = container.querySelector('[data-testid="timeline-footer-hint"]')
406
+ expect(hint).not.toBeNull()
407
+ expect(hint?.textContent).toBe("Legacy hidden hint.")
408
+ })
409
+ })
@@ -18,6 +18,23 @@ import type { LucideIcon } from "lucide-react"
18
18
  import type { PriorityFactor } from "../components/signal-priority-popover"
19
19
  import type { FeedbackChipTree, FeedbackSubmitData, PersistedFeedbackData } from "../components/feedback-primitives"
20
20
 
21
+ // ---------------------------------------------------------------------------
22
+ // Timeline system-events toggle config
23
+ // ---------------------------------------------------------------------------
24
+
25
+ export interface TimelineSystemEventsConfig {
26
+ /** Label for the toggle button (e.g. "Score changes"). Falls back to "System events". */
27
+ toggleLabel?: string
28
+ /** localStorage key for persisting the toggle state. */
29
+ storageKey?: string
30
+ /** Whether system-noise events are visible by default. @default false */
31
+ defaultVisible?: boolean
32
+ /** Hint text shown below the timeline when system events are hidden. */
33
+ hiddenHint?: string
34
+ /** Hint text shown below the timeline when system events are visible. Uses {count} as placeholder. */
35
+ visibleHint?: string
36
+ }
37
+
21
38
  // ---------------------------------------------------------------------------
22
39
  // Shared
23
40
  // ---------------------------------------------------------------------------
@@ -206,6 +223,10 @@ export interface InboxViewConfig {
206
223
  renderAfterScore?: (item: QueueItem) => React.ReactNode
207
224
  /** Formatted string for "Last activity X ago" in the collapsed timeline header. If omitted, falls back to the first event's time. */
208
225
  lastActivityTime?: string
226
+ /** Configuration for the system-noise events toggle (score changes, etc.). */
227
+ timelineSystemEventsConfig?: TimelineSystemEventsConfig
228
+ /** Number of important/attention-worthy events to highlight on the collapsed timeline header. */
229
+ attentionCount?: number
209
230
  /** Render extra content inline with the detail title. */
210
231
  renderTitleExtra?: (item: QueueItem) => React.ReactNode
211
232
  /** Render supporting content below the detail title. */