@spunto/design-system 0.72.0 → 0.74.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/package.json +1 -1
- package/src/components/tasks/app-tiles.tsx +89 -7
- package/src/components/tasks/index.ts +2 -1
- package/src/components/tasks/new-task-composer.tsx +57 -41
- package/src/components/tasks/new-task-dialog.tsx +6 -0
- package/src/components/tasks/task-details.tsx +9 -3
- package/src/components/tasks/tasks.test.tsx +22 -2
- package/src/components/tasks/types.ts +11 -0
package/package.json
CHANGED
|
@@ -7,10 +7,27 @@
|
|
|
7
7
|
// other block uses.
|
|
8
8
|
|
|
9
9
|
import { useState, type ReactNode } from "react"
|
|
10
|
-
import { CheckIcon, CopyIcon, ExternalLinkIcon } from "lucide-react"
|
|
10
|
+
import { CheckIcon, CopyIcon, ExternalLinkIcon, Loader2Icon } from "lucide-react"
|
|
11
11
|
|
|
12
12
|
import { cn } from "../../utils"
|
|
13
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
AlertDialog,
|
|
15
|
+
AlertDialogClose,
|
|
16
|
+
AlertDialogContent,
|
|
17
|
+
AlertDialogDescription,
|
|
18
|
+
AlertDialogFooter,
|
|
19
|
+
AlertDialogHeader,
|
|
20
|
+
AlertDialogTitle,
|
|
21
|
+
AlertDialogTrigger,
|
|
22
|
+
} from "../alert-dialog"
|
|
23
|
+
import { Button } from "../button"
|
|
24
|
+
import type { TaskAppTile, TaskAppTileAction, TaskAppTileFact, TaskAppTileItem, TaskAppTileList, TaskAppTileMeter, TaskAppTileTone } from "./types"
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Runs one of a row's buttons. Rejects with what to tell the reader — the app's own refusal
|
|
28
|
+
* (« Required status check is expected ») — and the confirmation stays open to say it.
|
|
29
|
+
*/
|
|
30
|
+
export type TaskAppTileActionHandler = (item: TaskAppTileItem, action: TaskAppTileAction) => Promise<void>
|
|
14
31
|
|
|
15
32
|
const TONE_TEXT: Record<TaskAppTileTone, string> = {
|
|
16
33
|
neutral: "text-muted-foreground",
|
|
@@ -168,26 +185,91 @@ function ItemBody({ item }: { item: TaskAppTileItem }) {
|
|
|
168
185
|
)
|
|
169
186
|
}
|
|
170
187
|
|
|
188
|
+
/**
|
|
189
|
+
* One button of a row, and the confirmation in front of it — always one: what it does happens
|
|
190
|
+
* outside Spunto (a merge on GitHub), and a button one pixel from « open the PR » is easy to hit.
|
|
191
|
+
* The dialog stays until the app answers, and says why when it refuses.
|
|
192
|
+
*/
|
|
193
|
+
function ItemAction({ item, action, onAction }: { item: TaskAppTileItem; action: TaskAppTileAction; onAction: TaskAppTileActionHandler }) {
|
|
194
|
+
const [open, setOpen] = useState(false)
|
|
195
|
+
const [busy, setBusy] = useState(false)
|
|
196
|
+
const [error, setError] = useState<string | null>(null)
|
|
197
|
+
const danger = action.tone === "danger"
|
|
198
|
+
|
|
199
|
+
const run = async () => {
|
|
200
|
+
setBusy(true)
|
|
201
|
+
setError(null)
|
|
202
|
+
try {
|
|
203
|
+
await onAction(item, action)
|
|
204
|
+
setOpen(false)
|
|
205
|
+
} catch (err) {
|
|
206
|
+
setError(err instanceof Error ? err.message : String(err))
|
|
207
|
+
} finally {
|
|
208
|
+
setBusy(false)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return (
|
|
213
|
+
<AlertDialog
|
|
214
|
+
open={open}
|
|
215
|
+
onOpenChange={(next) => {
|
|
216
|
+
if (busy) return
|
|
217
|
+
setOpen(next)
|
|
218
|
+
if (!next) setError(null)
|
|
219
|
+
}}
|
|
220
|
+
>
|
|
221
|
+
<AlertDialogTrigger render={<Button size="xs" variant={danger ? "destructive" : "outline"} />}>{action.label}</AlertDialogTrigger>
|
|
222
|
+
<AlertDialogContent>
|
|
223
|
+
<AlertDialogHeader>
|
|
224
|
+
<AlertDialogTitle>{action.confirm.title}</AlertDialogTitle>
|
|
225
|
+
{action.confirm.body && <AlertDialogDescription>{action.confirm.body}</AlertDialogDescription>}
|
|
226
|
+
</AlertDialogHeader>
|
|
227
|
+
{error && (
|
|
228
|
+
<p role="alert" className="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive">
|
|
229
|
+
{error}
|
|
230
|
+
</p>
|
|
231
|
+
)}
|
|
232
|
+
<AlertDialogFooter>
|
|
233
|
+
<AlertDialogClose render={<Button variant="outline" size="sm" disabled={busy} />}>Cancel</AlertDialogClose>
|
|
234
|
+
<Button size="sm" variant={danger ? "destructive" : "default"} disabled={busy} onClick={run}>
|
|
235
|
+
{busy && <Loader2Icon className="animate-spin" />}
|
|
236
|
+
{action.confirm.label ?? action.label}
|
|
237
|
+
</Button>
|
|
238
|
+
</AlertDialogFooter>
|
|
239
|
+
</AlertDialogContent>
|
|
240
|
+
</AlertDialog>
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
|
|
171
244
|
/**
|
|
172
245
|
* The rows of one app's block. A row with a `url` is a card that opens it — the same card as the
|
|
173
246
|
* branch's own pull request; a row without one (an MCP server) is a compact line: name, then state.
|
|
247
|
+
* A row's buttons (`actions`) sit under its card, outside the link, and only with an `onAction`:
|
|
248
|
+
* a reader that cannot run them is not shown them.
|
|
174
249
|
*/
|
|
175
|
-
export function TaskAppTileItems({ items, className }: { items: TaskAppTileItem[]; className?: string }) {
|
|
250
|
+
export function TaskAppTileItems({ items, onAction, className }: { items: TaskAppTileItem[]; onAction?: TaskAppTileActionHandler; className?: string }) {
|
|
176
251
|
if (items.length === 0) return null
|
|
177
252
|
return (
|
|
178
253
|
<ul className={cn("space-y-1.5", className)}>
|
|
179
254
|
{items.map((item) =>
|
|
180
255
|
item.url ? (
|
|
181
|
-
<li key={item.url}>
|
|
256
|
+
<li key={item.url} className="rounded-md border border-border/60 bg-background/60 transition-colors hover:border-border">
|
|
182
257
|
<a
|
|
183
258
|
href={item.url}
|
|
184
259
|
target="_blank"
|
|
185
260
|
rel="noreferrer"
|
|
186
261
|
title={item.url}
|
|
187
|
-
className="group block rounded-md
|
|
262
|
+
className="group block rounded-md px-2.5 py-2 transition-colors hover:bg-muted/40"
|
|
188
263
|
>
|
|
189
264
|
<ItemBody item={item} />
|
|
190
265
|
</a>
|
|
266
|
+
{onAction && item.actions && item.actions.length > 0 && (
|
|
267
|
+
<div className="flex flex-wrap items-center justify-end gap-1.5 border-t border-border/60 px-2.5 py-1.5">
|
|
268
|
+
{item.actions.map((action) => (
|
|
269
|
+
<ItemAction key={action.id} item={item} action={action} onAction={onAction} />
|
|
270
|
+
))}
|
|
271
|
+
</div>
|
|
272
|
+
)}
|
|
191
273
|
</li>
|
|
192
274
|
) : (
|
|
193
275
|
<li key={`title:${item.title}`} className="flex min-w-0 items-center justify-between gap-2">
|
|
@@ -212,11 +294,11 @@ function Section({ children, divided }: { children: ReactNode; divided: boolean
|
|
|
212
294
|
}
|
|
213
295
|
|
|
214
296
|
/** One app's block, every section it sent, in the contract's order: meters, facts, items, lists. */
|
|
215
|
-
export function TaskAppTileContent({ tile, className }: { tile: TaskAppTile; className?: string }) {
|
|
297
|
+
export function TaskAppTileContent({ tile, onAction, className }: { tile: TaskAppTile; onAction?: TaskAppTileActionHandler; className?: string }) {
|
|
216
298
|
const sections: ReactNode[] = []
|
|
217
299
|
if (tile.meters?.length) sections.push(tile.meters.map((m) => <Meter key={m.label} meter={m} />))
|
|
218
300
|
if (tile.facts?.length) sections.push(<div className="space-y-1.5">{tile.facts.map((f) => <Fact key={f.label} fact={f} />)}</div>)
|
|
219
|
-
if (tile.items?.length) sections.push(<TaskAppTileItems items={tile.items} />)
|
|
301
|
+
if (tile.items?.length) sections.push(<TaskAppTileItems items={tile.items} onAction={onAction} />)
|
|
220
302
|
if (tile.lists?.length) sections.push(tile.lists.map((l) => <List key={l.label} list={l} />))
|
|
221
303
|
if (sections.length === 0) return null
|
|
222
304
|
return (
|
|
@@ -86,7 +86,7 @@ export type { TaskDiffPanelProps } from "./diff-panel"
|
|
|
86
86
|
export { TaskTerminalPanel } from "./terminal-panel"
|
|
87
87
|
export type { TaskTerminalPanelProps } from "./terminal-panel"
|
|
88
88
|
export { TaskSharedFiles, TaskSharedLinks } from "./shared"
|
|
89
|
-
export { TaskAppTileContent, TaskAppTileItems } from "./app-tiles"
|
|
89
|
+
export { TaskAppTileContent, TaskAppTileItems, type TaskAppTileActionHandler } from "./app-tiles"
|
|
90
90
|
export { TaskSessionUsage, formatCost, formatTokens } from "./session-usage"
|
|
91
91
|
export { TaskCommandLog } from "./command-log"
|
|
92
92
|
export { TaskBoot, TaskMachine, TaskMonitoring, bootSteps, workerLabel } from "./machine"
|
|
@@ -100,6 +100,7 @@ export type {
|
|
|
100
100
|
TaskAppTile,
|
|
101
101
|
TaskAppTileFact,
|
|
102
102
|
TaskAppTileItem,
|
|
103
|
+
TaskAppTileAction,
|
|
103
104
|
TaskAppTileList,
|
|
104
105
|
TaskAppTileMeter,
|
|
105
106
|
TaskAppTileTone,
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
// same spot, as the `TaskComposer` that answers the agent once it runs. Writing the first message
|
|
8
8
|
// and writing the next ones is one gesture, so it gets one shape: the words take the room, and
|
|
9
9
|
// where the work happens (project, base branch, model, the app's own fields — which machine…) is
|
|
10
|
-
// a row of chips under them, each showing what will be used if nobody touches it.
|
|
10
|
+
// a row of chips under them, each showing what will be used if nobody touches it. Those whose
|
|
11
|
+
// default is almost always right (the base branch, `advanced` fields: an effort, the machine) wait
|
|
12
|
+
// behind an Options chip, so the row says only what is worth a glance.
|
|
11
13
|
//
|
|
12
14
|
// The title is not asked: the task takes the name the agent gives the conversation, and the
|
|
13
15
|
// cockpit renames it in place afterwards (`TaskTitle`).
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
// come back down. It fills its parent like `TaskCockpit`, so it can stand where a cockpit stands.
|
|
18
20
|
|
|
19
21
|
import { useState, type ReactNode } from "react"
|
|
20
|
-
import { ArrowLeftIcon, CornerDownLeftIcon, FolderIcon, GitBranchIcon, Loader2Icon, PackageIcon, SparklesIcon } from "lucide-react"
|
|
22
|
+
import { ArrowLeftIcon, CornerDownLeftIcon, FolderIcon, GitBranchIcon, Loader2Icon, PackageIcon, SlidersHorizontalIcon, SparklesIcon } from "lucide-react"
|
|
21
23
|
|
|
22
24
|
import { cn } from "../../utils"
|
|
23
25
|
import { Button } from "../button"
|
|
@@ -264,6 +266,7 @@ export function NewTaskComposer({
|
|
|
264
266
|
setModel(remembered?.model ?? "")
|
|
265
267
|
setPicked({})
|
|
266
268
|
}
|
|
269
|
+
const [showAdvanced, setShowAdvanced] = useState(false)
|
|
267
270
|
const draft = useAttachmentDraft()
|
|
268
271
|
const Link = render?.link ?? defaultLink
|
|
269
272
|
|
|
@@ -281,6 +284,16 @@ export function NewTaskComposer({
|
|
|
281
284
|
? `Pick “${fields.find((f) => f.required && isEmpty(fieldValue(f)))!.label}” first.`
|
|
282
285
|
: null
|
|
283
286
|
|
|
287
|
+
// An advanced field that blocks Delegate is not hidden: the reason names it, it must be there.
|
|
288
|
+
const advanced = fields.filter((f) => f.advanced)
|
|
289
|
+
const advancedOpen = showAdvanced || advanced.some((f) => f.required && isEmpty(fieldValue(f)))
|
|
290
|
+
// The base branch is one of them: it is the default branch nearly every time.
|
|
291
|
+
const hasAdvanced = advanced.length > 0 || !hideBaseBranch
|
|
292
|
+
const advancedLabels = [...(hideBaseBranch ? [] : ["Base branch"]), ...advanced.map((f) => f.label)]
|
|
293
|
+
const branchPicked = !hideBaseBranch && baseBranch.trim() !== (remembered?.baseBranch ?? "") ? 1 : 0
|
|
294
|
+
const advancedPicked = advanced.filter((f) => f.id in picked).length + branchPicked
|
|
295
|
+
const shown = (f: NewTaskCustomField) => !f.advanced || advancedOpen
|
|
296
|
+
|
|
284
297
|
function submit() {
|
|
285
298
|
if (disabled) return
|
|
286
299
|
const values = Object.fromEntries(fields.map((f) => [f.id, fieldValue(f)] as const).filter(([, v]) => !isEmpty(v)))
|
|
@@ -294,6 +307,21 @@ export function NewTaskComposer({
|
|
|
294
307
|
})
|
|
295
308
|
}
|
|
296
309
|
|
|
310
|
+
const fieldChip = (f: NewTaskCustomField) => (
|
|
311
|
+
<span
|
|
312
|
+
key={f.id}
|
|
313
|
+
className="inline-flex"
|
|
314
|
+
data-slot="new-task-field"
|
|
315
|
+
data-field={f.id}
|
|
316
|
+
title={[f.label, typeof f.hint === "string" ? f.hint : null].filter(Boolean).join(" — ")}
|
|
317
|
+
>
|
|
318
|
+
{f.render(fieldValue(f), (v) => {
|
|
319
|
+
setPicked((prev) => ({ ...prev, [f.id]: v }))
|
|
320
|
+
onFieldChange?.(f.id, v)
|
|
321
|
+
})}
|
|
322
|
+
</span>
|
|
323
|
+
)
|
|
324
|
+
|
|
297
325
|
const back = backHref ? (
|
|
298
326
|
<Link href={backHref} className={cn(buttonVariants({ variant: "ghost", size: "icon" }), "h-8 w-8 shrink-0")}>
|
|
299
327
|
<ArrowLeftIcon className="h-4 w-4" />
|
|
@@ -383,32 +411,7 @@ export function NewTaskComposer({
|
|
|
383
411
|
)}
|
|
384
412
|
|
|
385
413
|
{/* Fields the package's chips depend on — the harness, before the model it lists. */}
|
|
386
|
-
{fields.filter((f) => f.placement === "lead").map(
|
|
387
|
-
<span
|
|
388
|
-
key={f.id}
|
|
389
|
-
className="inline-flex"
|
|
390
|
-
data-slot="new-task-field"
|
|
391
|
-
data-field={f.id}
|
|
392
|
-
title={[f.label, typeof f.hint === "string" ? f.hint : null].filter(Boolean).join(" — ")}
|
|
393
|
-
>
|
|
394
|
-
{f.render(fieldValue(f), (v) => {
|
|
395
|
-
setPicked((prev) => ({ ...prev, [f.id]: v }))
|
|
396
|
-
onFieldChange?.(f.id, v)
|
|
397
|
-
})}
|
|
398
|
-
</span>
|
|
399
|
-
))}
|
|
400
|
-
|
|
401
|
-
{!hideBaseBranch && (
|
|
402
|
-
<FreeTextChip
|
|
403
|
-
label="Base branch"
|
|
404
|
-
icon={<GitBranchIcon />}
|
|
405
|
-
value={baseBranch}
|
|
406
|
-
onChange={setBaseBranch}
|
|
407
|
-
placeholder={defaultBranch ?? "default branch"}
|
|
408
|
-
groups={[{ id: "branches", items: branches.map((b) => ({ value: b })) }]}
|
|
409
|
-
searchPlaceholder="Start from…"
|
|
410
|
-
/>
|
|
411
|
-
)}
|
|
414
|
+
{fields.filter((f) => f.placement === "lead" && shown(f)).map(fieldChip)}
|
|
412
415
|
|
|
413
416
|
<FreeTextChip
|
|
414
417
|
label="Model"
|
|
@@ -424,20 +427,33 @@ export function NewTaskComposer({
|
|
|
424
427
|
mono
|
|
425
428
|
/>
|
|
426
429
|
|
|
427
|
-
{
|
|
428
|
-
<
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
430
|
+
{!hideBaseBranch && advancedOpen && (
|
|
431
|
+
<FreeTextChip
|
|
432
|
+
label="Base branch"
|
|
433
|
+
icon={<GitBranchIcon />}
|
|
434
|
+
value={baseBranch}
|
|
435
|
+
onChange={setBaseBranch}
|
|
436
|
+
placeholder={defaultBranch ?? "default branch"}
|
|
437
|
+
groups={[{ id: "branches", items: branches.map((b) => ({ value: b })) }]}
|
|
438
|
+
searchPlaceholder="Start from…"
|
|
439
|
+
/>
|
|
440
|
+
)}
|
|
441
|
+
|
|
442
|
+
{fields.filter((f) => f.placement !== "lead" && shown(f)).map(fieldChip)}
|
|
443
|
+
|
|
444
|
+
{hasAdvanced && (
|
|
445
|
+
<button
|
|
446
|
+
type="button"
|
|
447
|
+
aria-expanded={advancedOpen}
|
|
448
|
+
aria-label={advancedOpen ? "Hide options" : "More options"}
|
|
449
|
+
title={advancedOpen ? "Hide options" : `${advancedLabels.join(", ")} — the defaults apply unless you pick`}
|
|
450
|
+
onClick={() => setShowAdvanced(!advancedOpen)}
|
|
451
|
+
className={cn(newTaskChipClassName, "inline-flex items-center border outline-none focus-visible:ring-2 focus-visible:ring-ring/40", advancedOpen && "bg-muted text-foreground")}
|
|
434
452
|
>
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
</span>
|
|
440
|
-
))}
|
|
453
|
+
<SlidersHorizontalIcon />
|
|
454
|
+
{!advancedOpen && <span>Options{advancedPicked > 0 ? ` · ${advancedPicked}` : ""}</span>}
|
|
455
|
+
</button>
|
|
456
|
+
)}
|
|
441
457
|
|
|
442
458
|
<div className="ml-auto flex items-center gap-2 pl-2">
|
|
443
459
|
<span className="hidden truncate text-[10px] text-muted-foreground @min-[36rem]:inline">
|
|
@@ -76,6 +76,12 @@ export interface NewTaskCustomField {
|
|
|
76
76
|
* default) after them. The dialog ignores it: its fields come after the package's.
|
|
77
77
|
*/
|
|
78
78
|
placement?: "lead" | "trail"
|
|
79
|
+
/**
|
|
80
|
+
* The composer keeps it out of sight behind its Options chip until someone opens it — a setting
|
|
81
|
+
* whose default is almost always right (an effort, the machine). Shown anyway while it is required
|
|
82
|
+
* and has no value. The dialog ignores it.
|
|
83
|
+
*/
|
|
84
|
+
advanced?: boolean
|
|
79
85
|
render: (value: unknown, onChange: (value: unknown) => void) => ReactNode
|
|
80
86
|
}
|
|
81
87
|
|
|
@@ -27,7 +27,7 @@ import { TaskSessionUsage } from "./session-usage"
|
|
|
27
27
|
import { TaskSharedFiles, TaskSharedLinks } from "./shared"
|
|
28
28
|
import { TaskAppTileContent } from "./app-tiles"
|
|
29
29
|
import { isLiveTaskState, taskSpan } from "./task-state"
|
|
30
|
-
import type { AttachmentUrl, TaskAppTile, TaskCommand, TaskItem, TaskPendingAction, TaskSessionUsageData, TaskSharedData } from "./types"
|
|
30
|
+
import type { AttachmentUrl, TaskAppTile, TaskAppTileAction, TaskAppTileItem, TaskCommand, TaskItem, TaskPendingAction, TaskSessionUsageData, TaskSharedData } from "./types"
|
|
31
31
|
|
|
32
32
|
/** Set by `TaskCockpitMobile` around its sheet, so Drop can close it. @internal */
|
|
33
33
|
export const TaskDetailsSheetContext = createContext<{ close: () => void } | null>(null)
|
|
@@ -53,6 +53,11 @@ export interface TaskDetailsProps {
|
|
|
53
53
|
* integrations. Absent (or null for a tile) = no link.
|
|
54
54
|
*/
|
|
55
55
|
appTileSettingsHref?: (tile: TaskAppTile) => string | null
|
|
56
|
+
/**
|
|
57
|
+
* Runs a button a block offers on one of its rows (GitHub: Merge, Close), after its confirmation.
|
|
58
|
+
* Rejects with the message to show. Absent → the buttons are not drawn.
|
|
59
|
+
*/
|
|
60
|
+
onAppTileAction?: (tile: TaskAppTile, item: TaskAppTileItem, action: TaskAppTileAction) => Promise<void>
|
|
56
61
|
attachmentUrl?: AttachmentUrl
|
|
57
62
|
/**
|
|
58
63
|
* The member who delegated the task — drawn in the header, avatar and name. Absent → just
|
|
@@ -230,6 +235,7 @@ export function TaskDetails({
|
|
|
230
235
|
shared,
|
|
231
236
|
appTiles,
|
|
232
237
|
appTileSettingsHref,
|
|
238
|
+
onAppTileAction,
|
|
233
239
|
attachmentUrl,
|
|
234
240
|
delegatedBy,
|
|
235
241
|
machine,
|
|
@@ -356,7 +362,7 @@ export function TaskDetails({
|
|
|
356
362
|
from the task's agent app — Session's numbers stay ours, the same for every harness. */}
|
|
357
363
|
{appTiles?.filter((tile) => tile.session).map((tile) => (
|
|
358
364
|
<Block key={tile.appId} id={`app:${tile.appId}`} variant={variant} title={tile.title} hint={tile.appName === tile.title ? undefined : tile.appName}>
|
|
359
|
-
<TaskAppTileContent tile={tile} />
|
|
365
|
+
<TaskAppTileContent tile={tile} onAction={onAppTileAction && ((item, action) => onAppTileAction(tile, item, action))} />
|
|
360
366
|
<CustomizeLink tile={tile} href={appTileSettingsHref} />
|
|
361
367
|
</Block>
|
|
362
368
|
))}
|
|
@@ -365,7 +371,7 @@ export function TaskDetails({
|
|
|
365
371
|
it talked about, with where each one stands. */}
|
|
366
372
|
{appTiles?.filter((tile) => !tile.session).map((tile) => (
|
|
367
373
|
<Block key={tile.appId} id={`app:${tile.appId}`} variant={variant} title={tile.title} hint={tile.appName === tile.title ? undefined : tile.appName}>
|
|
368
|
-
<TaskAppTileContent tile={tile} />
|
|
374
|
+
<TaskAppTileContent tile={tile} onAction={onAppTileAction && ((item, action) => onAppTileAction(tile, item, action))} />
|
|
369
375
|
<CustomizeLink tile={tile} href={appTileSettingsHref} />
|
|
370
376
|
</Block>
|
|
371
377
|
))}
|
|
@@ -646,9 +646,11 @@ describe("NewTaskComposer — delegating where the conversation will be", () =>
|
|
|
646
646
|
it("Enter delegates, Shift+Enter does not, and blank options are left out", () => {
|
|
647
647
|
const onSubmit = vi.fn()
|
|
648
648
|
render(<NewTaskComposer defaultBranch="main" defaultModel="claude-opus-5" onSubmit={onSubmit} />)
|
|
649
|
-
// The chips say what will be used when nobody picks.
|
|
650
|
-
expect(screen.getByText("main")).toBeTruthy()
|
|
649
|
+
// The chips say what will be used when nobody picks — the branch behind Options.
|
|
651
650
|
expect(screen.getByText("claude-opus-5")).toBeTruthy()
|
|
651
|
+
expect(screen.queryByText("main")).toBeNull()
|
|
652
|
+
fireEvent.click(screen.getByRole("button", { name: "More options" }))
|
|
653
|
+
expect(screen.getByText("main")).toBeTruthy()
|
|
652
654
|
fireEvent.change(prompt(), { target: { value: " Fix the login on Safari " } })
|
|
653
655
|
fireEvent.keyDown(prompt(), { key: "Enter", shiftKey: true })
|
|
654
656
|
expect(onSubmit).not.toHaveBeenCalled()
|
|
@@ -671,6 +673,23 @@ describe("NewTaskComposer — delegating where the conversation will be", () =>
|
|
|
671
673
|
expect(onSubmit.mock.calls[0]![0].fields).toEqual({ machine: "worker", harness: "claude" })
|
|
672
674
|
})
|
|
673
675
|
|
|
676
|
+
it("keeps advanced fields behind Options — still sent, and shown while one blocks Delegate", () => {
|
|
677
|
+
const onSubmit = vi.fn()
|
|
678
|
+
const { rerender } = render(<NewTaskComposer fields={[machine({ advanced: true, required: true })]} onSubmit={onSubmit} />)
|
|
679
|
+
expect(screen.queryByLabelText("Runs on")).toBeNull()
|
|
680
|
+
fireEvent.change(prompt(), { target: { value: "Fix it" } })
|
|
681
|
+
fireEvent.keyDown(prompt(), { key: "Enter" })
|
|
682
|
+
// Hidden is not dropped: its default goes with the task.
|
|
683
|
+
expect(onSubmit.mock.calls[0]![0].fields).toEqual({ machine: "worker" })
|
|
684
|
+
fireEvent.click(screen.getByRole("button", { name: "More options" }))
|
|
685
|
+
expect(screen.getByLabelText("Runs on")).toBeTruthy()
|
|
686
|
+
fireEvent.click(screen.getByRole("button", { name: "Hide options" }))
|
|
687
|
+
expect(screen.queryByLabelText("Runs on")).toBeNull()
|
|
688
|
+
// Required with no value: the reason names it, so it shows.
|
|
689
|
+
rerender(<NewTaskComposer fields={[machine({ advanced: true, required: true, defaultValue: "" })]} onSubmit={onSubmit} />)
|
|
690
|
+
expect(screen.getByLabelText("Runs on")).toBeTruthy()
|
|
691
|
+
})
|
|
692
|
+
|
|
674
693
|
it("org-wide, Delegate waits for a project and says so", () => {
|
|
675
694
|
const onSubmit = vi.fn()
|
|
676
695
|
render(<NewTaskComposer projects={[{ id: "p1", name: "spunto" }]} onSubmit={onSubmit} />)
|
|
@@ -721,6 +740,7 @@ describe("NewTaskComposer — delegating where the conversation will be", () =>
|
|
|
721
740
|
const onSubmit = vi.fn()
|
|
722
741
|
const props = { defaultBranch: "main", fields: [machine()], onSubmit }
|
|
723
742
|
const { rerender } = render(<NewTaskComposer {...props} remembered={{ key: "p1", baseBranch: "dev", model: "claude-sonnet-5-5" }} />)
|
|
743
|
+
fireEvent.click(screen.getByRole("button", { name: "More options" }))
|
|
724
744
|
expect(screen.getByText("dev")).toBeTruthy()
|
|
725
745
|
expect(screen.getByText("claude-sonnet-5-5")).toBeTruthy()
|
|
726
746
|
fireEvent.change(screen.getByLabelText("Runs on"), { target: { value: "sandbox" } })
|
|
@@ -255,6 +255,17 @@ export interface TaskAppTileItem {
|
|
|
255
255
|
subtitle?: string
|
|
256
256
|
status?: { label: string; tone: TaskAppTileTone }
|
|
257
257
|
badges?: { label: string; tone: TaskAppTileTone }[]
|
|
258
|
+
/** Buttons the app offers on this row — « Merge », « Close ». Drawn only with an `onAction`. */
|
|
259
|
+
actions?: TaskAppTileAction[]
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** A button on an app's row, always behind a confirmation drawn from `confirm`. */
|
|
263
|
+
export interface TaskAppTileAction {
|
|
264
|
+
id: string
|
|
265
|
+
label: string
|
|
266
|
+
/** `danger`: a destructive button, here and in the confirmation. */
|
|
267
|
+
tone?: TaskAppTileTone
|
|
268
|
+
confirm: { title: string; body?: string; label?: string }
|
|
258
269
|
}
|
|
259
270
|
|
|
260
271
|
/** « Claude Code → 2.1.310 ». `copy`: the value is something to paste (an id). */
|