@designa8/vibedesign-v6 1.10.6 → 1.10.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.
- package/README.md +1 -1
- package/dist/index.cjs +172 -271
- package/dist/index.js +172 -271
- package/dist/styles.css +15 -54
- package/package.json +1 -1
- package/src/atoms/ChatScreen/ChatScreen.tsx +205 -263
- package/src/atoms/ChatScreen/preview.tsx +39 -210
|
@@ -6,18 +6,12 @@ import { Button } from "../Button";
|
|
|
6
6
|
|
|
7
7
|
export type MessageRole = "user" | "ai";
|
|
8
8
|
|
|
9
|
-
export interface
|
|
9
|
+
export interface TimelineItem {
|
|
10
10
|
id: string;
|
|
11
|
+
kind: "thinking" | "read" | "write" | "tool" | "verify";
|
|
11
12
|
label: string;
|
|
12
|
-
|
|
13
|
-
status
|
|
14
|
-
/** Friendly tool label shown inline when status is in_progress */
|
|
15
|
-
currentTool?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface PlanCard {
|
|
19
|
-
title: string;
|
|
20
|
-
tasks: PlanTask[];
|
|
13
|
+
detail?: string;
|
|
14
|
+
status: "running" | "done" | "error";
|
|
21
15
|
}
|
|
22
16
|
|
|
23
17
|
export interface ChatMessage {
|
|
@@ -30,10 +24,10 @@ export interface ChatMessage {
|
|
|
30
24
|
inFlight?: boolean;
|
|
31
25
|
/** Label for the current tool being invoked, e.g. "Writing atom" */
|
|
32
26
|
currentToolLabel?: string;
|
|
33
|
-
|
|
27
|
+
/** Optional timeline of agent tool-call steps — renders a collapsible TimelineBlock */
|
|
28
|
+
timeline?: TimelineItem[];
|
|
34
29
|
/**
|
|
35
|
-
* Optional text rendered in a separate <p> AFTER the
|
|
36
|
-
* If not provided, nothing additional renders after the plan card.
|
|
30
|
+
* Optional text rendered in a separate <p> AFTER the timeline block.
|
|
37
31
|
*/
|
|
38
32
|
postContent?: string;
|
|
39
33
|
}
|
|
@@ -79,21 +73,12 @@ export interface ChatScreenProps {
|
|
|
79
73
|
|
|
80
74
|
// ─── Empty-state illustration ─────────────────────────────────────────────────
|
|
81
75
|
|
|
82
|
-
/**
|
|
83
|
-
* Soft blob + chat bubble + sparkles.
|
|
84
|
-
* All geometry uses explicit SVG width/height attributes and inline styles
|
|
85
|
-
* so it renders correctly in consumer apps that may not include Tailwind
|
|
86
|
-
* numeric spacing utilities (w-28, size-2.5, h-1.5, opacity-15, etc.).
|
|
87
|
-
* Token-only color classes: text-primary, bg-primary, text-on-primary.
|
|
88
|
-
*/
|
|
89
76
|
const ChatEmptyIllustration: React.FC = () => (
|
|
90
|
-
// 112px container — stable width regardless of Tailwind spacing scale.
|
|
91
77
|
<div
|
|
92
78
|
className="relative flex-shrink-0"
|
|
93
79
|
aria-hidden="true"
|
|
94
80
|
style={{ width: 112 }}
|
|
95
81
|
>
|
|
96
|
-
{/* Organic blob background — explicit dimensions + inline opacity */}
|
|
97
82
|
<svg
|
|
98
83
|
viewBox="0 0 160 140"
|
|
99
84
|
width="112"
|
|
@@ -105,13 +90,11 @@ const ChatEmptyIllustration: React.FC = () => (
|
|
|
105
90
|
<path d="M78 8c28-6 52 10 58 34 6 24-6 44-4 62 2 16-14 30-36 32-26 2-48-8-62-28-12-18-22-42-10-58C36 30 52 14 78 8z" />
|
|
106
91
|
</svg>
|
|
107
92
|
|
|
108
|
-
{/* Chat bubble circle — 64×64 via inline style */}
|
|
109
93
|
<div className="absolute inset-0 flex items-center justify-center">
|
|
110
94
|
<div
|
|
111
95
|
className="relative flex items-center justify-center rounded-full bg-primary shadow-sm"
|
|
112
96
|
style={{ width: 64, height: 64 }}
|
|
113
97
|
>
|
|
114
|
-
{/* Message lines — height/width via inline styles, not h-1.5 / w-2/3 */}
|
|
115
98
|
<div className="flex flex-col" style={{ width: 32, gap: 6 }}>
|
|
116
99
|
<span
|
|
117
100
|
className="rounded-full bg-on-primary"
|
|
@@ -122,7 +105,6 @@ const ChatEmptyIllustration: React.FC = () => (
|
|
|
122
105
|
style={{ height: 6, width: "66%" }}
|
|
123
106
|
/>
|
|
124
107
|
</div>
|
|
125
|
-
{/* Tail triangle — 12×12 via inline style, no h-3/w-3 */}
|
|
126
108
|
<span
|
|
127
109
|
className="absolute bg-primary"
|
|
128
110
|
style={{
|
|
@@ -137,60 +119,25 @@ const ChatEmptyIllustration: React.FC = () => (
|
|
|
137
119
|
</div>
|
|
138
120
|
</div>
|
|
139
121
|
|
|
140
|
-
|
|
141
|
-
<svg
|
|
142
|
-
viewBox="0 0 24 24"
|
|
143
|
-
width="12"
|
|
144
|
-
height="12"
|
|
145
|
-
className="absolute text-primary"
|
|
146
|
-
fill="currentColor"
|
|
147
|
-
aria-hidden="true"
|
|
148
|
-
style={{ left: 8, top: 16 }}
|
|
149
|
-
>
|
|
122
|
+
<svg viewBox="0 0 24 24" width="12" height="12" className="absolute text-primary" fill="currentColor" aria-hidden="true" style={{ left: 8, top: 16 }}>
|
|
150
123
|
<path d="M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" />
|
|
151
124
|
</svg>
|
|
152
|
-
<svg
|
|
153
|
-
viewBox="0 0 24 24"
|
|
154
|
-
width="10"
|
|
155
|
-
height="10"
|
|
156
|
-
className="absolute text-primary"
|
|
157
|
-
fill="currentColor"
|
|
158
|
-
aria-hidden="true"
|
|
159
|
-
style={{ right: 12, top: 32 }}
|
|
160
|
-
>
|
|
125
|
+
<svg viewBox="0 0 24 24" width="10" height="10" className="absolute text-primary" fill="currentColor" aria-hidden="true" style={{ right: 12, top: 32 }}>
|
|
161
126
|
<path d="M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" />
|
|
162
127
|
</svg>
|
|
163
|
-
<svg
|
|
164
|
-
viewBox="0 0 24 24"
|
|
165
|
-
width="8"
|
|
166
|
-
height="8"
|
|
167
|
-
className="absolute text-primary"
|
|
168
|
-
fill="currentColor"
|
|
169
|
-
aria-hidden="true"
|
|
170
|
-
style={{ left: 24, bottom: 24 }}
|
|
171
|
-
>
|
|
128
|
+
<svg viewBox="0 0 24 24" width="8" height="8" className="absolute text-primary" fill="currentColor" aria-hidden="true" style={{ left: 24, bottom: 24 }}>
|
|
172
129
|
<path d="M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" />
|
|
173
130
|
</svg>
|
|
174
|
-
<svg
|
|
175
|
-
viewBox="0 0 24 24"
|
|
176
|
-
width="14"
|
|
177
|
-
height="14"
|
|
178
|
-
className="absolute text-primary"
|
|
179
|
-
fill="currentColor"
|
|
180
|
-
aria-hidden="true"
|
|
181
|
-
style={{ right: 8, bottom: 32 }}
|
|
182
|
-
>
|
|
131
|
+
<svg viewBox="0 0 24 24" width="14" height="14" className="absolute text-primary" fill="currentColor" aria-hidden="true" style={{ right: 8, bottom: 32 }}>
|
|
183
132
|
<path d="M12 0l1.5 8.5L22 12l-8.5 1.5L12 22l-1.5-8.5L2 12l8.5-1.5L12 0z" />
|
|
184
133
|
</svg>
|
|
185
134
|
</div>
|
|
186
135
|
);
|
|
187
136
|
|
|
188
|
-
/** Default empty-state content: illustration on the left, text block on the right. */
|
|
189
137
|
const ChatEmptyStateContent: React.FC<{ title: string; description: string }> = ({
|
|
190
138
|
title,
|
|
191
139
|
description,
|
|
192
140
|
}) => (
|
|
193
|
-
// Use inline gap so the layout is robust when gap-lg is absent in the consumer theme.
|
|
194
141
|
<div className="flex items-center px-lg" style={{ gap: 24 }}>
|
|
195
142
|
<ChatEmptyIllustration />
|
|
196
143
|
<div className="flex min-w-0 flex-col gap-xs">
|
|
@@ -200,201 +147,197 @@ const ChatEmptyStateContent: React.FC<{ title: string; description: string }> =
|
|
|
200
147
|
</div>
|
|
201
148
|
);
|
|
202
149
|
|
|
203
|
-
// ─── Sub-components
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
return (
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
150
|
+
// ─── Timeline Sub-components ──────────────────────────────────────────────────
|
|
151
|
+
|
|
152
|
+
/** Returns a small SVG icon for each TimelineItem kind */
|
|
153
|
+
const TimelineKindIcon: React.FC<{ kind: TimelineItem["kind"]; status: TimelineItem["status"] }> = ({
|
|
154
|
+
kind,
|
|
155
|
+
status,
|
|
156
|
+
}) => {
|
|
157
|
+
const colorClass =
|
|
158
|
+
status === "error"
|
|
159
|
+
? "text-semantic-error"
|
|
160
|
+
: status === "running"
|
|
161
|
+
? "text-primary"
|
|
162
|
+
: "text-semantic-success";
|
|
163
|
+
|
|
164
|
+
if (kind === "thinking") {
|
|
165
|
+
return (
|
|
166
|
+
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={colorClass} aria-hidden="true">
|
|
167
|
+
<circle cx="12" cy="12" r="10" />
|
|
168
|
+
<path d="M12 8v4l2 2" />
|
|
169
|
+
</svg>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
if (kind === "read") {
|
|
173
|
+
return (
|
|
174
|
+
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={colorClass} aria-hidden="true">
|
|
175
|
+
<path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z" />
|
|
176
|
+
<path d="M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z" />
|
|
177
|
+
</svg>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
if (kind === "write") {
|
|
181
|
+
return (
|
|
182
|
+
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={colorClass} aria-hidden="true">
|
|
183
|
+
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" />
|
|
184
|
+
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" />
|
|
185
|
+
</svg>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
if (kind === "verify") {
|
|
189
|
+
return (
|
|
190
|
+
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={colorClass} aria-hidden="true">
|
|
191
|
+
<polyline points="20 6 9 17 4 12" />
|
|
192
|
+
</svg>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
// tool (default)
|
|
196
|
+
return (
|
|
197
|
+
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className={colorClass} aria-hidden="true">
|
|
198
|
+
<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" />
|
|
199
|
+
</svg>
|
|
248
200
|
);
|
|
201
|
+
};
|
|
249
202
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
203
|
+
/** Left-border vertical line for a timeline row */
|
|
204
|
+
const TimelineRow: React.FC<{
|
|
205
|
+
item: TimelineItem;
|
|
206
|
+
isLast: boolean;
|
|
207
|
+
}> = ({ item, isLast }) => {
|
|
208
|
+
const borderColor =
|
|
209
|
+
item.status === "error"
|
|
210
|
+
? "border-semantic-error"
|
|
211
|
+
: item.status === "running"
|
|
212
|
+
? "border-primary"
|
|
213
|
+
: "border-semantic-success";
|
|
254
214
|
|
|
255
215
|
return (
|
|
256
|
-
<div className="
|
|
257
|
-
{/*
|
|
258
|
-
<div className="flex
|
|
259
|
-
{/*
|
|
260
|
-
<
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
strokeLinejoin="round"
|
|
268
|
-
className="size-4 text-primary flex-shrink-0 mt-xs"
|
|
269
|
-
aria-hidden="true"
|
|
216
|
+
<div className="flex gap-sm">
|
|
217
|
+
{/* Left track */}
|
|
218
|
+
<div className="flex flex-col items-center" style={{ width: 20 }}>
|
|
219
|
+
{/* Icon dot */}
|
|
220
|
+
<div
|
|
221
|
+
className={[
|
|
222
|
+
"flex items-center justify-center rounded-full flex-shrink-0 border",
|
|
223
|
+
borderColor,
|
|
224
|
+
"bg-canvas",
|
|
225
|
+
].join(" ")}
|
|
226
|
+
style={{ width: 20, height: 20 }}
|
|
270
227
|
>
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
</svg>
|
|
278
|
-
|
|
279
|
-
{/* Title + chevron */}
|
|
280
|
-
<div className="flex-1 min-w-0 flex items-start gap-xs">
|
|
281
|
-
<span
|
|
282
|
-
ref={titleRef}
|
|
283
|
-
className="text-body-sm font-weight-heading-sm text-primary flex-1 min-w-0"
|
|
284
|
-
style={
|
|
285
|
-
titleExpanded
|
|
286
|
-
? undefined
|
|
287
|
-
: {
|
|
288
|
-
display: "-webkit-box",
|
|
289
|
-
WebkitLineClamp: 2,
|
|
290
|
-
WebkitBoxOrient: "vertical",
|
|
291
|
-
overflow: "hidden",
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
>
|
|
295
|
-
{plan.title}
|
|
296
|
-
</span>
|
|
297
|
-
|
|
298
|
-
{/* Chevron toggle — only visible when title overflows */}
|
|
299
|
-
{isOverflowing && (
|
|
300
|
-
<Button
|
|
301
|
-
variant="ghost"
|
|
302
|
-
size="sm"
|
|
303
|
-
type="button"
|
|
304
|
-
onClick={() => setTitleExpanded((prev) => !prev)}
|
|
305
|
-
aria-label={titleExpanded ? "Collapse plan title" : "Expand plan title"}
|
|
306
|
-
className="flex-shrink-0 !p-xxs !rounded-xs"
|
|
307
|
-
>
|
|
308
|
-
<ChevronIcon expanded={titleExpanded} />
|
|
309
|
-
</Button>
|
|
228
|
+
{item.status === "running" ? (
|
|
229
|
+
<svg viewBox="0 0 24 24" width="10" height="10" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" className="text-primary animate-spin" aria-hidden="true">
|
|
230
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
231
|
+
</svg>
|
|
232
|
+
) : (
|
|
233
|
+
<TimelineKindIcon kind={item.kind} status={item.status} />
|
|
310
234
|
)}
|
|
311
235
|
</div>
|
|
236
|
+
{/* Connector line */}
|
|
237
|
+
{!isLast && (
|
|
238
|
+
<div className="flex-1 w-px bg-hairline-soft" style={{ minHeight: 8 }} />
|
|
239
|
+
)}
|
|
312
240
|
</div>
|
|
313
241
|
|
|
314
|
-
{/*
|
|
315
|
-
|
|
316
|
-
<
|
|
317
|
-
{
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
stroke="currentColor"
|
|
336
|
-
strokeWidth="2.5"
|
|
337
|
-
strokeLinecap="round"
|
|
338
|
-
strokeLinejoin="round"
|
|
339
|
-
className="size-4 text-semantic-success"
|
|
340
|
-
aria-hidden="true"
|
|
341
|
-
>
|
|
342
|
-
<polyline points="20 6 9 17 4 12" />
|
|
343
|
-
</svg>
|
|
344
|
-
</span>
|
|
345
|
-
)}
|
|
346
|
-
{task.status === "failed" && (
|
|
347
|
-
<span className="flex-shrink-0" aria-label="Failed">
|
|
348
|
-
<svg
|
|
349
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
350
|
-
viewBox="0 0 24 24"
|
|
351
|
-
fill="none"
|
|
352
|
-
stroke="currentColor"
|
|
353
|
-
strokeWidth="2.5"
|
|
354
|
-
strokeLinecap="round"
|
|
355
|
-
strokeLinejoin="round"
|
|
356
|
-
className="size-4 text-semantic-error"
|
|
357
|
-
aria-hidden="true"
|
|
358
|
-
>
|
|
359
|
-
<line x1="18" y1="6" x2="6" y2="18" />
|
|
360
|
-
<line x1="6" y1="6" x2="18" y2="18" />
|
|
361
|
-
</svg>
|
|
362
|
-
</span>
|
|
363
|
-
)}
|
|
242
|
+
{/* Content */}
|
|
243
|
+
<div className="flex flex-col min-w-0 pb-sm">
|
|
244
|
+
<span
|
|
245
|
+
className={[
|
|
246
|
+
"text-body-sm",
|
|
247
|
+
item.status === "error"
|
|
248
|
+
? "text-semantic-error"
|
|
249
|
+
: item.status === "running"
|
|
250
|
+
? "text-ink font-weight-heading-sm"
|
|
251
|
+
: "text-muted",
|
|
252
|
+
].join(" ")}
|
|
253
|
+
>
|
|
254
|
+
{item.label}
|
|
255
|
+
</span>
|
|
256
|
+
{item.detail && (
|
|
257
|
+
<span className="text-caption text-muted-soft mt-xxs">{item.detail}</span>
|
|
258
|
+
)}
|
|
259
|
+
</div>
|
|
260
|
+
</div>
|
|
261
|
+
);
|
|
262
|
+
};
|
|
364
263
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
264
|
+
/** Collapsible timeline block rendered below a message's text content */
|
|
265
|
+
const TimelineBlock: React.FC<{ items: TimelineItem[] }> = ({ items }) => {
|
|
266
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
267
|
+
|
|
268
|
+
if (items.length === 0) return null;
|
|
269
|
+
|
|
270
|
+
const latestItem = items[items.length - 1];
|
|
271
|
+
const hasMore = items.length > 1;
|
|
272
|
+
|
|
273
|
+
return (
|
|
274
|
+
<div className="mt-md rounded-xl border border-hairline bg-canvas overflow-hidden">
|
|
275
|
+
{/* Summary row / toggle — uses Button ghost to satisfy reuse rule */}
|
|
276
|
+
<Button
|
|
277
|
+
variant="ghost"
|
|
278
|
+
size="sm"
|
|
279
|
+
type="button"
|
|
280
|
+
onClick={() => setExpanded((prev) => !prev)}
|
|
281
|
+
aria-expanded={expanded}
|
|
282
|
+
aria-label={expanded ? "Collapse agent steps" : "Expand agent steps"}
|
|
283
|
+
className="w-full flex items-center gap-sm !px-md !py-sm !text-left !justify-start !rounded-none"
|
|
284
|
+
>
|
|
285
|
+
{/* Latest item icon */}
|
|
286
|
+
<span className="flex-shrink-0 flex items-center justify-center" style={{ width: 20, height: 20 }}>
|
|
287
|
+
{latestItem.status === "running" ? (
|
|
288
|
+
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" className="text-primary animate-spin" aria-hidden="true">
|
|
289
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
290
|
+
</svg>
|
|
291
|
+
) : (
|
|
292
|
+
<TimelineKindIcon kind={latestItem.kind} status={latestItem.status} />
|
|
293
|
+
)}
|
|
294
|
+
</span>
|
|
295
|
+
|
|
296
|
+
{/* Latest label + count badge */}
|
|
297
|
+
<span className="flex-1 min-w-0 text-body-sm text-muted truncate">
|
|
298
|
+
{latestItem.label}
|
|
299
|
+
{hasMore && !expanded && (
|
|
300
|
+
<span className="ml-xs text-caption text-muted-soft">
|
|
301
|
+
(+{items.length - 1} more)
|
|
302
|
+
</span>
|
|
303
|
+
)}
|
|
304
|
+
</span>
|
|
305
|
+
|
|
306
|
+
{/* Chevron */}
|
|
307
|
+
{hasMore && (
|
|
308
|
+
<svg
|
|
309
|
+
viewBox="0 0 24 24"
|
|
310
|
+
width="14"
|
|
311
|
+
height="14"
|
|
312
|
+
fill="none"
|
|
313
|
+
stroke="currentColor"
|
|
314
|
+
strokeWidth="2"
|
|
315
|
+
strokeLinecap="round"
|
|
316
|
+
strokeLinejoin="round"
|
|
317
|
+
className="text-muted flex-shrink-0 transition-transform duration-200"
|
|
318
|
+
style={{ transform: expanded ? "rotate(180deg)" : "rotate(0deg)" }}
|
|
319
|
+
aria-hidden="true"
|
|
320
|
+
>
|
|
321
|
+
<polyline points="6 9 12 15 18 9" />
|
|
322
|
+
</svg>
|
|
323
|
+
)}
|
|
324
|
+
</Button>
|
|
325
|
+
|
|
326
|
+
{/* Expanded full list */}
|
|
327
|
+
{expanded && hasMore && (
|
|
328
|
+
<div className="px-md pb-sm pt-xs border-t border-hairline-soft">
|
|
329
|
+
{items.map((item, idx) => (
|
|
330
|
+
<TimelineRow key={item.id} item={item} isLast={idx === items.length - 1} />
|
|
390
331
|
))}
|
|
391
|
-
</
|
|
332
|
+
</div>
|
|
392
333
|
)}
|
|
393
334
|
</div>
|
|
394
335
|
);
|
|
395
336
|
};
|
|
396
337
|
|
|
397
|
-
|
|
338
|
+
// ─── Other Sub-components ─────────────────────────────────────────────────────
|
|
339
|
+
|
|
340
|
+
/** AI avatar — small primary circle with "AI" text */
|
|
398
341
|
const AIAvatar: React.FC = () => (
|
|
399
342
|
<span
|
|
400
343
|
aria-hidden="true"
|
|
@@ -404,7 +347,7 @@ const AIAvatar: React.FC = () => (
|
|
|
404
347
|
</span>
|
|
405
348
|
);
|
|
406
349
|
|
|
407
|
-
/** User avatar —
|
|
350
|
+
/** User avatar — muted circle with user initials */
|
|
408
351
|
const UserAvatar: React.FC<{ initials?: string }> = ({ initials = "U" }) => (
|
|
409
352
|
<span
|
|
410
353
|
aria-hidden="true"
|
|
@@ -431,7 +374,7 @@ const SpinnerIcon: React.FC = () => (
|
|
|
431
374
|
</svg>
|
|
432
375
|
);
|
|
433
376
|
|
|
434
|
-
/** AI message bubble
|
|
377
|
+
/** AI message bubble */
|
|
435
378
|
const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
436
379
|
<div className="flex items-start gap-md w-full">
|
|
437
380
|
<AIAvatar />
|
|
@@ -444,9 +387,10 @@ const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
|
444
387
|
</span>
|
|
445
388
|
</div>
|
|
446
389
|
)}
|
|
447
|
-
{/* Body text: body-sm (14px) */}
|
|
448
390
|
<p className="text-body-sm text-body leading-relaxed">{message.content}</p>
|
|
449
|
-
{message.
|
|
391
|
+
{message.timeline && message.timeline.length > 0 && (
|
|
392
|
+
<TimelineBlock items={message.timeline} />
|
|
393
|
+
)}
|
|
450
394
|
{message.postContent && (
|
|
451
395
|
<p className="text-body-sm text-body leading-relaxed mt-md">{message.postContent}</p>
|
|
452
396
|
)}
|
|
@@ -454,11 +398,10 @@ const AiMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
|
454
398
|
</div>
|
|
455
399
|
);
|
|
456
400
|
|
|
457
|
-
/** User message bubble — right-aligned
|
|
401
|
+
/** User message bubble — right-aligned */
|
|
458
402
|
const UserMessage: React.FC<{ message: ChatMessage }> = ({ message }) => (
|
|
459
403
|
<div className="flex items-start gap-md w-full justify-end">
|
|
460
404
|
<div className="max-w-[80%] bg-primary-disabled rounded-xl px-lg py-md">
|
|
461
|
-
{/* Body text: body-sm (14px) */}
|
|
462
405
|
<p className="text-body-sm text-ink">{message.content}</p>
|
|
463
406
|
</div>
|
|
464
407
|
<UserAvatar initials={message.userInitials ?? "U"} />
|
|
@@ -493,30 +436,29 @@ export const ChatScreen = React.forwardRef<HTMLDivElement, ChatScreenProps>(
|
|
|
493
436
|
{
|
|
494
437
|
id: "1",
|
|
495
438
|
role: "user",
|
|
496
|
-
content: "Build a `PromptInputBar` Molecule that reproduces the Lovable-style prompt bar
|
|
439
|
+
content: "Build a `PromptInputBar` Molecule that reproduces the Lovable-style prompt bar.",
|
|
497
440
|
userInitials: "DU",
|
|
498
441
|
},
|
|
499
442
|
{
|
|
500
443
|
id: "2",
|
|
501
444
|
role: "ai",
|
|
502
445
|
content:
|
|
503
|
-
"I'll build the `PromptInputBar` Molecule
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
{ id: "p5", label: "Create stories and tests" },
|
|
512
|
-
],
|
|
513
|
-
},
|
|
514
|
-
postContent: "The plan above outlines all the steps. Let me start building the component now.",
|
|
446
|
+
"I'll build the `PromptInputBar` Molecule now. Here's what the agent is doing:",
|
|
447
|
+
timeline: [
|
|
448
|
+
{ id: "t1", kind: "thinking", label: "Planning component structure", status: "done" },
|
|
449
|
+
{ id: "t2", kind: "read", label: "Reading design tokens", detail: "colors, spacing, typography", status: "done" },
|
|
450
|
+
{ id: "t3", kind: "write", label: "Writing PromptInputBar.tsx", status: "done" },
|
|
451
|
+
{ id: "t4", kind: "verify", label: "Verifying atom", status: "running" },
|
|
452
|
+
],
|
|
453
|
+
postContent: "The component is being verified — it will be ready shortly.",
|
|
515
454
|
},
|
|
516
455
|
{
|
|
517
456
|
id: "3",
|
|
518
457
|
role: "ai",
|
|
519
|
-
content: "
|
|
458
|
+
content: "Done! The `PromptInputBar` atom has been created and verified.",
|
|
459
|
+
timeline: [
|
|
460
|
+
{ id: "t5", kind: "verify", label: "Atom verified successfully", status: "done" },
|
|
461
|
+
],
|
|
520
462
|
},
|
|
521
463
|
];
|
|
522
464
|
|