@designa8/vibedesign-v6 2.2.5 → 2.3.0
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 +2403 -2060
- package/dist/index.js +2366 -2023
- package/dist/styles.css +17 -15
- package/package.json +6 -1
- package/src/atoms/AgentActivityPanel/AgentActivityPanel.tsx +348 -0
- package/src/atoms/AgentActivityPanel/index.ts +8 -0
- package/src/atoms/AgentActivityPanel/preview.tsx +107 -0
- package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +59 -16
- package/src/atoms/HomePageTemplate/preview.tsx +42 -19
- package/src/atoms/Icon/icons.data.ts +3 -0
- package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +44 -23
- package/src/atoms/MarketingNavbar/preview.tsx +30 -6
- package/src/atoms/PromptInputBar/PromptInputBar.tsx +107 -31
- package/src/index.ts +1 -0
- package/dist/fonts/plusjakartasans/PlusJakartaSans-Italic[wght].ttf +0 -0
- package/dist/fonts/plusjakartasans/PlusJakartaSans[wght].ttf +0 -0
package/dist/styles.css
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
@font-face {
|
|
3
|
-
font-family: "Plus Jakarta Sans";
|
|
4
|
-
font-style: italic;
|
|
5
|
-
font-weight: 100 900;
|
|
6
|
-
font-display: swap;
|
|
7
|
-
src: url("./fonts/plusjakartasans/PlusJakartaSans-Italic%5Bwght%5D.ttf") format("truetype");
|
|
8
|
-
}
|
|
9
|
-
@font-face {
|
|
10
|
-
font-family: "Plus Jakarta Sans";
|
|
11
|
-
font-style: normal;
|
|
12
|
-
font-weight: 100 900;
|
|
13
|
-
font-display: swap;
|
|
14
|
-
src: url("./fonts/plusjakartasans/PlusJakartaSans%5Bwght%5D.ttf") format("truetype");
|
|
15
|
-
}
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Plus%20Jakarta%20Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
|
|
16
2
|
|
|
17
3
|
/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */
|
|
18
4
|
@layer properties;
|
|
@@ -378,6 +364,9 @@
|
|
|
378
364
|
.inset-y-xxs {
|
|
379
365
|
inset-block: var(--spacing-xxs);
|
|
380
366
|
}
|
|
367
|
+
.-top-0\.5 {
|
|
368
|
+
top: calc(var(--spacing) * -0.5);
|
|
369
|
+
}
|
|
381
370
|
.-top-3\.5 {
|
|
382
371
|
top: calc(var(--spacing) * -3.5);
|
|
383
372
|
}
|
|
@@ -402,6 +391,9 @@
|
|
|
402
391
|
.top-xxs {
|
|
403
392
|
top: var(--spacing-xxs);
|
|
404
393
|
}
|
|
394
|
+
.-right-0\.5 {
|
|
395
|
+
right: calc(var(--spacing) * -0.5);
|
|
396
|
+
}
|
|
405
397
|
.right-0 {
|
|
406
398
|
right: 0;
|
|
407
399
|
}
|
|
@@ -1648,6 +1640,9 @@
|
|
|
1648
1640
|
background-color: color-mix(in oklab, var(--color-canvas) 80%, transparent);
|
|
1649
1641
|
}
|
|
1650
1642
|
}
|
|
1643
|
+
.bg-current {
|
|
1644
|
+
background-color: currentcolor;
|
|
1645
|
+
}
|
|
1651
1646
|
.bg-demo-warm-accent {
|
|
1652
1647
|
background-color: var(--color-demo-warm-accent);
|
|
1653
1648
|
}
|
|
@@ -2358,6 +2353,9 @@
|
|
|
2358
2353
|
.ring-primary-focus {
|
|
2359
2354
|
--tw-ring-color: var(--color-primary-focus);
|
|
2360
2355
|
}
|
|
2356
|
+
.ring-surface {
|
|
2357
|
+
--tw-ring-color: var(--color-surface);
|
|
2358
|
+
}
|
|
2361
2359
|
.inset-ring-hairline {
|
|
2362
2360
|
--tw-inset-ring-color: var(--color-hairline);
|
|
2363
2361
|
}
|
|
@@ -2437,6 +2435,10 @@
|
|
|
2437
2435
|
--tw-duration: 300ms;
|
|
2438
2436
|
transition-duration: 300ms;
|
|
2439
2437
|
}
|
|
2438
|
+
.duration-500 {
|
|
2439
|
+
--tw-duration: 500ms;
|
|
2440
|
+
transition-duration: 500ms;
|
|
2441
|
+
}
|
|
2440
2442
|
.ease-in {
|
|
2441
2443
|
--tw-ease: var(--ease-in);
|
|
2442
2444
|
transition-timing-function: var(--ease-in);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designa8/vibedesign-v6",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Complete design system \"Plasma Design System\" generated by Atoms Design.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
],
|
|
35
35
|
"atomsDesign": {
|
|
36
36
|
"atoms": [
|
|
37
|
+
{
|
|
38
|
+
"name": "AgentActivityPanel",
|
|
39
|
+
"kind": "Organism",
|
|
40
|
+
"description": null
|
|
41
|
+
},
|
|
37
42
|
{
|
|
38
43
|
"name": "AgentQuestionCard",
|
|
39
44
|
"kind": "Organism",
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
|
|
5
|
+
export type AgentRunStatus = "running" | "queued" | "done" | "failed" | "stopped";
|
|
6
|
+
export type AgentStepStatus = "done" | "active" | "pending" | "failed";
|
|
7
|
+
|
|
8
|
+
export interface AgentActivityStep {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
status: AgentStepStatus;
|
|
12
|
+
detail?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface AgentActivityRun {
|
|
16
|
+
id: string;
|
|
17
|
+
/** Name of the agent doing the work, e.g. "Builder agent". */
|
|
18
|
+
agent: string;
|
|
19
|
+
/** What the agent is doing right now — the headline of the run. */
|
|
20
|
+
title: string;
|
|
21
|
+
/** Optional supporting line under the headline. */
|
|
22
|
+
detail?: string;
|
|
23
|
+
status: AgentRunStatus;
|
|
24
|
+
/** 0–100. Renders a progress track when provided. */
|
|
25
|
+
progress?: number;
|
|
26
|
+
/** Free-form time label, e.g. "12s". */
|
|
27
|
+
elapsed?: string;
|
|
28
|
+
steps?: AgentActivityStep[];
|
|
29
|
+
files?: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface AgentActivityPanelProps
|
|
33
|
+
extends React.ComponentPropsWithoutRef<"section"> {
|
|
34
|
+
/** Panel heading. */
|
|
35
|
+
heading?: string;
|
|
36
|
+
/** Runs to display, newest first. */
|
|
37
|
+
runs?: AgentActivityRun[];
|
|
38
|
+
/** Shown when there is no activity. */
|
|
39
|
+
emptyMessage?: string;
|
|
40
|
+
/** Called when the user stops a running agent. */
|
|
41
|
+
onStop?: (id: string) => void;
|
|
42
|
+
/** Called when the user wants to open the full run/chat. */
|
|
43
|
+
onOpenRun?: (id: string) => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const STATUS_LABEL: Record<AgentRunStatus, string> = {
|
|
47
|
+
running: "Working",
|
|
48
|
+
queued: "Queued",
|
|
49
|
+
done: "Done",
|
|
50
|
+
failed: "Failed",
|
|
51
|
+
stopped: "Stopped",
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const STATUS_PILL: Record<AgentRunStatus, string> = {
|
|
55
|
+
running: "bg-primary-soft text-primary-text",
|
|
56
|
+
queued: "bg-surface-strong text-muted",
|
|
57
|
+
done: "bg-semantic-success-soft text-semantic-success",
|
|
58
|
+
failed: "bg-semantic-error-soft text-semantic-error",
|
|
59
|
+
stopped: "bg-surface-strong text-muted",
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function StatusPill({ status }: { status: AgentRunStatus }) {
|
|
63
|
+
return (
|
|
64
|
+
<span
|
|
65
|
+
className={[
|
|
66
|
+
"inline-flex shrink-0 items-center gap-xs rounded-full px-sm py-xxs text-caption",
|
|
67
|
+
STATUS_PILL[status],
|
|
68
|
+
].join(" ")}
|
|
69
|
+
>
|
|
70
|
+
<span
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
className={[
|
|
73
|
+
"size-1.5 rounded-full bg-current",
|
|
74
|
+
status === "running" ? "animate-pulse" : "",
|
|
75
|
+
].join(" ")}
|
|
76
|
+
/>
|
|
77
|
+
{STATUS_LABEL[status]}
|
|
78
|
+
</span>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const STEP_SHELL: Record<AgentStepStatus, string> = {
|
|
83
|
+
done: "border-transparent bg-semantic-success-soft text-semantic-success",
|
|
84
|
+
active: "border-transparent bg-primary-soft text-primary",
|
|
85
|
+
pending: "border-hairline bg-surface text-muted-soft",
|
|
86
|
+
failed: "border-transparent bg-semantic-error-soft text-semantic-error",
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
function StepGlyph({ status }: { status: AgentStepStatus }) {
|
|
90
|
+
if (status === "done") {
|
|
91
|
+
return <Icon name="check-checkmark" className="size-3" aria-hidden="true" />;
|
|
92
|
+
}
|
|
93
|
+
if (status === "active") {
|
|
94
|
+
return (
|
|
95
|
+
<Icon
|
|
96
|
+
name="loading-spinner"
|
|
97
|
+
className="size-3 animate-spin"
|
|
98
|
+
aria-hidden="true"
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
if (status === "failed") {
|
|
103
|
+
return <Icon name="x" className="size-3" aria-hidden="true" />;
|
|
104
|
+
}
|
|
105
|
+
return <Icon name="clock" className="size-3" aria-hidden="true" />;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function StepRow({ step }: { step: AgentActivityStep }) {
|
|
109
|
+
return (
|
|
110
|
+
<li className="flex items-start gap-sm">
|
|
111
|
+
<span
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
className={[
|
|
114
|
+
"mt-xxs flex size-5 shrink-0 items-center justify-center rounded-full border",
|
|
115
|
+
STEP_SHELL[step.status],
|
|
116
|
+
].join(" ")}
|
|
117
|
+
>
|
|
118
|
+
<StepGlyph status={step.status} />
|
|
119
|
+
</span>
|
|
120
|
+
<span className="min-w-0 flex-1">
|
|
121
|
+
<span
|
|
122
|
+
className={[
|
|
123
|
+
"block text-body-sm",
|
|
124
|
+
step.status === "pending" ? "text-muted" : "text-ink",
|
|
125
|
+
].join(" ")}
|
|
126
|
+
>
|
|
127
|
+
{step.label}
|
|
128
|
+
</span>
|
|
129
|
+
{step.detail ? (
|
|
130
|
+
<span className="block text-caption text-muted">{step.detail}</span>
|
|
131
|
+
) : null}
|
|
132
|
+
</span>
|
|
133
|
+
<span className="sr-only">
|
|
134
|
+
{step.status === "done"
|
|
135
|
+
? "completed"
|
|
136
|
+
: step.status === "active"
|
|
137
|
+
? "in progress"
|
|
138
|
+
: step.status === "failed"
|
|
139
|
+
? "failed"
|
|
140
|
+
: "waiting"}
|
|
141
|
+
</span>
|
|
142
|
+
</li>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function ActivityRunCard({
|
|
147
|
+
run,
|
|
148
|
+
onStop,
|
|
149
|
+
onOpenRun,
|
|
150
|
+
}: {
|
|
151
|
+
run: AgentActivityRun;
|
|
152
|
+
onStop?: (id: string) => void;
|
|
153
|
+
onOpenRun?: (id: string) => void;
|
|
154
|
+
}) {
|
|
155
|
+
const isLive = run.status === "running";
|
|
156
|
+
const isQueued = run.status === "queued";
|
|
157
|
+
const progress = Math.max(0, Math.min(100, Math.round(run.progress ?? 0)));
|
|
158
|
+
const showProgress = typeof run.progress === "number" && !isQueued;
|
|
159
|
+
const hasFooter = Boolean(run.files?.length) || Boolean(onStop && isLive) || Boolean(onOpenRun);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<article
|
|
163
|
+
className={[
|
|
164
|
+
"rounded-xl border bg-surface p-base",
|
|
165
|
+
isQueued ? "border-hairline-soft" : "border-hairline",
|
|
166
|
+
isLive ? "shadow-sm" : "",
|
|
167
|
+
]
|
|
168
|
+
.filter(Boolean)
|
|
169
|
+
.join(" ")}
|
|
170
|
+
>
|
|
171
|
+
<div className="flex items-start gap-md">
|
|
172
|
+
<span
|
|
173
|
+
aria-hidden="true"
|
|
174
|
+
className={[
|
|
175
|
+
"relative flex size-8 shrink-0 items-center justify-center rounded-full border border-hairline bg-surface-soft text-body",
|
|
176
|
+
isLive ? "text-primary" : "",
|
|
177
|
+
].join(" ")}
|
|
178
|
+
>
|
|
179
|
+
<Icon name="bot" className="size-4" />
|
|
180
|
+
{isLive ? (
|
|
181
|
+
<span className="absolute -right-0.5 -top-0.5 size-2 rounded-full bg-primary ring-2 ring-surface" />
|
|
182
|
+
) : null}
|
|
183
|
+
</span>
|
|
184
|
+
|
|
185
|
+
<div className="min-w-0 flex-1">
|
|
186
|
+
<div className="flex flex-wrap items-center gap-sm">
|
|
187
|
+
<span className="min-w-0 truncate text-body-md text-ink">{run.title}</span>
|
|
188
|
+
<StatusPill status={run.status} />
|
|
189
|
+
</div>
|
|
190
|
+
<p className="mt-xxs truncate text-body-sm text-muted">
|
|
191
|
+
{run.agent}
|
|
192
|
+
{run.detail ? ` · ${run.detail}` : ""}
|
|
193
|
+
{run.elapsed ? ` · ${run.elapsed}` : ""}
|
|
194
|
+
</p>
|
|
195
|
+
</div>
|
|
196
|
+
</div>
|
|
197
|
+
|
|
198
|
+
{showProgress ? (
|
|
199
|
+
<div className="mt-md flex items-center gap-sm">
|
|
200
|
+
<div
|
|
201
|
+
role="progressbar"
|
|
202
|
+
aria-valuenow={progress}
|
|
203
|
+
aria-valuemin={0}
|
|
204
|
+
aria-valuemax={100}
|
|
205
|
+
aria-label={`${run.title} progress`}
|
|
206
|
+
className="h-1 flex-1 overflow-hidden rounded-full bg-surface-strong"
|
|
207
|
+
>
|
|
208
|
+
<div
|
|
209
|
+
className={[
|
|
210
|
+
"h-full rounded-full transition-[width] duration-500 ease-out",
|
|
211
|
+
run.status === "failed"
|
|
212
|
+
? "bg-semantic-error"
|
|
213
|
+
: run.status === "done"
|
|
214
|
+
? "bg-semantic-success"
|
|
215
|
+
: "bg-primary",
|
|
216
|
+
].join(" ")}
|
|
217
|
+
style={{ width: `${progress}%` }}
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
220
|
+
<span className="w-9 shrink-0 text-right text-caption tabular-nums text-muted">
|
|
221
|
+
{progress}%
|
|
222
|
+
</span>
|
|
223
|
+
</div>
|
|
224
|
+
) : null}
|
|
225
|
+
|
|
226
|
+
{run.steps?.length ? (
|
|
227
|
+
<ul className="mt-md flex flex-col gap-sm border-t border-hairline-soft pt-md">
|
|
228
|
+
{run.steps.map((step) => (
|
|
229
|
+
<StepRow key={step.id} step={step} />
|
|
230
|
+
))}
|
|
231
|
+
</ul>
|
|
232
|
+
) : null}
|
|
233
|
+
|
|
234
|
+
{hasFooter ? (
|
|
235
|
+
<div className="mt-md flex flex-wrap items-center justify-between gap-sm border-t border-hairline-soft pt-md">
|
|
236
|
+
<div className="flex min-w-0 flex-wrap items-center gap-xs">
|
|
237
|
+
{run.files?.map((file) => (
|
|
238
|
+
<span
|
|
239
|
+
key={file}
|
|
240
|
+
className="inline-flex max-w-full items-center gap-xs rounded-sm border border-hairline bg-canvas px-sm py-xxs text-caption text-body"
|
|
241
|
+
>
|
|
242
|
+
<Icon name="code" className="size-3 shrink-0 text-muted" aria-hidden="true" />
|
|
243
|
+
<span className="truncate">{file}</span>
|
|
244
|
+
</span>
|
|
245
|
+
))}
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<div className="flex shrink-0 items-center gap-xs">
|
|
249
|
+
{onStop && isLive ? (
|
|
250
|
+
<Button
|
|
251
|
+
variant="ghost"
|
|
252
|
+
size="sm"
|
|
253
|
+
onClick={() => onStop(run.id)}
|
|
254
|
+
aria-label={`Stop ${run.agent}`}
|
|
255
|
+
>
|
|
256
|
+
<Icon name="stop-square" className="size-3.5" aria-hidden="true" />
|
|
257
|
+
Stop
|
|
258
|
+
</Button>
|
|
259
|
+
) : null}
|
|
260
|
+
{onOpenRun ? (
|
|
261
|
+
<Button variant="ghost" size="sm" onClick={() => onOpenRun(run.id)}>
|
|
262
|
+
Open run
|
|
263
|
+
</Button>
|
|
264
|
+
) : null}
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
) : null}
|
|
268
|
+
</article>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export const AgentActivityPanel = React.forwardRef<
|
|
273
|
+
HTMLElement,
|
|
274
|
+
AgentActivityPanelProps
|
|
275
|
+
>(
|
|
276
|
+
(
|
|
277
|
+
{
|
|
278
|
+
heading = "Activity",
|
|
279
|
+
runs = [],
|
|
280
|
+
emptyMessage = "Nothing is running right now — agent work will show up here.",
|
|
281
|
+
onStop,
|
|
282
|
+
onOpenRun,
|
|
283
|
+
className,
|
|
284
|
+
...rest
|
|
285
|
+
},
|
|
286
|
+
ref,
|
|
287
|
+
) => {
|
|
288
|
+
const running = runs.filter((run) => run.status === "running").length;
|
|
289
|
+
const queued = runs.filter((run) => run.status === "queued").length;
|
|
290
|
+
|
|
291
|
+
const meta =
|
|
292
|
+
running > 0
|
|
293
|
+
? `${running} running${queued > 0 ? ` · ${queued} queued` : ""}`
|
|
294
|
+
: queued > 0
|
|
295
|
+
? `${queued} queued`
|
|
296
|
+
: "Idle";
|
|
297
|
+
|
|
298
|
+
return (
|
|
299
|
+
<section
|
|
300
|
+
ref={ref}
|
|
301
|
+
aria-label={heading}
|
|
302
|
+
className={["flex w-full flex-col gap-base", className]
|
|
303
|
+
.filter(Boolean)
|
|
304
|
+
.join(" ")}
|
|
305
|
+
{...rest}
|
|
306
|
+
>
|
|
307
|
+
<div className="flex items-center justify-between gap-md">
|
|
308
|
+
<div className="flex min-w-0 items-center gap-sm">
|
|
309
|
+
<span className="relative flex size-2 shrink-0" aria-hidden="true">
|
|
310
|
+
{running > 0 ? (
|
|
311
|
+
<span className="absolute inset-0 animate-ping rounded-full bg-primary opacity-60" />
|
|
312
|
+
) : null}
|
|
313
|
+
<span
|
|
314
|
+
className={[
|
|
315
|
+
"relative size-2 rounded-full",
|
|
316
|
+
running > 0 ? "bg-primary" : "bg-muted-soft",
|
|
317
|
+
].join(" ")}
|
|
318
|
+
/>
|
|
319
|
+
</span>
|
|
320
|
+
<h2 className="truncate text-body-md text-ink">{heading}</h2>
|
|
321
|
+
</div>
|
|
322
|
+
<span aria-live="polite" className="shrink-0 text-caption text-muted">
|
|
323
|
+
{meta}
|
|
324
|
+
</span>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
{runs.length === 0 ? (
|
|
328
|
+
<div className="rounded-lg border border-hairline-soft bg-surface px-base py-lg text-center">
|
|
329
|
+
<span className="block text-body-sm text-muted">{emptyMessage}</span>
|
|
330
|
+
</div>
|
|
331
|
+
) : (
|
|
332
|
+
<div className="flex flex-col gap-sm">
|
|
333
|
+
{runs.map((run) => (
|
|
334
|
+
<ActivityRunCard
|
|
335
|
+
key={run.id}
|
|
336
|
+
run={run}
|
|
337
|
+
onStop={onStop}
|
|
338
|
+
onOpenRun={onOpenRun}
|
|
339
|
+
/>
|
|
340
|
+
))}
|
|
341
|
+
</div>
|
|
342
|
+
)}
|
|
343
|
+
</section>
|
|
344
|
+
);
|
|
345
|
+
},
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
AgentActivityPanel.displayName = "AgentActivityPanel";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { AgentActivityPanel } from "./AgentActivityPanel";
|
|
3
|
+
import type { AgentActivityRun } from "./AgentActivityPanel";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
|
|
6
|
+
const INITIAL_RUNS: AgentActivityRun[] = [
|
|
7
|
+
{
|
|
8
|
+
id: "run-generate",
|
|
9
|
+
agent: "Builder agent",
|
|
10
|
+
title: "Generating CheckoutForm",
|
|
11
|
+
detail: "molecule · 3 fields",
|
|
12
|
+
status: "running",
|
|
13
|
+
progress: 62,
|
|
14
|
+
elapsed: "18s",
|
|
15
|
+
steps: [
|
|
16
|
+
{ id: "s1", label: "Reading project tokens", status: "done" },
|
|
17
|
+
{ id: "s2", label: "Writing CheckoutForm.tsx", status: "done" },
|
|
18
|
+
{ id: "s3", label: "Wiring preview states", status: "active" },
|
|
19
|
+
{ id: "s4", label: "Running component audit", status: "pending" },
|
|
20
|
+
],
|
|
21
|
+
files: ["CheckoutForm.tsx", "preview.tsx"],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "run-settings",
|
|
25
|
+
agent: "Design agent",
|
|
26
|
+
title: "Refactoring SettingsPageTemplate",
|
|
27
|
+
detail: "template · token pass",
|
|
28
|
+
status: "queued",
|
|
29
|
+
elapsed: "waiting 4s",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "run-toast",
|
|
33
|
+
agent: "Builder agent",
|
|
34
|
+
title: "Built ToastStack",
|
|
35
|
+
detail: "organism · 4 variants",
|
|
36
|
+
status: "done",
|
|
37
|
+
progress: 100,
|
|
38
|
+
elapsed: "1m 12s",
|
|
39
|
+
files: ["ToastStack.tsx"],
|
|
40
|
+
},
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const EMPTY_RUNS: AgentActivityRun[] = [];
|
|
44
|
+
|
|
45
|
+
export default function Preview() {
|
|
46
|
+
const [runs, setRuns] = useState<AgentActivityRun[]>(INITIAL_RUNS);
|
|
47
|
+
|
|
48
|
+
// Advance the live run so the preview shows real motion.
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
const id = window.setInterval(() => {
|
|
51
|
+
setRuns((prev) =>
|
|
52
|
+
prev.map((run) =>
|
|
53
|
+
run.status === "running"
|
|
54
|
+
? { ...run, progress: Math.min(100, (run.progress ?? 0) + 3) }
|
|
55
|
+
: run,
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
}, 900);
|
|
59
|
+
return () => window.clearInterval(id);
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
const progress = runs.find((r) => r.id === "run-generate")?.progress ?? 0;
|
|
63
|
+
|
|
64
|
+
const handleStop = (id: string) => {
|
|
65
|
+
setRuns((prev) =>
|
|
66
|
+
prev.map((run) =>
|
|
67
|
+
run.id === id ? { ...run, status: "stopped", elapsed: "stopped" } : run,
|
|
68
|
+
),
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleOpenRun = () => {
|
|
73
|
+
setRuns((prev) =>
|
|
74
|
+
prev.map((run) =>
|
|
75
|
+
run.status === "queued" ? { ...run, status: "running", progress: 8 } : run,
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-lg bg-canvas">
|
|
82
|
+
<div className="flex flex-wrap items-center justify-between gap-sm">
|
|
83
|
+
<p className="text-body-sm text-muted">
|
|
84
|
+
Live agent activity — the run above advances on its own ({progress}%).
|
|
85
|
+
</p>
|
|
86
|
+
<Button variant="secondary" size="sm" onClick={() => setRuns(INITIAL_RUNS)}>
|
|
87
|
+
Reset demo
|
|
88
|
+
</Button>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div className="grid gap-base lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
|
|
92
|
+
<div className="rounded-xl border border-hairline bg-canvas p-base">
|
|
93
|
+
<AgentActivityPanel
|
|
94
|
+
heading="Activity"
|
|
95
|
+
runs={runs}
|
|
96
|
+
onStop={handleStop}
|
|
97
|
+
onOpenRun={handleOpenRun}
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
<div className="rounded-xl border border-hairline bg-canvas p-base">
|
|
102
|
+
<AgentActivityPanel heading="Activity" runs={EMPTY_RUNS} />
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|